wok-next view busybox/receipt @ rev 21493

updated aria2 (1.34.0 -> 1.35.0)
author Hans-G?nter Theisgen
date Thu Jun 18 21:19:09 2020 +0100 (2020-06-18)
parents b19ddba309f9
children 36705bc9f341
line source
1 # SliTaz package receipt v2.
3 PACKAGE="busybox"
4 VERSION="1.27.2"
5 CATEGORY="base-system"
6 SHORT_DESC="Tiny versions of UNIX utilities"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://busybox.net/"
11 TARBALL="$PACKAGE-$VERSION.tar.bz2"
12 WGET_URL="${WEB_SITE}downloads/$TARBALL"
14 BUILD_DEPENDS="patch bzip2 gettext-dev perl pam-dev libtirpc-dev" # uclibc-cross-compiler-i486 musl-libc-dev dietlibc
15 case "$ARCH" in
16 x86_64) SPLIT="$PACKAGE-pam:pam";;
17 *) SPLIT="$PACKAGE-pam:pam ssfs-busybox:ssfs" # $PACKAGE-boot:boot $PACKAGE-static:static
18 ;;
19 esac
21 compile_rules() {
22 export CPPFLAGS="$CPPFLAGS $(pkg-config --cflags libtirpc)"
23 case "$SET" in
24 '')
25 cp $stuff/.config $src
26 make oldconfig &&
27 make &&
28 make install || return 1
29 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
30 $src/_install/bin/busybox
32 # Making translations
33 make -C $stuff/po install
35 cook_pick_manpages $src/docs/busybox.1
36 cook_pick_docs \
37 $src/docs/*.txt \
38 $src/docs/*.htm* \
39 $src/docs/cgi
41 cp -a $src/_install/* $install; rm -rf $src/_install
43 [ -e $install/sbin/ip ] && ln -s busybox $install/bin/ip
44 rm -f $install/bin/bbconfig $install/usr/bin/ar
45 mkdir -p \
46 $install/etc/init.d \
47 $install/var/spool/cron/crontabs \
48 $install/var/spool/lpd \
49 $install/var/lib/misc \
50 $install/etc/modprobe.d \
51 $install/usr/share/udhcpc
53 # Busybox config files
54 cp -a $stuff/etc/* $install/etc
55 chown -R 0.0 $install/etc
56 chmod 600 $install/etc/busybox.conf
58 # Daemon scripts
59 cp $stuff/daemon $install/etc/init.d
60 for i in crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd \
61 telnetd tftpd udhcpd zcip; do
62 grep -qi "config_$i=y" $stuff/.config &&
63 ln -s daemon $install/etc/init.d/$i
64 done
65 rm $install/linuxrc
67 # Udhcpc stuff
68 install -m755 $stuff/udhcp.script $install/usr/share/udhcpc/default.script
70 # Httpd stuff (httphelper.sh found in slitaz-base-files package)
71 ln -s /usr/lib/slitaz/httphelper.sh $install/usr/bin/httpd_helper.sh
72 cp -r $stuff/www $install/var
74 # Update copyright year
75 grep -rl 'YEAR' $install/var/www | xargs sed -i "s|YEAR|$(date +%Y)|"
76 ;;
78 pam)
79 sed 's|# CONFIG_PAM is not set|CONFIG_PAM=y|' $stuff/.config > $src/.config
80 make oldconfig &&
81 make || return 1
82 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
84 # mv docs/busybox.1 docs/busybox.pam.1
85 mkdir -p \
86 $install/bin/ \
87 $install/etc/pam.d/
88 cp -a $src/busybox $install/bin
89 cp $stuff/login $install/etc/pam.d/
90 ;;
92 ssfs)
93 # WARNING! This branch not tested yet!
94 #
95 rootfs="$src/ssfs-busybox/usr/share/ssfs/rootfs"
96 mkdir -p $rootfs/etc
97 cp $stuff/.config-ssfs $src/.config
98 make oldconfig &&
99 make busybox &&
100 make CONFIG_PREFIX=$rootfs install || return 1
101 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
102 chown -R 0.0 $rootfs/etc
103 chmod 0600 $rootfs/etc/busybox.conf
104 chmod 4755 $rootfs/bin/busybox
105 ;;
107 static)
108 # WARNING! This branch not tested yet!
109 #
110 # prepare busybox-static package
111 if [ -n "$(/usr/bin/uclibc-i486-gcc --version 2>/dev/null)" ]; then
112 echo 'Making busybox-uclibc'
113 cp $stuff/.config-static $src/.config
114 sed -i 's|# CONFIG_ASH_INTERNAL_GLOB is not set|CONFIG_ASH_INTERNAL_GLOB=y|' $src/.config
115 make oldconfig &&
116 make || return 1
117 cp busybox busybox-static
118 mv busybox busybox-uclibc
119 mv -f docs/busybox.1 docs/busybox.static.1
120 fi
122 if [ -x '/usr/bin/musl-gcc' ]; then
123 echo 'Making busybox-musl'
124 # prepare busybox-musl package
125 cp $stuff/.config-static $src/.config
126 sed -i 's|uclibc-i486-||' $src/.config
127 make oldconfig &&
128 make CC=musl-gcc || return 1
129 mv busybox busybox-musl
130 mv -f docs/busybox.1 docs/busybox.static.1
131 fi
133 if [ -x '/usr/lib/diet/bin/diet' ]; then
134 echo 'Making busybox-diet'
135 # prepare busybox-diet package
136 cp $stuff/.config-static $src/.config
137 sed -i 's|uclibc-i486-||;
138 s|CFLAGS="|&-D_BSD_SOURCE |;
139 s|LDFLAGS="|&-Wl,--allow-multiple-definition |;
140 s|LDLIBS="|&compat tirpc |' $src/.config
141 make oldconfig &&
142 make CC="/usr/lib/diet/bin/diet gcc" || return 1
143 mv busybox busybox-diet
144 mv -f docs/busybox.1 docs/busybox.static.1
145 fi
146 ;;
147 esac
148 }
150 # Cross compilation check.
151 testsuite() {
152 readelf -h $WOK/busybox/install/bin/busybox
153 }
155 genpkg_rules() {
156 case $PACKAGE in
157 busybox)
158 copy @std *.mo
159 DEPENDS="slitaz-base-files glibc-base ncurses libtirpc"
160 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
161 /etc/resolv.conf /etc/httpd.conf"
162 ;;
163 busybox-pam)
164 copy @std
165 CAT="base-system|with PAM support"
166 DEPENDS="busybox libtirpc pam"
167 CONFIG_FILES="/etc/pam.d"
168 PROVIDE="busybox:pam"
169 ;;
170 ssfs-busybox)
171 # NOTE: We install files in Ssfs data directory to always have ready
172 # to create chroot on the server and provide an easy way to update
173 # the vdisk. We don't do a static build, we need some shared lib in
174 # the chroot anyway. Busybox is configured to not use /usr and with
175 # a minimal set of applets.
177 CAT="base-system|for Ssfs virtual disk minimal chroot"
178 rootfs=$fs/usr/share/ssfs/rootfs
179 cp -a $src/ssfs-busybox/* $fs
180 ;;
181 busybox-boot)
182 jslinux=false
183 CAT="base-system|for core-5in1/boot flavor"
184 DEPENDS="linux syslinux"
185 mkdir -p \
186 $fs/usr/share/boot/bin \
187 $fs/usr/share/boot/dev
189 CHOICE='static'
190 for i in uclibc musl diet; do
191 [ -x "$src/busybox-$i" ] || continue
192 [ -x "$src/busybox-$CHOICE" ] &&
193 [ $(stat -c %s $src/busybox-$i) -ge \
194 $(stat -c %s $src/busybox-$CHOICE) ] &&
195 continue
196 CHOICE="$i"
197 done
198 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/bin/busybox
200 chmod 4755 $fs/usr/share/boot/bin/busybox
201 mknod -m 660 $fs/usr/share/boot/dev/console c 5 1
202 mknod -m 771 $fs/usr/share/boot/dev/null c 1 3
203 mknod -m 660 $fs/usr/share/boot/dev/tty c 5 0
204 mknod -m 660 $fs/usr/share/boot/dev/tty1 c 4 1
205 if $jslinux; then
206 mknod -m 644 $fs/usr/share/boot/dev/clipboard c 10 231
207 mknod -m 660 $fs/usr/share/boot/dev/ttyS0 c 4 64
208 fi
210 cp $stuff/init $fs/usr/share/boot/init
211 $jslinux || sed -i '/jslinux/d' $fs/usr/share/boot/init
212 chmod +x $fs/usr/share/boot/init
214 ( cd $fs/usr/share/boot; find bin dev init | cpio -o -H newc > initrd )
215 rm -rf \
216 $fs/usr/share/boot/bin \
217 $fs/usr/share/boot/dev \
218 $fs/usr/share/boot/init
219 ;;
220 busybox-static)
221 CAT="base-system|static version"
222 DEPENDS=" "
223 mkdir -p $fs/usr/share/boot
225 CHOICE='static'
226 for i in uclibc musl diet; do
227 [ -x "$src/busybox-$i" ] || continue
228 [ -x "$src/busybox-$CHOICE" ] &&
229 [ $(stat -c %s $src/busybox-$i) -ge \
230 $(stat -c %s $src/busybox-$CHOICE) ] &&
231 continue
232 CHOICE="$i"
233 done
234 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/busybox-static
235 ;;
236 esac
237 }
239 # GNU utils stuff.
240 pre_install_busybox() {
241 local i
242 [ -s $1/etc/resolv.conf ] &&
243 cp -a $1/etc/resolv.conf $1/etc/resolv.conf-busybox-install
244 answer=''
245 for i in $(sed '/busybox$/d; /bin\//!d' "$1$INSTALLED/$PACKAGE/files.list"); do
246 [ -f "$1$i" ] || continue
247 if [ -z "$answer" ]; then
248 echo
249 confirm 'Keep installed GNU utilities?' y || break
250 answer='Y'
251 fi
252 cp -a "$1$i" "$1$i-busybox-install"
253 done
254 }
256 post_install_busybox() {
257 local i
258 [ -f $1/etc/resolv.conf-busybox-install ] &&
259 mv -f $1/etc/resolv.conf-busybox-install $1/etc/resolv.conf
260 for i in $($1/bin/busybox --list-full); do
261 [ -f "$1/$i-busybox-install" ] || continue
262 mv "$1/$i-busybox-install" "$1/$i"
263 done
264 chmod 4755 "$1/bin/busybox"
266 touch "$1/etc/daemons.conf"
267 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
268 if ! grep -q ^DNSD_OPTIONS "$1/etc/daemons.conf"; then
269 cat >> "$1/etc/daemons.conf" <<EOF
270 # Domain name server options.
271 DNSD_OPTIONS="-d"
273 EOF
274 fi
275 if ! grep -q ^TFTPD_OPTIONS $1/etc/daemons.conf; then
276 cat >> "$1/etc/daemons.conf" <<EOF
277 # Tftp daemon options.
278 TFTPD_OPTIONS="-r /boot"
280 EOF
281 fi
282 }
284 # We can't remove this package!
285 pre_remove_busybox() {
286 return 1
287 }
289 pre_remove_busybox_pam() {
290 # We install non-pam busybox to replace busybox-pam.
291 tazpkg get-install busybox --forced
293 # We remove /bin/busybox from the file.list of busybox-pam.
294 # This way, the non-pam busybox we just installed will not be
295 # removed.
296 sed '/\/bin\/busybox/d' \
297 -i /var/lib/tazpkg/installed/busybox-pam/files.list
298 }
300 post_install_busybox_pam() {
301 chmod 4755 "$1/bin/busybox"
302 }
304 post_install_busybox_static() {
305 chmod 4755 "$1/usr/share/boot/busybox-static"
306 }