wok view dropbear/receipt @ rev 25507
plop: cleanup
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Feb 11 10:36:59 2023 +0000 (21 months ago) |
parents | 00bff3684d8a |
children | 0262035dc1e7 |
line source
1 # SliTaz package receipt.
3 PACKAGE="dropbear"
4 VERSION="2022.83"
5 CATEGORY="security"
6 SHORT_DESC="Lightweight SSH2 server and client"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="MIT"
9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
10 WEB_SITE="https://github.com/mkj/dropbear"
11 WGET_URL="https://matt.ucc.asn.au/dropbear/releases/$TARBALL"
12 CONFIG_FILES="/etc/dropbear/banner"
13 SECRET_FILES="/etc/dropbear/*key"
14 SUGGESTED="sftp-server"
15 PROVIDE="ssh"
16 TAGS="ssh"
17 HOST_ARCH="i486 arm"
19 DEPENDS="zlib"
20 BUILD_DEPENDS="zlib-dev pam pam-dev"
22 # Handle multiarch compilation.
23 case "$ARCH" in
24 arm)
25 BUILD_DEPENDS=""
26 CROSS_ARGS="--disable-zlib"
27 CROSS_BUGS="Fails to find zlib: -lz... no" ;;
28 esac
30 # What is the latest version available today?
31 current_version()
32 {
33 wget -O - $WEB_SITE 2>/dev/null | \
34 sed "/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|;q"
35 }
37 # Rules to configure and make the package.
38 compile_rules()
39 {
40 local i
41 local DROPBEARS
42 DROPBEARS="dropbearkey dropbearconvert dbclient scp"
43 cat > localoptions.h <<EOT
44 #define SFTPSERVER_PATH "/usr/sbin/sftp-server"
45 #define DROPBEAR_X11FWD 1
46 EOT
47 sed -i 's|DROPBEAR_CHANNEL_PRIO_INTERACTIVE|DROPBEAR_PRIO_LOWDELAY|' svr-x11fwd.c
48 sed -i 's|shell arch|shell uname -m|' libtommath/makefile_include.mk
49 ./configure --prefix=/usr --without-pam $CONFIGURE_ARGS $CROSS_ARGS &&
50 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
51 install -d -m 755 $DESTDIR/usr/sbin &&
52 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
53 chown 0.0 $DESTDIR/usr/sbin/dropbear || exit 1
55 # No pam support in ARM
56 case "$ARCH" in
57 arm) echo "Skipping Dropbear PAM..." ;;
58 i?86)
59 cat >> localoptions.h <<EOT
60 #define DROPBEAR_SVR_PASSWORD_AUTH 0
61 #define DROPBEAR_SVR_PAM_AUTH 1
62 EOT
63 ./configure --prefix=/usr --enable-pam $CONFIGURE_ARGS &&
64 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
65 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear-pam &&
66 chown 0.0 $DESTDIR/usr/sbin/dropbear-pam || exit 1 ;;
67 esac
69 install -d -m 755 $DESTDIR/usr/bin &&
70 for i in $DROPBEARS ssh; do
71 ln -s ../sbin/dropbear $DESTDIR/usr/bin/$i || exit 1
72 done
73 install -d -m 755 $DESTDIR/usr/share/man/man1 &&
74 install -m 644 $src/*.1 $DESTDIR/usr/share/man/man1 &&
75 install -d -m 755 $DESTDIR/usr/share/man/man8 &&
76 install -m 644 $src/*.8 $DESTDIR/usr/share/man/man8 &&
77 install -d -m 755 $DESTDIR/usr/share/doc &&
78 install -m 644 $src/[A-Z][A-Z]* $DESTDIR/usr/share/doc
79 }
81 # Rules to gen a SliTaz package suitable for Tazpkg.
82 genpkg_rules()
83 {
84 mkdir -p $fs/usr
85 cp -a $install/usr/bin $fs/usr
86 cp -a $install/usr/sbin $fs/usr
87 rm -f $fs/usr/sbin/dropbear-pam
88 # Config file and init script.
89 mkdir -p $fs/etc
90 cp -a $stuff/dropbear $fs/etc
91 cp -a $stuff/init.d $fs/etc
92 ln -s daemon $fs/etc/init.d/sshd
93 cp -a $stuff/sshx $fs/usr/bin
94 ln -s sshx $fs/usr/bin/pppssh
95 ln -s sshx $fs/usr/bin/sshfbvnc
96 touch $fs/etc/dropbear/dropbear_rsa_host_key \
97 $fs/etc/dropbear/dropbear_ecdsa_host_key \
98 $fs/etc/dropbear/dropbear_ed25519_host_key
100 # Fix dropbear initscript perms
101 chown -R root.root $fs
102 }
104 # Post message when installing.
105 post_install()
106 {
107 while read dropbear openssh ; do
108 [ -s "$1/$openssh" ] || continue
109 [ -s "$1/$dropbear" ] && continue
110 chroot "$1/" dropbearconvert openssh dropbear $openssh $dropbear
111 chroot "$1/" dropbearkey -y -f $dropbear | grep Fingerprint
112 done <<EOT
113 /etc/dropbear/dropbear_rsa_host_key /etc/ssh/ssh_host_rsa_key
114 /etc/dropbear/dropbear_ecdsa_host_key /etc/ssh/ssh_host_ecdsa_key
115 /etc/dropbear/dropbear_ed25519_host_key /etc/ssh/ssh_host_ed25519_key
116 EOT
117 grep -q ssh "$1/etc/inetd.conf" || cat >> "$1/etc/inetd.conf" <<EOT
118 #ssh stream tcp nowait root dropbear dropbear -i -b /etc/dropbear/banner
119 EOT
120 [ -n "$quiet" ] && return
121 echo -e "\nTo starts $PACKAGE server you can run :\n"
122 echo "/etc/init.d/$PACKAGE start"
123 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
124 }
126 post_remove()
127 {
128 grep -q dropbear "$1/etc/inetd.conf" && sed -i '/dropbear/d' "$1/etc/inetd.conf"
129 }