wok view busybox-boot/receipt @ rev 15134

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