wok-6.x view busybox-boot/receipt @ rev 19995
busybox: back to 1.26.2 ('. receipt' is broken)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Jul 22 12:34:30 2017 +0200 (2017-07-22) |
parents | 82be380ad907 |
children | 08bb2369e4d6 |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox-boot"
4 VERSION="1.26.2"
5 CATEGORY="base-system"
6 SHORT_DESC="Many common UNIX utilities for core-5in1/boot flavor."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="http://www.busybox.net/"
10 CONFIG_FILES=""
12 WANTED="busybox"
13 DEPENDS="linux syslinux"
15 # Rules to gen a SliTaz package suitable for Tazpkg.
16 genpkg_rules()
17 {
18 mkdir -p $fs/usr/share/boot/bin $fs/usr/share/boot/dev
19 jslinux=false
20 CHOICE=static
21 for i in uclibc musl diet ; do
22 [ -x $src/busybox-$i ] || continue
23 [ -x $src/busybox-$CHOICE ] &&
24 [ $(stat -c %s $src/busybox-$i) -ge \
25 $(stat -c %s $src/busybox-$CHOICE) ] &&
26 continue
27 CHOICE=$i
28 done
29 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/bin/busybox
30 chmod 4755 $fs/usr/share/boot/bin/busybox
31 mknod -m 660 $fs/usr/share/boot/dev/console c 5 1
32 mknod -m 771 $fs/usr/share/boot/dev/null c 1 3
33 mknod -m 660 $fs/usr/share/boot/dev/tty c 5 0
34 mknod -m 660 $fs/usr/share/boot/dev/tty1 c 4 1
35 if $jslinux; then
36 mknod -m 644 $fs/usr/share/boot/dev/clipboard c 10 231
37 mknod -m 660 $fs/usr/share/boot/dev/ttyS0 c 4 64
38 fi
39 cat > $fs/usr/share/boot/init <<EOT
40 #!/bin/busybox sh
42 export PATH=/bin
43 export HOME=/
44 export TERM=vt100
46 if [ -d /etc ]; then
47 [ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf
48 for i in \$dns ; do echo nameserver \$i; done >> /etc/resolv.conf
49 [ -n "\$broadcast" ] && BROADCAST="broadcast \$broadcast"
50 [ -n "\$subnet" ] && NETMASK="netmask \$subnet"
51 if ifconfig \$interface \${ip:-0.0.0.0} \$BROADCAST \$NETMASK ; then
52 while route del default gw 0.0.0.0 dev \$interface ; do : ; done
53 for i in \$router ; do route add default gw \$i dev \$interface; done
54 fi
55 exit
56 fi
58 mkdir /tmp /mnt /proc /etc
59 mount -t proc none /proc
60 mount -t devtmpfs none /dev
62 arg()
63 {
64 root="\$(sed "s/^/ /;s/\$/ /;/ \$1=/!d;s/.* \$1=\\([^ ]*\\).*/\\1/" </proc/cmdline)"
65 [ -n "\$root" ]
66 }
68 arg init
69 init=\${root:-/sbin/init}
70 [ -n "\$(sed 's/\$/ /;s/^/ /;/ ro /!d' /proc/cmdline)" ] && ro="-o ro"
71 [ -n "\$(sed 's/\$/ /;s/^/ /;/ rw /!d' /proc/cmdline)" ] && ro="-o rw"
72 arg root && root="\$(echo \$root | sed 's|/|\\\\/|g')" &&
73 root="\$(blkid | sed "s/\"//g;/\$root/!d;s/:.*//;q")" &&
74 [ -n "\$root" ] && mount \$ro \$root /mnt
75 arg loopfs && losetup /dev/loop0 /mnt/\$root && mount /dev/loop0 /mnt
76 arg subroot && cp /bin/busybox /mnt/\$root/dev/shm &&
77 chroot="\$root/dev/shm/busybox chroot \$root"
78 [ -x /mnt/\$root/\$init ] && umount /dev && umount /proc && exec switch_root mnt \$chroot \$init
80 [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb
81 while read type dir ; do
82 grep -qs \$type /proc/filesystems || continue
83 [ -d "\$dir" ] || mkdir \$dir
84 mount -t \$type none \$dir
85 done <<EOM
86 sysfs /sys
87 devpts /dev/pts
88 EOM
90 TTY=\$(tty 2>/dev/null)
91 TTY=\${TTY:-/dev/tty1}
92 EOT
93 $jslinux && echo 'stty -F $TTY rows 30 2>/dev/null' >> $fs/usr/share/boot/init
94 cat >> $fs/usr/share/boot/init <<EOT
96 udhcpc -b -s /init
97 while true; do
98 busybox | sed '/Current/,\$!d'
99 setsid sh -c "exec sh <\$TTY >\$TTY 2>&1"
100 done
101 EOT
102 chmod +x $fs/usr/share/boot/init
103 ( cd $fs/usr/share/boot ; find bin dev init | cpio -o -H newc > initrd )
104 rm -rf $fs/usr/share/boot/bin $fs/usr/share/boot/dev $fs/usr/share/boot/init
105 }