wok-current diff slitaz-loram-cdrom/receipt @ rev 251

Add: slitaz-loram-cdrom
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 22 14:36:45 2008 +0100 (2008-02-22)
parents
children 3a5e92c048e0
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/slitaz-loram-cdrom/receipt	Fri Feb 22 14:36:45 2008 +0100
     1.3 @@ -0,0 +1,91 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="slitaz-loram-cdrom"
     1.7 +VERSION="1.0"
     1.8 +CATEGORY="misc"
     1.9 +SHORT_DESC="Rules to build low ram system using cdrom."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +
    1.12 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.13 +genpkg_rules()
    1.14 +{
    1.15 +    mkdir -p $fs/etc/tazlito
    1.16 +    cat > $fs/etc/tazlito/loram.rootfs << EOF
    1.17 +echo "\$(du -hs /usr | cut -f1) were used by /usr"
    1.18 +for ii in /sbin /lib /bin; do
    1.19 +  mkdir -p ./usr/.moved\$ii
    1.20 +  for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses; do
    1.21 +    for k in \$(grep ^\$ii /var/lib/tazpkg/installed/\$j/files.list) ; do
    1.22 +      [ -f .\$k ] || continue
    1.23 +      mv .\$k ./usr/.moved\$k
    1.24 +      ln -s /usr/.moved\$k .\$k 
    1.25 +    done
    1.26 +  done
    1.27 +done
    1.28 +for ii in /var/lib/tazpkg/installed ; do
    1.29 +  j=\$(dirname /usr/.moved\$ii)
    1.30 +  mkdir -p .\$j
    1.31 +  mv .\$ii .\$j
    1.32 +  ln -s /usr/.moved\$ii .\$ii
    1.33 +done
    1.34 +echo "\$(du -hs /usr/.moved | cut -f1) have been moved into /usr"
    1.35 +if [ -x usr/sbin/mksquashfs ]; then
    1.36 +  usr/sbin/mksquashfs usr ../rootcd/usr.sqfs
    1.37 +  rm -rf usr
    1.38 +  mkdir usr
    1.39 +else
    1.40 +  mv usr ../rootcd
    1.41 +  ln -s /cdrom/usr usr
    1.42 +  ln -s /bin ../rootcd/bin
    1.43 +fi
    1.44 +mkdir cdrom
    1.45 +COMPRESSION="gzip"
    1.46 +EOF
    1.47 +}
    1.48 +
    1.49 +get_patch()
    1.50 +{
    1.51 +    cat <<EOF
    1.52 +--- /etc/init.d/rcS
    1.53 ++++ /etc/init.d/rcS
    1.54 +@@ -54,4 +54,4 @@
    1.55 + #
    1.56 +-DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
    1.57 +-if [ ! "`readlink /dev/cdrom`" ]; then
    1.58 ++DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | busybox cut -f 3`
    1.59 ++if [ ! "`busybox readlink /dev/cdrom`" ]; then
    1.60 + 	echo -n "Creating symlink : /dev/cdrom..."
    1.61 +@@ -69,2 +69,12 @@
    1.62 + 
    1.63 ++# Mount /usr
    1.64 ++if [ -d /cdrom ]; then
    1.65 ++	echo -n "Mounting /usr read-only from /cdrom... "
    1.66 ++	/bin/mount -o ro -t iso9660 /dev/cdrom /cdrom
    1.67 ++	if [ -f /cdrom/usr.sqfs ]; then
    1.68 ++		/bin/mount -o loop,ro -t squashfs /cdrom/usr.sqfs /usr
    1.69 ++	fi
    1.70 ++	status 
    1.71 ++fi
    1.72 ++
    1.73 + # Handle kernel cmdline parameter modprobe=<module_list> 
    1.74 +EOF
    1.75 +}
    1.76 +
    1.77 +# Pre and post install commands for Tazpkg.
    1.78 +pre_install()
    1.79 +{
    1.80 +    local $loram
    1.81 +    loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null)
    1.82 +    [ -n "$loram" ] && yes y | tazpkg remove $loram
    1.83 +}
    1.84 +
    1.85 +post_install()
    1.86 +{
    1.87 +    get_patch | patch -p0
    1.88 +}
    1.89 +
    1.90 +# Pre remove commands for Tazpkg.
    1.91 +pre_remove()
    1.92 +{
    1.93 +    get_patch | patch -R -p0
    1.94 +}