rev |
line source |
pascal@13591
|
1 # SliTaz package receipt.
|
pascal@13591
|
2
|
pascal@13591
|
3 PACKAGE="busybox-boot"
|
pascal@13905
|
4 VERSION="1.21.0"
|
pascal@13591
|
5 CATEGORY="base-system"
|
pascal@13591
|
6 SHORT_DESC="Many common UNIX utilities for core-5in1/boot flavor."
|
pascal@13591
|
7 MAINTAINER="pascal.bellard@slitaz.org"
|
pascal@14657
|
8 LICENSE="GPL2"
|
pascal@13591
|
9 DEPENDS="linux syslinux"
|
pascal@13591
|
10 WANTED="busybox"
|
pascal@13591
|
11 WEB_SITE="http://www.busybox.net/"
|
pascal@13591
|
12 CONFIG_FILES=""
|
pascal@13591
|
13
|
pascal@13591
|
14 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pascal@13591
|
15 genpkg_rules()
|
pascal@13591
|
16 {
|
pascal@13591
|
17 jslinux=false
|
pascal@14751
|
18 mkdir $fs/usr/share/boot/bin $fs/usr/share/boot/dev
|
pascal@14750
|
19 CHOICE=static
|
pascal@14750
|
20 for i in uclibc musl diet ; do
|
pascal@14750
|
21 [ -x $src/busybox-$i ] || continue
|
pascal@14750
|
22 [ $(stat -c %s $src/busybox-$i) -lt \
|
pascal@14750
|
23 $(stat -c %s $src/busybox-$CHOICE) ] &&
|
pascal@14750
|
24 CHOICE=$i
|
pascal@14750
|
25 done
|
pascal@14751
|
26 cp -a $src/busybox-$CHOICE $fs/usr/share/boot/bin/busybox
|
pascal@14751
|
27 chmod 4755 $fs/usr/share/boot/bin/busybox
|
pascal@14751
|
28 mknod -m 660 $fs/usr/share/boot/dev/console c 5 1
|
pascal@14751
|
29 mknod -m 771 $fs/usr/share/boot/dev/null c 1 3
|
pascal@14751
|
30 mknod -m 660 $fs/usr/share/boot/dev/tty c 5 0
|
pascal@14751
|
31 mknod -m 660 $fs/usr/share/boot/dev/tty1 c 4 1
|
pascal@13591
|
32 if $jslinux; then
|
pascal@14751
|
33 mknod -m 644 $fs/usr/share/boot/dev/clipboard c 10 231
|
pascal@14751
|
34 mknod -m 660 $fs/usr/share/boot/dev/ttyS0 c 4 64
|
pascal@13591
|
35 fi
|
pascal@14751
|
36 cat > $fs/usr/share/boot/init <<EOT
|
pascal@13591
|
37 #!/bin/busybox sh
|
pascal@13591
|
38
|
pascal@13591
|
39 for i in \$(busybox --list) ; do busybox ln /bin/busybox /bin/\$i; done
|
pascal@13591
|
40
|
pascal@13591
|
41 export PATH=/bin
|
pascal@13591
|
42 export HOME=/
|
pascal@13591
|
43 export TERM=vt100
|
pascal@13591
|
44
|
pascal@13896
|
45 mkdir /tmp /mnt /proc
|
pascal@13591
|
46 mount -t proc none /proc
|
pascal@13895
|
47 while read name major minor ; do
|
pascal@13895
|
48 for i in '' 1 2 3 4 5 6 7 8 9 ; do
|
pascal@13895
|
49 mknod -m 644 /dev/\$name\$i b \$major \$((\$i + \$minor))
|
pascal@13895
|
50 done
|
pascal@13895
|
51 done <<EOM
|
pascal@13895
|
52 loop 7 0
|
pascal@13895
|
53 hda 3 0
|
pascal@13895
|
54 hdb 3 64
|
pascal@13895
|
55 sda 8 0
|
pascal@13895
|
56 sdb 8 16
|
pascal@13895
|
57 EOM
|
pascal@13879
|
58
|
pascal@13879
|
59 arg()
|
pascal@13879
|
60 {
|
pascal@13882
|
61 grep -q \$1= /proc/cmdline && root="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" </proc/cmdline)"
|
pascal@13879
|
62 }
|
pascal@13879
|
63
|
pascal@13882
|
64 arg mount && mount \$root /mnt
|
pascal@13895
|
65 arg loopfs && losetup /dev/loop /mnt/\$root && mount /dev/loop /mnt
|
pascal@13882
|
66 arg subroot && cp /bin/busybox /mnt/\$root/dev/shm &&
|
pascal@13882
|
67 exec switch_root mnt \$root/dev/shm/busybox chroot \$root /sbin/init
|
pascal@13883
|
68 arg loopfs && exec switch_root mnt /sbin/init
|
pascal@13879
|
69
|
pascal@13591
|
70 [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb
|
pascal@13895
|
71 while read type dir ; do
|
pascal@13895
|
72 grep -qs \$type /proc/filesystems &&
|
pascal@13895
|
73 mkdir \$dir && mount -t \$type none \$dir
|
pascal@13895
|
74 done <<EOM
|
pascal@13895
|
75 sysfs /sys
|
pascal@13895
|
76 devpts /dev/pts
|
pascal@13895
|
77 EOM
|
pascal@13591
|
78
|
pascal@13591
|
79 TTY=\$(tty 2>/dev/null)
|
pascal@13591
|
80 TTY=\${TTY:-/dev/tty1}
|
pascal@13591
|
81 EOT
|
pascal@13895
|
82 $jslinux && echo 'stty -F $TTY rows 30 2>/dev/null' >> $fs/init
|
pascal@13591
|
83 cat >> $fs/init <<EOT
|
pascal@13591
|
84
|
pascal@13591
|
85 busybox | sed '/Current/,\$!d'
|
pascal@13591
|
86 while true; do
|
pascal@13591
|
87 if [ -x /bin/setsid ]; then
|
pascal@13591
|
88 setsid sh -c "exec sh <\$TTY >\$TTY 2>&1"
|
pascal@13591
|
89 else
|
pascal@13591
|
90 sh <\$TTY >\$TTY 2>&1
|
pascal@13591
|
91 fi
|
pascal@13591
|
92 done
|
pascal@13591
|
93 EOT
|
pascal@14751
|
94 chmod +x $fs/usr/share/boot/init
|
pascal@14751
|
95 ( cd $fs/usr/share/boot ; find bin dev init | cpio -o -H newc ) > initrd
|
pascal@14751
|
96 rm -rf $fs/usr/share/boot/bin $fs/usr/share/boot/dev $fs/usr/share/boot/init
|
pascal@13591
|
97 }
|