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

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