wok-next view dropbear/receipt @ rev 20075

tiny edit
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Wed Oct 25 08:30:39 2017 +0200 (2017-10-25)
parents 7ae7ca392d9e
children 0e7893ac206d
line source
1 # SliTaz package receipt v2.
3 PACKAGE="dropbear"
4 VERSION="2017.75"
5 CATEGORY="security"
6 SHORT_DESC="Lightweight SSH2 server and client"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="MIT"
9 WEB_SITE="http://matt.ucc.asn.au/dropbear/dropbear.html"
10 HOST_ARCH="i486 arm"
12 TARBALL="$PACKAGE-$VERSION.tar.bz2"
13 WGET_URL="http://matt.ucc.asn.au/dropbear/releases/$TARBALL"
15 BUILD_DEPENDS_arm=" "
16 BUILD_DEPENDS="zlib-dev pam pam-dev"
17 SPLIT="dropbear-pam"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 # Handle multiarch compilation.
23 case "$ARCH" in
24 arm)
25 CROSS_ARGS="--disable-zlib"
26 CROSS_BUGS="Fails to find zlib: -lz... no" ;;
27 esac
29 local i DROPBEARS="dropbearkey dropbearconvert dbclient scp"
30 sed -iold -e 's|/usr/.*/xauth|/usr/bin/xauth|' \
31 -e 's|ENABLE_SVR_PAM_AUTH|ENABLE_SVR_PASSWORD_AUTH|' \
32 options.h
34 ./configure \
35 --prefix=/usr \
36 --without-pam \
37 $CONFIGURE_ARGS $CROSS_ARGS &&
38 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
39 install -dm755 $install/usr/sbin &&
40 install -m755 dropbearmulti $install/usr/sbin/dropbear || exit 1
42 # No PAM support in ARM
43 case "$ARCH" in
44 arm) echo "Skipping Dropbear PAM..." ;;
45 i?86)
46 sed -i 's|ENABLE_SVR_PASSWORD_AUTH|ENABLE_SVR_PAM_AUTH|' options.h
47 ./configure \
48 --enable-pam \
49 $CONFIGURE_ARGS &&
50 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
51 install -m755 dropbearmulti $install/usr/sbin/dropbear-pam
52 ;;
53 esac
55 install -dm755 $install/usr/bin &&
56 for i in $DROPBEARS ssh; do
57 ln -s ../sbin/dropbear $install/usr/bin/$i || exit 1
58 done
60 cook_pick_manpages $src/*.1 $src/*.8
61 cook_pick_docs CHANGES INSTALL LICENSE MULTI README SMALL TODO
63 # Config file and init script.
64 mkdir -p $install/etc
65 cp -a $stuff/dropbear $install/etc
66 cp -a $stuff/init.d $install/etc
67 ln -s daemon $install/etc/init.d/sshd
68 cp -a $stuff/sshx $install/usr/bin
69 ln -s sshx $install/usr/bin/pppssh
70 ln -s sshx $install/usr/bin/sshfbvnc
71 touch $install/etc/dropbear/dropbear_dss_host_key \
72 $install/etc/dropbear/dropbear_rsa_host_key \
73 $install/etc/dropbear/dropbear_ecdsa_host_key
75 # PAM
76 cp -a $stuff/pam.d $install/etc
78 # Fix dropbear initscript perms
79 chown -R root:root $install
80 }
82 # Rules to gen a SliTaz package suitable for Tazpkg.
83 genpkg_rules() {
84 case $PACKAGE in
85 dropbear)
86 copy @std
87 rm -f $fs/usr/sbin/dropbear-pam
88 rm -r $fs/etc/pam.d/
89 DEPENDS="zlib"
90 CONFIG_FILES="/etc/dropbear"
91 SUGGESTED="sftp-server"
92 PROVIDE="ssh"
93 TAGS="ssh"
94 ;;
95 dropbear-pam)
96 copy dropbear-pam pam.d/
97 mv $fs/usr/sbin/dropbear-pam $fs/usr/sbin/dropbear
98 DEPENDS="dropbear pam"
99 CAT="security|with PAM support"
100 PROVIDE="dropbear:pam ssh:pam"
101 TAGS="ssh"
102 ;;
103 esac
104 }
106 # Post message when installing.
107 post_install_dropbear() {
108 while read dropbear openssh; do
109 [ -s "$1/$openssh" ] || 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_dss_host_key /etc/ssh/ssh_host_dsa_key
115 /etc/dropbear/dropbear_ecdsa_host_key /etc/ssh/ssh_host_ecdsa_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 cat <<EOT
123 .-------------------------------------------------.
124 | To start dropbear server you can run: |
125 | |
126 | /etc/init.d/dropbear start |
127 | Or add dropbear to RUN_DAEMONS in /etc/rcS.conf |
128 '-------------------------------------------------'
129 EOT
130 }
132 post_remove_dropbear() {
133 grep -q dropbear "$1/etc/inetd.conf" &&
134 sed -i '/dropbear/d' "$1/etc/inetd.conf"
135 }
137 post_remove_dropbear_pam() {
138 tazpkg -gi dropbear --forced
139 }