wok-current rev 375
Slitaz-loram*: do not remove itself during install...
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 08 13:55:02 2008 +0000 (2008-03-08) |
parents | 526c779c9331 |
children | 77702793c15c |
files | slitaz-loram-cdrom/receipt slitaz-loram/receipt |
line diff
1.1 --- a/slitaz-loram-cdrom/receipt Sat Mar 08 13:37:54 2008 +0100 1.2 +++ b/slitaz-loram-cdrom/receipt Sat Mar 08 13:55:02 2008 +0000 1.3 @@ -19,19 +19,20 @@ 1.4 local line 1.5 local i 1.6 tag="Handle kernel cmdline parameter config" 1.7 - i=$(grep -n "$tag" /etc/init.d/rcS | cut -d: -f1) 1.8 + i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) 1.9 i=$(($i-1)) 1.10 - tag=$(grep "$tag" /etc/init.d/rcS) 1.11 - if [ "$1" = "-R" ]; then 1.12 + tag=$(grep "$tag" $1/etc/init.d/rcS) 1.13 + if [ "$2" = "-R" ]; then 1.14 line="-$(($i-24)),26 +$(($i-24)),2" 1.15 i="-" 1.16 else 1.17 + grep -q 'if [ -d /cdrom ]; then' $1/etc/init.d/rcS && return 1.18 line="-$i,2 +$i,26" 1.19 i="+" 1.20 fi 1.21 cat <<EOF 1.22 ---- /etc/init.d/rcS 1.23 -+++ /etc/init.d/rcS 1.24 +--- $1/etc/init.d/rcS 1.25 ++++ $1/etc/init.d/rcS 1.26 @@ $line @@ 1.27 1.28 $i# Mount /usr 1.29 @@ -60,6 +61,7 @@ 1.30 $i 1.31 $tag 1.32 EOF 1.33 + chmod 0755 $1/etc/init.d/rcS 1.34 } 1.35 1.36 # Pre and post install commands for Tazpkg. 1.37 @@ -67,12 +69,14 @@ 1.38 { 1.39 local $loram 1.40 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null) 1.41 - [ -n "$loram" ] && yes y | tazpkg remove $loram 1.42 + [ -n "$loram" -a "$loram" != "$PACKAGE" ] && yes y | tazpkg remove $loram 1.43 } 1.44 1.45 post_install() 1.46 { 1.47 - get_patch | patch -p0 1.48 + local root 1.49 + root=$1 1.50 + get_patch "$root" | patch -p0 1.51 if [ ! -x /bin/funionfs ]; then 1.52 cat <<EOF 1.53 You will build a live CD with /usr mounted read-only. 1.54 @@ -85,5 +89,5 @@ 1.55 # Pre remove commands for Tazpkg. 1.56 pre_remove() 1.57 { 1.58 - get_patch -R | patch -p0 1.59 + get_patch '' -R | patch -p0 1.60 }
2.1 --- a/slitaz-loram/receipt Sat Mar 08 13:37:54 2008 +0100 2.2 +++ b/slitaz-loram/receipt Sat Mar 08 13:55:02 2008 +0000 2.3 @@ -20,19 +20,20 @@ 2.4 local line 2.5 local i 2.6 tag="Creat /dev/cdrom if needed" 2.7 - i=$(grep -n "$tag" /etc/init.d/rcS | cut -d: -f1) 2.8 + i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) 2.9 i=$(($i-1)) 2.10 - tag=$(grep "$tag" /etc/init.d/rcS) 2.11 - if [ "$1" = "-R" ]; then 2.12 + tag=$(grep "$tag" $1/etc/init.d/rcS) 2.13 + if [ "$2" = "-R" ]; then 2.14 line="-$(($i-13)),15 +$(($i-13)),2" 2.15 i="-" 2.16 else 2.17 + grep -q 'if [ -f /.usr.cromfs ]; then' $1/etc/init.d/rcS && return 2.18 line="-$i,2 +$i,15" 2.19 i="+" 2.20 fi 2.21 cat <<EOF 2.22 ---- /etc/init.d/rcS 2.23 -+++ /etc/init.d/rcS 2.24 +--- $1/etc/init.d/rcS 2.25 ++++ $1/etc/init.d/rcS 2.26 @@ $line @@ 2.27 2.28 $i# Mount compressed /usr 2.29 @@ -50,6 +51,7 @@ 2.30 $i 2.31 $tag 2.32 EOF 2.33 + chmod 0755 $1/etc/init.d/rcS 2.34 } 2.35 2.36 # Pre and post install commands for Tazpkg. 2.37 @@ -57,12 +59,14 @@ 2.38 { 2.39 local $loram 2.40 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null) 2.41 - [ -n "$loram" ] && yes y | tazpkg remove $loram 2.42 + [ -n "$loram" -a "$loram" != "$PACKAGE" ] && yes y | tazpkg remove $loram 2.43 } 2.44 2.45 post_install() 2.46 { 2.47 - get_patch | patch -p0 2.48 + local root 2.49 + root=$1 2.50 + get_patch "$root" | patch -p0 2.51 if [ ! -x /bin/funionfs ]; then 2.52 cat <<EOF 2.53 You will build a live CD with /usr mounted read-only. 2.54 @@ -75,5 +79,5 @@ 2.55 # Pre remove commands for Tazpkg. 2.56 pre_remove() 2.57 { 2.58 - get_patch -R | patch -p0 2.59 + get_patch '' -R | patch -p0 2.60 }