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