wok-current view slitaz-loram-cdrom/receipt @ rev 1954
nscd: add /usr/bin/getent
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Dec 30 14:40:42 2008 +0000 (2008-12-30) |
parents | 4aeb7e80b8ca |
children | d37cb8649ac6 |
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram-cdrom"
4 VERSION="1.4"
5 CATEGORY="misc"
6 SHORT_DESC="Rules to build low ram system using cdrom."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 WEB_SITE="http://www.slitaz.org/"
10 # Rules to gen a SliTaz package suitable for Tazpkg.
11 genpkg_rules()
12 {
13 mkdir -p $fs/etc/tazlito
14 cp stuff/loram.* $fs/etc/tazlito
15 }
17 set_patch()
18 {
19 local tag
20 local line
21 local i
22 tag="Handle kernel cmdline parameter config"
23 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
24 i=$(($i-1))
25 tag=$(grep "$tag" $1/etc/init.d/rcS)
26 if [ "$2" = "-R" ]; then
27 line="-$(($i-53)),55 +$(($i-53)),2"
28 i="-"
29 else
30 grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
31 line="-$i,2 +$i,55"
32 i="+"
33 fi
34 patch -p0 <<EOF
35 --- $1/etc/init.d/rcS
36 +++ $1/etc/init.d/rcS
37 @@ $line @@
39 $i# Try to release the cdrom (from slitaz-loram-cdrom package)
40 $i release_cdrom()
41 $i {
42 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
43 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
44 $i cp -a \$FS /.usr.fs
45 $i status
46 $i echo -n "Releasing CD-ROM..."
47 $i umount /cdrom
48 $i FS=/.usr.fs
49 $i return 0
50 $i fi
51 $i return 1
52 $i }
53 $i
54 $i# Mount /usr (from slitaz-loram-cdrom package)
55 $i if [ -d /cdrom ]; then
56 $i mount -o ro -t iso9660 /dev/cdrom /cdrom
57 $i if [ -d /.usr.rw ]; then
58 $i echo -n "Mounting /usr read-write... "
59 $i usr=.usr.ro
60 $i else
61 $i echo -n "Mounting /usr read-only... "
62 $i usr=usr
63 $i fi
64 $i FS=/cdrom/usr.cromfs
65 $i if [ -f \$FS ]; then
66 $i release_cdrom
67 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
68 $i elif [ -f /cdrom/usr.sqfs ]; then
69 $i FS=/cdrom/usr.sqfs
70 $i release_cdrom
71 $i mount -o loop,ro -t squashfs \$FS /\$usr
72 $i elif [ -L /\$usr ]; then
73 $i FS=/cdrom/usr
74 $i if release_cdrom; then
75 $i rm -f /\$usr
76 $i mv \$FS /usr
77 $i fi
78 $i else
79 $i umount /cdrom
80 $i false
81 $i fi
82 $i status
83 $i if [ -d /.usr.rw ]; then
84 $i if [ -x /bin/funionfs ]; then
85 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
86 $i else
87 $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
88 $i fi
89 $i fi
90 $i fi
91 $i
92 $tag
93 EOF
94 tag="/var/log/dmesg.log"
95 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
96 i=$(($i-1))
97 tag=$(grep "$tag" $1/etc/init.d/rcS)
98 if [ "$2" = "-R" ]; then
99 line="-$(($i-7)),9 +$(($i-7)),2"
100 i="-"
101 else
102 line="-$i,2 +$i,9"
103 i="+"
104 fi
105 patch -p0 <<EOF
106 --- $1/etc/init.d/rcS
107 +++ $1/etc/init.d/rcS
108 @@ $line @@
110 $i# Build ramdisk if root=/dev/cdrom (from slitaz-loram-cdrom package)
111 $i if [ -L /root ]; then
112 $i mount -t tmpfs ramdisk /tmp
113 $i mkdir -p /tmp/log/lighttpd /tmp/run /tmp/lock
114 $i chown www.www /tmp/log/lighttpd
115 $i fi
116 $i
117 $tag
118 EOF
119 chmod 0755 $1/etc/init.d/rcS
120 }
122 # Pre and post install commands for Tazpkg.
123 pre_install()
124 {
125 local i
126 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
127 [ "$i" = "$PACKAGE" ] && continue
128 yes y | tazpkg remove $i
129 . /etc/tazlito/tazlito.conf
130 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
131 done
132 }
134 post_install()
135 {
136 set_patch "$1"
137 if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs ]; then
138 cat <<EOF
139 ----
140 You will build a live CD with /usr mounted read-only.
141 You can install aufs or funionfs to have read-write access into /usr with:
143 # tazpkg get-install aufs
144 or
145 # tazpkg get-install funionfs
147 EOF
148 fi
149 }
151 # Pre remove commands for Tazpkg.
152 pre_remove()
153 {
154 set_patch '' -R
155 }