wok-current annotate busybox-boot/receipt @ rev 17074

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