wok-tiny view dropbear-without-zlib/receipt @ rev 126

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