wok rev 768

slitaz-loram-cdrom: version 1.2, may release cdrom
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun May 11 00:32:32 2008 +0000 (2008-05-11)
parents 4a64f18f5115
children 32953ef3a7c7
files slitaz-loram-cdrom/receipt
line diff
     1.1 --- a/slitaz-loram-cdrom/receipt	Sat May 10 23:04:41 2008 +0000
     1.2 +++ b/slitaz-loram-cdrom/receipt	Sun May 11 00:32:32 2008 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="slitaz-loram-cdrom"
     1.7 -VERSION="1.1"
     1.8 +VERSION="1.2"
     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 @@ -24,11 +24,11 @@
    1.13      i=$(($i-1))
    1.14      tag=$(grep "$tag" $1/etc/init.d/rcS)
    1.15      if [ "$2" = "-R" ]; then
    1.16 -    	line="-$(($i-24)),26 +$(($i-24)),2"
    1.17 +    	line="-$(($i-49)),51 +$(($i-49)),2"
    1.18  	i="-"
    1.19      else
    1.20          grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
    1.21 -    	line="-$i,2 +$i,26"
    1.22 +    	line="-$i,2 +$i,51"
    1.23  	i="+"
    1.24      fi
    1.25      patch -p0 <<EOF
    1.26 @@ -36,6 +36,21 @@
    1.27  +++ $1/etc/init.d/rcS
    1.28  @@ $line @@
    1.29   
    1.30 +$i# Try to release the cdrom (from slitaz-loram-cdrom package)
    1.31 +$i release_cdrom()
    1.32 +$i {
    1.33 +$i	FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')	
    1.34 +$i	if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
    1.35 +$i		cp -a \$FS /.usr.fs
    1.36 +$i		status
    1.37 +$i		echo -n "Releasing CD-ROM..."
    1.38 +$i		umount /cdrom
    1.39 +$i		FS=/.usr.fs
    1.40 +$i		return 0
    1.41 +$i	fi
    1.42 +$i	return 1
    1.43 +$i }
    1.44 +$i
    1.45  $i# Mount /usr (from slitaz-loram-cdrom package)
    1.46  $i if [ -d /cdrom ]; then
    1.47  $i	mount -o ro -t iso9660 /dev/cdrom /cdrom
    1.48 @@ -46,11 +61,21 @@
    1.49  $i		echo -n "Mounting /usr read-only... "
    1.50  $i		usr=usr
    1.51  $i	fi
    1.52 -$i	if [ -f /cdrom/usr.cromfs ]; then
    1.53 -$i		/bin/cromfs-driver /cdrom/usr.cromfs /\$usr
    1.54 -$i	elif [ -f /cdrom/usr.sqfs ]; then
    1.55 -$i		mount -o loop,ro -t squashfs /cdrom/usr.sqfs /\$usr
    1.56 -$i	elif [ ! -L /\$usr ]; then
    1.57 +$i	FS=/cdrom/usr.cromfs
    1.58 +$i	if [ -f \$FS ]; then
    1.59 +$i		release_cdrom
    1.60 +$i		/bin/cromfs-driver \$FS /\$usr
    1.61 +$i	FS=/cdrom/usr.sqfs
    1.62 +$i	elif [ -f \$FS ]; then
    1.63 +$i		release_cdrom
    1.64 +$i		mount -o loop,ro -t squashfs \$FS /\$usr
    1.65 +$i	elif [ -L /\$usr ]; then
    1.66 +$i		FS=/cdrom/usr
    1.67 +$i		if release_cdrom; then
    1.68 +$i			rm -f /\$usr
    1.69 +$i			mv \$FS /usr
    1.70 +$i		fi
    1.71 +$i	else
    1.72  $i		umount /cdrom
    1.73  $i		false
    1.74  $i	fi