wok-next view busybox/receipt @ rev 20486

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