wok-6.x view dropbear/receipt @ rev 24072

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 07 17:56:16 2021 +0000 (2021-07-07)
parents a8546de77bcc
children 3b19fa0b9a88
line source
1 # SliTaz package receipt.
3 PACKAGE="dropbear"
4 VERSION="2020.81"
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://matt.ucc.asn.au/dropbear/dropbear.html"
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 current_version()
31 {
32 wget -O - $WEB_SITE 2>/dev/null | \
33 sed "/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|;q"
34 }
36 # Rules to configure and make the package.
37 compile_rules()
38 {
39 local i
40 local DROPBEARS
41 DROPBEARS="dropbearkey dropbearconvert dbclient scp"
42 cat > localoptions.h <<EOT
43 #define SFTPSERVER_PATH "/usr/sbin/sftp-server"
44 #define DROPBEAR_X11FWD 1
45 EOT
46 sed -i 's|shell arch|shell uname -m|' libtommath/makefile_include.mk
47 ./configure --prefix=/usr --without-pam $CONFIGURE_ARGS $CROSS_ARGS &&
48 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
49 install -d -m 755 $DESTDIR/usr/sbin &&
50 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
51 chown 0.0 $DESTDIR/usr/sbin/dropbear || exit 1
53 # No pam support in ARM
54 case "$ARCH" in
55 arm) echo "Skipping Dropbear PAM..." ;;
56 i?86)
57 cat >> localoptions.h <<EOT
58 #define DROPBEAR_SVR_PASSWORD_AUTH 0
59 #define DROPBEAR_SVR_PAM_AUTH 1
60 EOT
61 ./configure --prefix=/usr --enable-pam $CONFIGURE_ARGS &&
62 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
63 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear-pam &&
64 chown 0.0 $DESTDIR/usr/sbin/dropbear-pam || exit 1 ;;
65 esac
67 install -d -m 755 $DESTDIR/usr/bin &&
68 for i in $DROPBEARS ssh; do
69 ln -s ../sbin/dropbear $DESTDIR/usr/bin/$i || exit 1
70 done
71 install -d -m 755 $DESTDIR/usr/share/man/man1 &&
72 install -m 644 $src/*.1 $DESTDIR/usr/share/man/man1 &&
73 install -d -m 755 $DESTDIR/usr/share/man/man8 &&
74 install -m 644 $src/*.8 $DESTDIR/usr/share/man/man8 &&
75 install -d -m 755 $DESTDIR/usr/share/doc &&
76 install -m 644 $src/[A-Z][A-Z]* $DESTDIR/usr/share/doc
77 }
79 # Rules to gen a SliTaz package suitable for Tazpkg.
80 genpkg_rules()
81 {
82 mkdir -p $fs/usr
83 cp -a $install/usr/bin $fs/usr
84 cp -a $install/usr/sbin $fs/usr
85 rm -f $fs/usr/sbin/dropbear-pam
86 # Config file and init script.
87 mkdir -p $fs/etc
88 cp -a $stuff/dropbear $fs/etc
89 cp -a $stuff/init.d $fs/etc
90 ln -s daemon $fs/etc/init.d/sshd
91 cp -a $stuff/sshx $fs/usr/bin
92 ln -s sshx $fs/usr/bin/pppssh
93 ln -s sshx $fs/usr/bin/sshfbvnc
94 touch $fs/etc/dropbear/dropbear_dss_host_key \
95 $fs/etc/dropbear/dropbear_rsa_host_key \
96 $fs/etc/dropbear/dropbear_ecdsa_host_key \
97 $fs/etc/dropbear/dropbear_ed25519_host_key
99 # Fix dropbear initscript perms
100 chown -R root.root $fs
101 }
103 # Post message when installing.
104 post_install()
105 {
106 while read dropbear openssh ; do
107 [ -s "$1/$openssh" ] || continue
108 [ -s "$1/$dropbear" ] && continue
109 chroot "$1/" dropbearconvert openssh dropbear $openssh $dropbear
110 chroot "$1/" dropbearkey -y -f $dropbear | grep Fingerprint
111 done <<EOT
112 /etc/dropbear/dropbear_rsa_host_key /etc/ssh/ssh_host_rsa_key
113 /etc/dropbear/dropbear_dss_host_key /etc/ssh/ssh_host_dsa_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 }