wok-current view busybox-boot/receipt @ rev 13896

busybox-boot: clean /dev (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 18 18:46:22 2013 +0100 (2013-01-18)
parents a0759293a0ca
children 579492e43b93
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox-boot"
4 VERSION="1.20.2"
5 CATEGORY="base-system"
6 SHORT_DESC="Many common UNIX utilities for core-5in1/boot flavor."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 DEPENDS="linux syslinux"
9 WANTED="busybox"
10 WEB_SITE="http://www.busybox.net/"
11 CONFIG_FILES=""
13 # Rules to gen a SliTaz package suitable for Tazpkg.
14 genpkg_rules()
15 {
16 jslinux=false
17 mkdir $fs/bin $fs/dev
18 cp -a $src/busybox-static $fs/bin/busybox
19 mknod -m 660 $fs/dev/console c 5 1
20 mknod -m 771 $fs/dev/null c 1 3
21 mknod -m 660 $fs/dev/tty c 5 0
22 mknod -m 660 $fs/dev/tty1 c 4 1
23 if $jslinux; then
24 mknod -m 644 $fs/dev/clipboard c 10 231
25 mknod -m 660 $fs/dev/ttyS0 c 4 64
26 fi
27 cat > $fs/init <<EOT
28 #!/bin/busybox sh
30 for i in \$(busybox --list) ; do busybox ln /bin/busybox /bin/\$i; done
32 export PATH=/bin
33 export HOME=/
34 export TERM=vt100
36 mkdir /tmp /mnt /proc
37 mount -t proc none /proc
38 while read name major minor ; do
39 for i in '' 1 2 3 4 5 6 7 8 9 ; do
40 mknod -m 644 /dev/\$name\$i b \$major \$((\$i + \$minor))
41 done
42 done <<EOM
43 loop 7 0
44 hda 3 0
45 hdb 3 64
46 sda 8 0
47 sdb 8 16
48 EOM
50 arg()
51 {
52 grep -q \$1= /proc/cmdline && root="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" </proc/cmdline)"
53 }
55 arg mount && mount \$root /mnt
56 arg loopfs && losetup /dev/loop /mnt/\$root && mount /dev/loop /mnt
57 arg subroot && cp /bin/busybox /mnt/\$root/dev/shm &&
58 exec switch_root mnt \$root/dev/shm/busybox chroot \$root /sbin/init
59 arg loopfs && exec switch_root mnt /sbin/init
61 [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb
62 while read type dir ; do
63 grep -qs \$type /proc/filesystems &&
64 mkdir \$dir && mount -t \$type none \$dir
65 done <<EOM
66 sysfs /sys
67 devpts /dev/pts
68 EOM
70 TTY=\$(tty 2>/dev/null)
71 TTY=\${TTY:-/dev/tty1}
72 EOT
73 $jslinux && echo 'stty -F $TTY rows 30 2>/dev/null' >> $fs/init
74 cat >> $fs/init <<EOT
76 busybox | sed '/Current/,\$!d'
77 while true; do
78 if [ -x /bin/setsid ]; then
79 setsid sh -c "exec sh <\$TTY >\$TTY 2>&1"
80 else
81 sh <\$TTY >\$TTY 2>&1
82 fi
83 done
84 EOT
85 chmod +x $fs/init
86 }
88 pre_install()
89 {
90 rm -rf $1/bin $1/dev
91 }
93 post_install()
94 {
95 rm -rf $1/lib $1/var $1/sbin $1/home $1/root $1/media
96 }