wok rev 389

Slitaz-loram: support both cromfs and squashfs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 09 12:58:23 2008 +0000 (2008-03-09)
parents 401917ccfc5a
children 80bb089358ea
files slitaz-loram/receipt slitaz-loram/stuff/loram.extract slitaz-loram/stuff/loram.rootfs
line diff
     1.1 --- a/slitaz-loram/receipt	Sun Mar 09 12:15:39 2008 +0100
     1.2 +++ b/slitaz-loram/receipt	Sun Mar 09 12:58:23 2008 +0000
     1.3 @@ -24,11 +24,11 @@
     1.4      i=$(($i-1))
     1.5      tag=$(grep "$tag" $1/etc/init.d/rcS)
     1.6      if [ "$2" = "-R" ]; then
     1.7 -    	line="-$(($i-13)),15 +$(($i-13)),2"
     1.8 +    	line="-$(($i-21)),23 +$(($i-21)),2"
     1.9  	i="-"
    1.10      else
    1.11 -        grep -q 'if [ -f /.usr.cromfs ]; then' $1/etc/init.d/rcS && return
    1.12 -    	line="-$i,2 +$i,15"
    1.13 +        grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return
    1.14 +    	line="-$i,2 +$i,23"
    1.15  	i="+"
    1.16      fi
    1.17      patch -p0 <<EOF
    1.18 @@ -36,15 +36,23 @@
    1.19  +++ $1/etc/init.d/rcS
    1.20  @@ $line @@
    1.21   
    1.22 -$i# Mount compressed /usr
    1.23 -$i if [ -f /.usr.cromfs ]; then
    1.24 +$i# Mount compressed /usr (from slitaz-loram package)
    1.25 +$i if [ -f /.usr.cromfs -o -f /.usr.sqfs ]; then
    1.26 +$i	usr=usr
    1.27 +$i	echo -n "Mounting /usr read-"
    1.28  $i	if [ -d /.usr.rw ]; then
    1.29 -$i		echo -n "Mounting compressed /usr read-write... "
    1.30 -$i		/bin/cromfs-driver /.usr.cromfs /.usr.ro
    1.31 +$i		usr=.usr.ro
    1.32 +$i		echo -n "write... "
    1.33 +$i	else
    1.34 +$i		echo -n "only... "
    1.35 +$i	fi
    1.36 +$i	if [ -f /.usr.cromfs ]; then
    1.37 +$i		/bin/cromfs-driver /.usr.cromfs /\$usr
    1.38 +$i	else
    1.39 +$i		/bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr
    1.40 +$i	fi
    1.41 +$i	if [ -d /.usr.rw ]; then
    1.42  $i		/bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
    1.43 -$i	else
    1.44 -$i		echo -n "Mounting compressed /usr read-only... "
    1.45 -$i		/bin/cromfs /.usr.cromfs /usr
    1.46  $i	fi
    1.47  $i	status
    1.48  $i fi
    1.49 @@ -58,20 +66,27 @@
    1.50  pre_install()
    1.51  {
    1.52      local i
    1.53 +    . /etc/tazlito/tazlito.conf
    1.54      for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
    1.55          [ "$i" = "$PACKAGE" ] && continue
    1.56          yes y | tazpkg remove $i
    1.57 +	rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
    1.58      done
    1.59  }
    1.60  
    1.61  post_install()
    1.62  {
    1.63 -    set_patch "$1"
    1.64 +    local root
    1.65 +    root=$1
    1.66 +    set_patch "$root"
    1.67      if [ ! -x /bin/funionfs ]; then
    1.68          cat <<EOF
    1.69 +----
    1.70  You will build a live CD with /usr mounted read-only.
    1.71 -You can install funionfs to have read-write access to /usr with:
    1.72 +You can install funionfs to have read-write access into /usr with:
    1.73 +
    1.74  # tazpkg get-install funionfs
    1.75 +
    1.76  EOF
    1.77      fi
    1.78  }
     2.1 --- a/slitaz-loram/stuff/loram.extract	Sun Mar 09 12:15:39 2008 +0100
     2.2 +++ b/slitaz-loram/stuff/loram.extract	Sun Mar 09 12:58:23 2008 +0000
     2.3 @@ -1,7 +1,14 @@
     2.4 -cromfs=".usr.cromfs"
     2.5  rmdir usr
     2.6 -bin/unmkcromfs $cromfs usr
     2.7 -rm -f $cromfs
     2.8 +packedfs=".usr.cromfs"
     2.9 +if [ -f $packedfs ]; then
    2.10 +	bin/unmkcromfs $packedfs usr
    2.11 +	rm -f $packedfs
    2.12 +fi
    2.13 +packedfs=".usr.shfs"
    2.14 +if [ -f $packedfs ]; then
    2.15 +	sbin/unsquashfs -d usr $packedfs
    2.16 +	rm -f $packedfs
    2.17 +fi
    2.18  ( cd usr/.moved ; find * -print ) | \
    2.19  while read file; do
    2.20  	[ -L "$file" ] || continue
     3.1 --- a/slitaz-loram/stuff/loram.rootfs	Sun Mar 09 12:15:39 2008 +0100
     3.2 +++ b/slitaz-loram/stuff/loram.rootfs	Sun Mar 09 12:58:23 2008 +0000
     3.3 @@ -1,7 +1,8 @@
     3.4  echo "$(du -hs ./usr | cut -f1) were used by /usr"
     3.5  for ii in /sbin /lib /bin; do
     3.6    mkdir -p ./usr/.moved$ii
     3.7 -  for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses; do
     3.8 +  for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \
     3.9 +	   libcap; do
    3.10      for k in $(grep ^$ii ./var/lib/tazpkg/installed/$j/files.list) ; do
    3.11        [ -f .$k ] || continue
    3.12        mv .$k ./usr/.moved$k
    3.13 @@ -17,7 +18,11 @@
    3.14  done
    3.15  echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr"
    3.16  echo "$(du -hs ./usr | cut -f1) were used by /usr before compression"
    3.17 -usr/bin/mkcromfs -qq -f 262144 -b 16384 usr .usr.cromfs
    3.18 +if [ -x usr/bin/mkcromfs ]; then
    3.19 +  usr/bin/mkcromfs -qq -f 262144 -b 16384 usr .usr.cromfs
    3.20 +else
    3.21 +  usr/sbin/mksquashfs usr .usr.sqfs
    3.22 +fi
    3.23  if [ -x bin/funionfs ]; then
    3.24    mkdir .usr.ro .usr.rw
    3.25    ln -s /.usr.ro/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2
    3.26 @@ -25,4 +30,4 @@
    3.27  rm -rf usr
    3.28  mkdir usr
    3.29  COMPRESSION="none"
    3.30 -echo "$(du -hs ./.usr.cromfs | cut -f1) are used by /usr after compression"
    3.31 +echo "$(du -hs ./.usr.*fs | cut -f1) are used by /usr after compression"