wok-tiny view dropbear/receipt @ rev 142

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 27 17:43:23 2019 +0100 (2 months ago)
parents 10cf1a5f187d
children
line source
1 # SliTaz package receipt.
3 PACKAGE="dropbear"
4 VERSION="0.53"
5 CATEGORY="security"
6 SHORT_DESC="Light SSH client and server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="MIT"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 DEPENDS="libutil zlib"
11 [ -n "$TARGET" ] || TARGET="i486"
12 BUILD_DEPENDS="uclibc-cross-compiler-$TARGET zlib-dev"
13 WEB_SITE="http://matt.ucc.asn.au/dropbear/dropbear.html"
14 WGET_URL="http://matt.ucc.asn.au/dropbear/releases/$TARBALL"
15 CONFIG_FILES="/etc/dropbear /etc/daemons.conf /etc/rcS.conf"
16 PROVIDE="ssh"
17 TAGS="ssh"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 local i
23 local DROPBEARS
24 DROPBEARS="dbclient scp"
25 sed -i -e 's|/usr/X11R6/bin/xauth|/usr/bin/xauth|' \
26 -e 's|/usr/libexec/sftp-server|/usr/sbin/sftp-server|' \
27 -e 's|.*MD5_HMAC.*|/*&*/|' \
28 -e 's|.*_AES128.*|/*&*/|' \
29 -e 's|.*TWOFISH128.*|/*&*/|' \
30 options.h
31 [ -d $WOK/zlib/taz ] || cook zlib
32 ln -s $WOK/zlib/taz/*/fs/usr/lib/* /usr/share/uclibc-cross-compiler-$TARGET/lib/ 2> /dev/null
33 ln -s /usr/include/z*.h /usr/share/uclibc-cross-compiler-$TARGET/include/ 2> /dev/null
34 ./configure --prefix=/usr --without-pam --host=$TARGET-pc-linux-gnu \
35 CC=uclibc-$TARGET-cc &&
36 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 &&
37 install -d -m 755 $DESTDIR/usr/sbin &&
38 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
39 chown root $DESTDIR/usr/sbin/dropbear &&
40 chgrp 0 $DESTDIR/usr/sbin/dropbear &&
41 install -d -m 755 $DESTDIR/usr/bin &&
42 for i in $DROPBEARS ssh; do
43 ln $DESTDIR/usr/sbin/dropbear $DESTDIR/usr/bin/$i
44 done
45 }
47 # Rules to gen a SliTaz package suitable for Tazpkg.
48 genpkg_rules()
49 {
50 mkdir -p $fs/usr/sbin $fs/etc/init.d $fs/etc/dropbear
51 cp -a $install/usr/bin $fs/usr
52 ln $fs/usr/bin/dbclient $fs/usr/sbin/dropbear
53 ln -s daemon $fs/etc/init.d/dropbear
54 cat > $fs/etc/dropbear/banner <<EOT
56 Secure login on Tiny SliTaz GNU/Linux powered by Dropbear.
57 EOT
59 # Fix dropbear initscript perms
60 chown -R root.root $fs
61 }
63 # Post message when installing.
64 post_install()
65 {
66 if [ "$STARTDAEMON" = "ON" ]; then
67 grep -q inetd $1/etc/rcS.conf ||
68 sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
69 grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
70 ssh stream tcp nowait root /usr/sbin/dropbear /usr/sbin/dropbear -i $DROPBEAR_OPTS
71 EOT
72 fi
73 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
74 $DSSKEY
75 EOT
76 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_rsa_host_key
77 $RSAKEY
78 EOT
79 chmod 600 $1/etc/dropbear/dropbear_*_host_key
80 }
82 config_form()
83 {
84 [ -n "$DROPBEAR_OPTS" ] || DROPBEAR_OPTS="-b /etc/dropbear/banner"
85 if [ -z "$DSSKEY" ]; then
86 dropbearkey -t dss -f /tmp/mkssh$$ > /dev/null 2>&1
87 DSSKEY="$(uuencode -m - < /tmp/mkssh$$)"
88 rm -f /tmp/mkssh$$
89 fi
90 uudecode - > /tmp/mkssh$$ <<EOT
91 $DSSKEY
92 EOT
93 DSSPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
94 rm -f /tmp/mkssh$$
95 if [ -z "$RSAKEY" ]; then
96 dropbearkey -t rsa -f /tmp/mkssh$$ > /dev/null 2>&1
97 RSAKEY="$(uuencode -m - < /tmp/mkssh$$)"
98 rm -f /tmp/mkssh$$
99 fi
100 uudecode - > /tmp/mkssh$$ <<EOT
101 $RSAKEY
102 EOT
103 RSAPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
104 rm -f /tmp/mkssh$$
105 cat <<EOT
106 <input type="checkbox" name="STARTDAEMON" value="ON" ${STARTDAEMON:+checked="checked" }/>
107 Start server during boot<br>
108 <table>
109 <tr>
110 <td>Server options</td>
111 <td><input type="text" name="DROPBEAR_OPTS" value="$DROPBEAR_OPTS" /></td>
112 </tr>
113 <tr>
114 <td>DSS key</td>
115 <td><textarea name="DSSKEY" cols="60" rows="13" wrap="off">
116 $DSSKEY
117 </textarea></td>
118 </tr>
119 <tr>
120 <td>RSA key</td>
121 <td><textarea name="RSAKEY" cols="60" rows="12" wrap="off">
122 $RSAKEY
123 </textarea></td>
124 </tr>
125 </table>
126 You can set your dropbear key
127 <pre>
128 # uuencode -m - < /etc/dropbear/dropbear_dss_host_key
129 </pre>
130 Or your ssh key
131 <pre>
132 # dropbearconvert openssh dropbear /etc/ssh/id_dsa /dev/stdout | uuencode -m -
133 </pre>
134 Default DSS public key is
135 <pre>
136 $DSSPUB
137 </pre>
138 Default RSA public key is
139 <pre>
140 $RSAPUB
141 </pre>
142 EOT
143 }