wok-4.x annotate 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 |
rev | line source |
---|---|
pascal@251 | 1 # SliTaz package receipt. |
pascal@251 | 2 |
pascal@251 | 3 PACKAGE="slitaz-loram-cdrom" |
pascal@251 | 4 VERSION="1.0" |
pascal@251 | 5 CATEGORY="misc" |
pascal@251 | 6 SHORT_DESC="Rules to build low ram system using cdrom." |
pascal@251 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@251 | 8 |
pascal@251 | 9 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@251 | 10 genpkg_rules() |
pascal@251 | 11 { |
pascal@251 | 12 mkdir -p $fs/etc/tazlito |
pascal@251 | 13 cat > $fs/etc/tazlito/loram.rootfs << EOF |
pascal@251 | 14 echo "\$(du -hs /usr | cut -f1) were used by /usr" |
pascal@251 | 15 for ii in /sbin /lib /bin; do |
pascal@251 | 16 mkdir -p ./usr/.moved\$ii |
pascal@251 | 17 for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses; do |
pascal@251 | 18 for k in \$(grep ^\$ii /var/lib/tazpkg/installed/\$j/files.list) ; do |
pascal@251 | 19 [ -f .\$k ] || continue |
pascal@251 | 20 mv .\$k ./usr/.moved\$k |
pascal@251 | 21 ln -s /usr/.moved\$k .\$k |
pascal@251 | 22 done |
pascal@251 | 23 done |
pascal@251 | 24 done |
pascal@251 | 25 for ii in /var/lib/tazpkg/installed ; do |
pascal@251 | 26 j=\$(dirname /usr/.moved\$ii) |
pascal@251 | 27 mkdir -p .\$j |
pascal@251 | 28 mv .\$ii .\$j |
pascal@251 | 29 ln -s /usr/.moved\$ii .\$ii |
pascal@251 | 30 done |
pascal@251 | 31 echo "\$(du -hs /usr/.moved | cut -f1) have been moved into /usr" |
pascal@251 | 32 if [ -x usr/sbin/mksquashfs ]; then |
pascal@251 | 33 usr/sbin/mksquashfs usr ../rootcd/usr.sqfs |
pascal@251 | 34 rm -rf usr |
pascal@251 | 35 mkdir usr |
pascal@251 | 36 else |
pascal@251 | 37 mv usr ../rootcd |
pascal@251 | 38 ln -s /cdrom/usr usr |
pascal@251 | 39 ln -s /bin ../rootcd/bin |
pascal@251 | 40 fi |
pascal@251 | 41 mkdir cdrom |
pascal@251 | 42 COMPRESSION="gzip" |
pascal@251 | 43 EOF |
pascal@251 | 44 } |
pascal@251 | 45 |
pascal@251 | 46 get_patch() |
pascal@251 | 47 { |
pascal@251 | 48 cat <<EOF |
pascal@251 | 49 --- /etc/init.d/rcS |
pascal@251 | 50 +++ /etc/init.d/rcS |
pascal@251 | 51 @@ -54,4 +54,4 @@ |
pascal@251 | 52 # |
pascal@251 | 53 -DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` |
pascal@251 | 54 -if [ ! "`readlink /dev/cdrom`" ]; then |
pascal@251 | 55 +DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | busybox cut -f 3` |
pascal@251 | 56 +if [ ! "`busybox readlink /dev/cdrom`" ]; then |
pascal@251 | 57 echo -n "Creating symlink : /dev/cdrom..." |
pascal@251 | 58 @@ -69,2 +69,12 @@ |
pascal@251 | 59 |
pascal@251 | 60 +# Mount /usr |
pascal@251 | 61 +if [ -d /cdrom ]; then |
pascal@251 | 62 + echo -n "Mounting /usr read-only from /cdrom... " |
pascal@251 | 63 + /bin/mount -o ro -t iso9660 /dev/cdrom /cdrom |
pascal@251 | 64 + if [ -f /cdrom/usr.sqfs ]; then |
pascal@251 | 65 + /bin/mount -o loop,ro -t squashfs /cdrom/usr.sqfs /usr |
pascal@251 | 66 + fi |
pascal@251 | 67 + status |
pascal@251 | 68 +fi |
pascal@251 | 69 + |
pascal@251 | 70 # Handle kernel cmdline parameter modprobe=<module_list> |
pascal@251 | 71 EOF |
pascal@251 | 72 } |
pascal@251 | 73 |
pascal@251 | 74 # Pre and post install commands for Tazpkg. |
pascal@251 | 75 pre_install() |
pascal@251 | 76 { |
pascal@251 | 77 local $loram |
pascal@251 | 78 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null) |
pascal@251 | 79 [ -n "$loram" ] && yes y | tazpkg remove $loram |
pascal@251 | 80 } |
pascal@251 | 81 |
pascal@251 | 82 post_install() |
pascal@251 | 83 { |
pascal@251 | 84 get_patch | patch -p0 |
pascal@251 | 85 } |
pascal@251 | 86 |
pascal@251 | 87 # Pre remove commands for Tazpkg. |
pascal@251 | 88 pre_remove() |
pascal@251 | 89 { |
pascal@251 | 90 get_patch | patch -R -p0 |
pascal@251 | 91 } |