wok rev 11620

Up slitaz-boot-scripts (4.6)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jan 24 11:48:19 2012 +0100 (2012-01-24)
parents 226e35b1edfc
children b03537a221f9
files busybox/receipt busybox/stuff/init slitaz-boot-scripts/receipt
line diff
     1.1 --- a/busybox/receipt	Mon Jan 23 19:52:09 2012 +0000
     1.2 +++ b/busybox/receipt	Tue Jan 24 11:48:19 2012 +0100
     1.3 @@ -100,7 +100,6 @@
     1.4  		grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config && 
     1.5  		ln -s daemon $fs/etc/init.d/$i
     1.6      done
     1.7 -    cp $stuff/init $fs
     1.8      rm $fs/linuxrc
     1.9      mkdir -p $fs/etc/modprobe.d
    1.10      
     2.1 --- a/busybox/stuff/init	Mon Jan 23 19:52:09 2012 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,168 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -
     2.6 -launch_init()
     2.7 -{
     2.8 -	[ -d /proc/sys ] && umount /proc
     2.9 -	echo -e "\\033[70G[ \\033[1;32mOK\\033[0;39m ]"
    2.10 -	exec /sbin/switch_root mnt /sbin/init
    2.11 -}
    2.12 -
    2.13 -failed()
    2.14 -{
    2.15 -	umount /proc
    2.16 -	echo -e "\\033[70G[ \\033[1;31mFailed\\033[0;39m ]"
    2.17 -	conspy -d 1 > /init.log
    2.18 -}
    2.19 -
    2.20 -try_init()
    2.21 -{
    2.22 -	if [ ! -d /mnt/etc ] && grep -q cryptoroot= /proc/cmdline; then
    2.23 -		modprobe dm-mod
    2.24 -		modprobe dm-crypt
    2.25 -		modprobe aes-i586
    2.26 -		root="$(sed 's/.*cryptoroot=\([^ ]*\).*/\1/' < /proc/cmdline)"
    2.27 -		dev=${root#/dev/}
    2.28 -		dmlabel=crypto-$dev
    2.29 -		if cryptsetup isLuks $root 2> /dev/null; then
    2.30 -			cryptsetup luksOpen $root $dmlabel
    2.31 -		else
    2.32 -			read -s -t 60 -p "Pass phrase : " passphrase
    2.33 -			key=$(echo $passphrase | hashalot -x -n 32 sha512)
    2.34 -			blocks=$(cat $(find /sys/block | grep /$dev/size))
    2.35 -			echo 0 $blocks crypt aes-plain $key 0 $root 0 | \
    2.36 -				dmsetup create $dmlabel
    2.37 -		fi
    2.38 -		mount /dev/mapper/$dmlabel /mnt
    2.39 -	fi
    2.40 -	if [ -d /mnt/etc ]; then
    2.41 -		umount /sys
    2.42 -		[ -n "$1" ] && for i in $@ ; do
    2.43 -			cp -a $i /mnt$(dirname $i)
    2.44 -		done
    2.45 -		mount /mnt -o remount,ro
    2.46 -		launch_init
    2.47 -	fi
    2.48 -	failed
    2.49 -}
    2.50 -
    2.51 -mount_mapper()
    2.52 -{
    2.53 -	mount $root /mnt
    2.54 -	try_init /dev/mapper $@
    2.55 -}
    2.56 -
    2.57 -lvmsetup()
    2.58 -{
    2.59 -	grep -q lvmroot= /proc/cmdline || return 1
    2.60 -	modprobe dm-mod
    2.61 -	vgscan --ignorelockingfailure
    2.62 -	vgchange -ay --ignorelockingfailure
    2.63 -	root="/dev/mapper/$(sed 's/.*lvmroot=\([^ ]*\).*/\1/' < /proc/cmdline)"
    2.64 -	return 0
    2.65 -}
    2.66 -
    2.67 -load_raid()
    2.68 -{
    2.69 -while read line; do
    2.70 -	case "$line" in
    2.71 -	*raid10*)	modprobe raid10 ;;
    2.72 -	*raid0*)	modprobe raid0 ;;
    2.73 -	*raid1*)	modprobe raid1 ;;
    2.74 -	*raid[456]*)	modprobe raid456 ;;
    2.75 -	esac
    2.76 -done
    2.77 -}
    2.78 -
    2.79 -mount -t proc proc /proc
    2.80 -mount -t sysfs sysfs /sys
    2.81 -echo -n "Switching / to "
    2.82 -if grep -q dmraid= /proc/cmdline; then
    2.83 -	root="$(sed 's/.*dmraid=\([^ ]*\).*/\1/' < /proc/cmdline)"
    2.84 -	echo -n "dmraid $root..."
    2.85 -	dmraid -s | grep ^type | awk '{ print $3 }' | load_raid
    2.86 -	case "$root" in
    2.87 -	/dev/*);;
    2.88 -	*) root=/dev/mapper/$(dmraid -s|grep ^name|awk '{print $3}')p${root#p};;
    2.89 -	esac
    2.90 -	dmraid -ay
    2.91 -	lvmsetup 
    2.92 -	mount_mapper
    2.93 -fi
    2.94 -if grep -q softraid= /proc/cmdline; then
    2.95 -	root="$(sed 's/.*softraid=\([^ ]*\).*/\1/' < /proc/cmdline)"
    2.96 -	echo -n "softraid $root..."
    2.97 -	mdadm --examine --scan --config=partitions > /etc/mdadm.conf
    2.98 -	grep -qs " $root " /etc/mdadm.conf ||
    2.99 -		root=$(awk '/dev.md/ { print $2; exit }' < /etc/mdadm.conf)
   2.100 -	grep level=raid /etc/mdadm.conf | load_raid
   2.101 -	for i in 1 2 3 4 5 6 7 8 9; do
   2.102 -		sleep $i
   2.103 -		mdadm --assemble --scan
   2.104 -		grep -qs ': active' /proc/mdstat && break
   2.105 -	done
   2.106 -	lvmsetup 
   2.107 -	mount_mapper /etc/mdadm.conf
   2.108 -fi
   2.109 -if lvmsetup; then
   2.110 -	echo -n "lvm $root..."
   2.111 -	mount_mapper
   2.112 -fi
   2.113 -if grep -q mount= /proc/cmdline; then
   2.114 -	root="$(sed 's/.*mount=\([^ ]*\).*/\1/' < /proc/cmdline)"
   2.115 -	dev=$(blkid | grep $root | sed 's/:.*//;q')
   2.116 -	echo -n "Mounting $dev ($root) ..."
   2.117 -	if ! mount $dev /mnt; then
   2.118 -		if echo $dev | grep -q "/dev/sd"; then
   2.119 -			delay=`cat /sys/module/usb_storage/parameters/delay_use`
   2.120 -			delay=$((1+$delay))
   2.121 -			echo -n "sleep for $delay seconds..."
   2.122 -			sleep $delay
   2.123 -		fi
   2.124 -		mount $dev /mnt
   2.125 -	fi
   2.126 -	grep -q posixovl /proc/cmdline && mount.posixovl /mnt
   2.127 -fi
   2.128 -if grep -q loopfs= /proc/cmdline; then
   2.129 -	loopfs="$(sed 's/.*loopfs=\([^ ]*\).*/\1/' < /proc/cmdline)"
   2.130 -	echo -n "loop $loopfs..."
   2.131 -	losetup /dev/loop0 /mnt/$loopfs
   2.132 -	mount /dev/loop0 /mnt 2> /dev/null
   2.133 -fi
   2.134 -if grep -q bindfs= /proc/cmdline; then
   2.135 -	bind="$(sed 's/.*bindfs=\([^ ]*\).*/\1/' < /proc/cmdline)"
   2.136 -	mount --bind /mnt/${bind%,*} /mnt/${bind%,*}/${bind#*,}
   2.137 -fi
   2.138 -grep -q cryptoroot= /proc/cmdline && try_init
   2.139 -umount /sys
   2.140 -if grep -q subroot= /proc/cmdline; then
   2.141 -	subroot="/$(sed 's/.*subroot=\([^ ]*\).*/\1/' < /proc/cmdline)" &&
   2.142 -	if [ -s /usr/share/boot/busybox-static ]; then
   2.143 -		mv /usr/share/boot/busybox-static .
   2.144 -		/busybox-static rm -rf /etc /lib /*bin /usr /var
   2.145 -		exec /busybox-static chroot /mnt$subroot /sbin/init
   2.146 -	else
   2.147 -		exec chroot /mnt$subroot /sbin/init
   2.148 -	fi
   2.149 -fi
   2.150 -echo -n "tmpfs..."
   2.151 -size="$(grep rootfssize= < /proc/cmdline | \
   2.152 -	sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')"
   2.153 -free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }')
   2.154 -umount /proc
   2.155 -[ -n "$size" ] || size="-o size=90%"
   2.156 -if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then
   2.157 -	echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]"
   2.158 -	exec /sbin/init
   2.159 -fi
   2.160 -for i in $(ls -a /); do
   2.161 -	case "$i" in
   2.162 -	.|..)	;;
   2.163 -	mnt)	mkdir /mnt/mnt;;
   2.164 -	*)	if ! cp -a /$i /mnt 2> /dev/null; then
   2.165 -			failed
   2.166 -			umount /mnt
   2.167 -			exec /sbin/init
   2.168 -		fi;;
   2.169 -	esac
   2.170 -done
   2.171 -launch_init
     3.1 --- a/slitaz-boot-scripts/receipt	Mon Jan 23 19:52:09 2012 +0000
     3.2 +++ b/slitaz-boot-scripts/receipt	Tue Jan 24 11:48:19 2012 +0100
     3.3 @@ -1,7 +1,7 @@
     3.4  # SliTaz package receipt.
     3.5  
     3.6  PACKAGE="slitaz-boot-scripts"
     3.7 -VERSION="4.5"
     3.8 +VERSION="4.6"
     3.9  CATEGORY="base-system"
    3.10  SHORT_DESC="Provide all the initialisation scripts used at boot time."
    3.11  MAINTAINER="pankso@slitaz.org"
    3.12 @@ -21,12 +21,14 @@
    3.13  	mkdir -p $fs/usr/share $fs/etc/X11
    3.14  	cp -a $src/etc $fs
    3.15  	cp -a $src/bin $fs
    3.16 +	cp -a $src/init $fs
    3.17  	cp -a $src/applications $fs/usr/share
    3.18  
    3.19  	# Perms
    3.20  	chown -R root.root $fs
    3.21  	chmod 755 $fs/etc/init.d/*.sh
    3.22  	chmod 755 $fs/etc/init.d/rc*
    3.23 +	chmod 755 $fs/init
    3.24  }
    3.25  
    3.26  # Pre install commands.