wok annotate busybox-boot/receipt @ rev 13882
busybox-boot: add mount=, loopfs= & subroot= cmdline args (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Jan 17 15:57:34 2013 +0100 (2013-01-17) |
parents | ac41646beaa9 |
children | bafb0ebb3fde |
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@13879 | 17 mkdir -p $fs/bin $fs/sbin $fs/dev/pts $fs/proc $fs/sys $fs/tmp $fs/mnt |
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@13879 | 22 mknod -m 660 $fs/dev/loop0 b 7 0 |
pascal@13879 | 23 mknod -m 660 $fs/dev/loop1 b 7 1 |
pascal@13879 | 24 while read name major minor ; do |
pascal@13879 | 25 for i in '' 1 2 3 4 5 6 7 8 9 ; do |
pascal@13879 | 26 mknod -m 644 $fs/dev/$name$i b $major $(($i + $minor)) |
pascal@13879 | 27 done |
pascal@13879 | 28 done <<EOT |
pascal@13879 | 29 hda 3 0 |
pascal@13879 | 30 hdb 3 64 |
pascal@13879 | 31 sda 8 0 |
pascal@13879 | 32 sdb 8 16 |
pascal@13879 | 33 EOT |
pascal@13591 | 34 if $jslinux; then |
pascal@13591 | 35 mknod -m 644 $fs/dev/clipboard c 10 231 |
pascal@13591 | 36 mknod -m 660 $fs/dev/ttyS0 c 4 64 |
pascal@13591 | 37 fi |
pascal@13591 | 38 mknod -m 660 $fs/dev/tty1 c 4 1 |
pascal@13591 | 39 cat > $fs/init <<EOT |
pascal@13591 | 40 #!/bin/busybox sh |
pascal@13591 | 41 |
pascal@13591 | 42 for i in \$(busybox --list) ; do busybox ln /bin/busybox /bin/\$i; done |
pascal@13591 | 43 |
pascal@13591 | 44 export PATH=/bin |
pascal@13591 | 45 export HOME=/ |
pascal@13591 | 46 export TERM=vt100 |
pascal@13591 | 47 |
pascal@13591 | 48 mount -t proc none /proc |
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@13882 | 56 arg loopfs && losetup /dev/loop0 /mnt/\$root && mount /dev/loop0 /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@13879 | 59 |
pascal@13591 | 60 [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb |
pascal@13591 | 61 mount -t sysfs none /sys |
pascal@13591 | 62 mount -t devpts none /dev/pts |
pascal@13591 | 63 |
pascal@13591 | 64 TTY=\$(tty 2>/dev/null) |
pascal@13591 | 65 TTY=\${TTY:-/dev/tty1} |
pascal@13591 | 66 EOT |
pascal@13591 | 67 $jslinux && cat >> $fs/init <<EOT |
pascal@13591 | 68 stty -F \$TTY rows 30 2>/dev/null |
pascal@13591 | 69 EOT |
pascal@13591 | 70 cat >> $fs/init <<EOT |
pascal@13591 | 71 |
pascal@13591 | 72 busybox | sed '/Current/,\$!d' |
pascal@13591 | 73 while true; do |
pascal@13591 | 74 if [ -x /bin/setsid ]; then |
pascal@13591 | 75 setsid sh -c "exec sh <\$TTY >\$TTY 2>&1" |
pascal@13591 | 76 else |
pascal@13591 | 77 sh <\$TTY >\$TTY 2>&1 |
pascal@13591 | 78 fi |
pascal@13591 | 79 done |
pascal@13591 | 80 EOT |
pascal@13591 | 81 chmod +x $fs/init |
pascal@13591 | 82 ln $fs/init $fs/sbin/init |
pascal@13591 | 83 } |
pascal@13591 | 84 |
pascal@13591 | 85 pre_install() |
pascal@13591 | 86 { |
pascal@13591 | 87 rm -rf $1/bin $1/sbin |
pascal@13591 | 88 } |
pascal@13591 | 89 |
pascal@13591 | 90 post_install() |
pascal@13591 | 91 { |
pascal@13591 | 92 rm -rf $1/lib $1/var $1/sbin $1/home $1/root $1/media |
pascal@13591 | 93 } |