aboutsummaryrefslogtreecommitdiff
path: root/network/openssh/openssh.build
blob: 1d5552022cd2a64f26c62616f916c02f18fa2942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=openssh
VERSION=6.2p1
BUILD=1
DEPENDS=('openssl >= 1.0.1e-1' 'tcpip >= 20130209-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: openssh (Secure Shell daemon and clients)
${NAME}:
${NAME}: ssh (Secure Shell) is a program for logging into a remote machine and
${NAME}: for executing commands on a remote machine.  It is intended to
${NAME}: replace rlogin and rsh, and provide secure encrypted communications
${NAME}: between two untrusted hosts over an insecure network. sshd (SSH
${NAME}: Daemon) is the daemon program for ssh.  OpenSSH is based on the last
${NAME}: free version of Tatu Ylonen's SSH, further enhanced and cleaned up by
${NAME}: Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt,
${NAME}: and Dug Song. It has a homepage at http://www.openssh.com
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/ssh/ssh_config.new
config etc/ssh/sshd_config.new
config etc/rc.d/rc.sshd.new

# If the sshd user/group/shadow don't exist, add them:

if ! grep -q "^sshd:" etc/passwd ; then
  echo "sshd:x:33:33:sshd:/:" >> etc/passwd
fi

if ! grep -q "^sshd:" etc/group ; then
  echo "sshd::33:sshd" >> etc/group
fi

if ! grep -q "^sshd:" etc/shadow ; then
  echo "sshd:*:9797:0:::::" >> etc/shadow
fi

# Add a btmp file to store login failure if one doesn't exist:

if [ ! -r var/log/btmp ]; then
  ( cd var/log ; umask 077 ; touch btmp )
fi
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://ftp.belnet.be/pub/OpenBSD/OpenSSH/portable/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz

build0()
{
#FIXME: PAM
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}/ssh" \
 --libdir="${SYS_DIR[lib]}" \
 --libexecdir="${SYS_DIR[lib]}/exec" \
 --localstatedir="${SYS_DIR[var]}" \
 --without-pam \
 --with-xauth="${SYS_DIR[bin]}/xauth" \
 --with-pid-dir="${SYS_DIR[run]}/sshd" \
 --with-default-path="/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin" \
 --with-md5-passwords \
 --with-tcp-wrappers \
 --with-privsep-user=sshd \
 --with-privsep-path="${SYS_DIR[var]}/empty"
make ${JOBS}
make install DESTDIR="${PKG}"
doc CREDITS README.{dns,privsep,tun}
changelog ChangeLog
license LICENCE
install.dir ${PKG}${SYS_DIR[var]}/empty
install.dir ${PKG}${SYS_DIR[etc]}/{rc.d,tmpfiles.d}
install.bin rc.sshd.new ${PKG}${SYS_DIR[etc]}/rc.d
install.dat sshd.conf.tmpfilesd ${PKG}${SYS_DIR[etc]}/tmpfiles.d/sshd.conf
install.bin contrib/ssh-copy-id ${PKG}${SYS_DIR[bin]}
install.man contrib/ssh-copy-id.1 ${PKG}${SYS_DIR[man]}/man1
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.cfg systemd/* ${PKG}${SYS_DIR[systemdsystemunitdir]}
(
  cd ${PKG}${SYS_DIR[etc]}/ssh
  rm -f ssh_host*key.*
  mv ssh_config ssh_config.new
  mv sshd_config sshd_config.new
)
}