wok-6.x diff slitaz-loram-cdrom/receipt @ rev 13323

Up xdotool (20110530)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 03 09:25:48 2012 +0200 (2012-09-03)
parents fa0257184d3c
children f4c22f009037
line diff
     1.1 --- a/slitaz-loram-cdrom/receipt	Fri Mar 05 17:52:43 2010 +0100
     1.2 +++ b/slitaz-loram-cdrom/receipt	Mon Sep 03 09:25:48 2012 +0200
     1.3 @@ -1,12 +1,12 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="slitaz-loram-cdrom"
     1.7 -VERSION="1.5"
     1.8 +VERSION="2.0"
     1.9  CATEGORY="misc"
    1.10  SHORT_DESC="Rules to build low ram system using cdrom."
    1.11  MAINTAINER="pascal.bellard@slitaz.org"
    1.12  WEB_SITE="http://www.slitaz.org/"
    1.13 -DEPENDS="slitaz-boot-scripts tazlito"
    1.14 +DEPENDS=""
    1.15  
    1.16  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.17  genpkg_rules()
    1.18 @@ -14,192 +14,3 @@
    1.19      mkdir -p $fs/etc/tazlito
    1.20      cp stuff/loram.* $fs/etc/tazlito
    1.21  }
    1.22 -
    1.23 -set_patch()
    1.24 -{
    1.25 -    local tag
    1.26 -    local line
    1.27 -    local len
    1.28 -    local i
    1.29 -    tag="Handle kernel cmdline parameter config"
    1.30 -    i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
    1.31 -    i=$(($i-1))
    1.32 -    len=88
    1.33 -    tag=$(grep "$tag" $1/etc/init.d/rcS)
    1.34 -    if [ "$2" = "-R" ]; then
    1.35 -    	line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
    1.36 -	i="-"
    1.37 -    else
    1.38 -        grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
    1.39 -    	line="-$i,2 +$i,$len"
    1.40 -	i="+"
    1.41 -    fi
    1.42 -    busybox patch -p0 <<EOF
    1.43 ---- $1/etc/init.d/rcS
    1.44 -+++ $1/etc/init.d/rcS
    1.45 -@@ $line @@
    1.46 - 
    1.47 -$i# Try to release the cdrom (from slitaz-loram-cdrom package)
    1.48 -$i release_cdrom()
    1.49 -$i {
    1.50 -$i	FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')	
    1.51 -$i	if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
    1.52 -$i		if ! grep -q " keep-loram" /proc/cmdline &&
    1.53 -$i		    [ -d \$FS -o \$FREEMEM -gt \$(du -s \$FS | \\
    1.54 -$i			awk '{ print (\$1*4)+40000 }') ]; then
    1.55 -$i			echo -n "Extracting loram..."
    1.56 -$i			. /etc/tazlito/loram.extract /cdrom
    1.57 -$i			if status; then
    1.58 -$i				umount /cdrom
    1.59 -$i				rmdir /cdrom
    1.60 -$i				yes y | tazpkg remove slitaz-loram-cdrom > /dev/null
    1.61 -$i				return 0
    1.62 -$i			fi
    1.63 -$i		fi
    1.64 -$i		cp -a \$FS /.usr.fs
    1.65 -$i		status
    1.66 -$i		echo -n "Releasing CD-ROM..."
    1.67 -$i		umount /cdrom
    1.68 -$i		FS=/.usr.fs
    1.69 -$i		if [ -d \$FS ]; then
    1.70 -$i			rm -f /\$usr
    1.71 -$i			mv \$FS /usr
    1.72 -$i		fi
    1.73 -$i	fi
    1.74 -$i	return 1
    1.75 -$i }
    1.76 -$i
    1.77 -$i# Mount /usr (from slitaz-loram-cdrom package)
    1.78 -$i if [ -d /cdrom ]; then
    1.79 -$i 	DEVICE=/dev/cdrom
    1.80 -$i 	DIR=
    1.81 -$i	if grep -q " loram=" /proc/cmdline; then
    1.82 -$i		DIR=\`cat /proc/cmdline | sed 's/.* loram=\([^ ]*\).*/\1/'\`
    1.83 -$i		DEVICE=\${DIR%,*}
    1.84 -$i		DIR=/\${DIR#*,}
    1.85 -$i	fi
    1.86 -$i	if ! /bin/mount -r \$DEVICE /cdrom; then
    1.87 -$i		if echo \$DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then
    1.88 -$i			USBDELAY=\`cat /sys/module/usb_storage/parameters/delay_use\`
    1.89 -$i			USBDELAY=\$((1+\$USBDELAY))
    1.90 -$i			echo "\$DEVICE is potentially a USB device: sleep for \$USBDELAY seconds"
    1.91 -$i			sleep \$USBDELAY
    1.92 -$i		fi
    1.93 -$i		if ! /bin/mount -r \$DEVICE /cdrom; then
    1.94 -$i			DEVICE=""
    1.95 -$i		fi
    1.96 -$i	fi
    1.97 -$i	while [ -n "\$DEVICE" ]; do
    1.98 -$i		if [ -d /.usr.rw ]; then
    1.99 -$i			echo -n "Mounting /usr read-write... "
   1.100 -$i			usr=.usr.ro
   1.101 -$i		else
   1.102 -$i			echo -n "Mounting /usr read-only... "
   1.103 -$i			usr=usr
   1.104 -$i		fi
   1.105 -$i		FS=/cdrom\$DIR/usr.cromfs
   1.106 -$i		if [ -f \$FS ]; then
   1.107 -$i			release_cdrom && break
   1.108 -$i			/bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
   1.109 -$i		elif [ -f /cdrom\$DIR/usr.sqfs ]; then
   1.110 -$i			FS=/cdrom\$DIR/usr.sqfs
   1.111 -$i			release_cdrom && break
   1.112 -$i			mount -o loop,ro -t squashfs \$FS /\$usr
   1.113 -$i		elif [ -L /\$usr ]; then
   1.114 -$i			FS=/cdrom\$DIR/usr
   1.115 -$i			release_cdrom && break
   1.116 -$i			true
   1.117 -$i		else
   1.118 -$i			umount /cdrom
   1.119 -$i			false
   1.120 -$i		fi
   1.121 -$i		status 
   1.122 -$i		if [ -d /.usr.rw ]; then
   1.123 -$i			if [ -x /bin/funionfs ]; then
   1.124 -$i				/bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
   1.125 -$i			else
   1.126 -$i				/bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
   1.127 -$i			fi
   1.128 -$i		fi
   1.129 -$i		break
   1.130 -$i	done
   1.131 -$i fi
   1.132 -$i
   1.133 - $tag
   1.134 -EOF
   1.135 -    tag="/var/log/dmesg.log"
   1.136 -    i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
   1.137 -    i=$(($i-1))
   1.138 -    len=9
   1.139 -    tag=$(grep "$tag" $1/etc/init.d/rcS)
   1.140 -    if [ "$2" = "-R" ]; then
   1.141 -    	line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
   1.142 -	i="-"
   1.143 -    else
   1.144 -    	line="-$i,2 +$i,$len"
   1.145 -	i="+"
   1.146 -    fi
   1.147 -    busybox patch -p0 <<EOF
   1.148 ---- $1/etc/init.d/rcS
   1.149 -+++ $1/etc/init.d/rcS
   1.150 -@@ $line @@
   1.151 - 
   1.152 -$i# Build ramdisk if root=/dev/cdrom (from slitaz-loram-cdrom package)
   1.153 -$i if [ -L /root ]; then
   1.154 -$i	mount -t tmpfs ramdisk /tmp
   1.155 -$i	mkdir -p /tmp/log/lighttpd /tmp/run /tmp/lock
   1.156 -$i	chown www.www /tmp/log/lighttpd
   1.157 -$i fi
   1.158 -$i
   1.159 - $tag
   1.160 -EOF
   1.161 -    chmod 0755 $1/etc/init.d/rcS
   1.162 -}
   1.163 -
   1.164 -# Pre and post install commands for Tazpkg.
   1.165 -pre_install()
   1.166 -{
   1.167 -    local i
   1.168 -    for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
   1.169 -        [ "$i" = "$PACKAGE" ] && continue
   1.170 -        yes y | tazpkg remove $i
   1.171 -        . /etc/tazlito/tazlito.conf
   1.172 -	rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
   1.173 -    done
   1.174 -}
   1.175 -
   1.176 -post_install()
   1.177 -{
   1.178 -    set_patch "$1"
   1.179 -    
   1.180 -    # Don't support FAST_BOOT_X yet
   1.181 -    sed -i 's/FAST_BOOT_X=.*/FAST_BOOT_X="no"/' $1/etc/rcS.conf
   1.182 -    
   1.183 -    cat <<EOF
   1.184 -----
   1.185 -'tazlito gen-distro' will create a loram-cdrom flavor
   1.186 -while this package is installed.
   1.187 -EOF
   1.188 -    if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs-utils ]; then
   1.189 -        cat <<EOF
   1.190 -----
   1.191 -You will build a live CD with /usr mounted read-only.
   1.192 -You can install aufs or funionfs to have read-write access into /usr with:
   1.193 -
   1.194 -# tazpkg get-install aufs
   1.195 -or
   1.196 -# tazpkg get-install funionfs
   1.197 -
   1.198 -EOF
   1.199 -    fi
   1.200 -}
   1.201 -
   1.202 -# Pre remove commands for Tazpkg.
   1.203 -pre_remove()
   1.204 -{
   1.205 -    set_patch '' -R 
   1.206 -    cat <<EOF
   1.207 -----
   1.208 -'tazlito gen-distro' will work as expected now.
   1.209 -EOF
   1.210 -}