wok-stable view slitaz-loram-cdrom/stuff/loram.rootfs @ rev 4454

loram*: /etc/init.d/rcS needs find & xargs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Nov 08 12:55:54 2009 +0100 (2009-11-08)
parents 6509db5aa948
children 359526689366
line source
1 echo "$(du -hs /usr | cut -f1) were used by /usr"
2 for j in insmod unmkcromfs unsquashfs ; do
3 lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\ -f3 | \
4 while read ii; do
5 mv .${ii%%.so.*}.so* ./lib
6 done
7 done
8 for ii in /sbin /lib /bin; do
9 mkdir -p ./usr/.moved$ii
10 for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \
11 libcap; do
12 for k in $(grep -s ^$ii /var/lib/tazpkg/installed/$j/files.list) ; do
13 [ -f .$k ] || continue
14 mv .$k ./usr/.moved$k
15 ln -s /usr/.moved$k .$k
16 done
17 done
18 done
19 k="$(ls /lib/lib[rp]*.so)"
20 [ -x /bin/funionfs ] && k="$(ls /lib/libresolv*.so)"
21 for ii in /var/lib/tazpkg/installed /lib/modules/*/kernel/drivers/net \
22 /lib/modules/*/kernel/sound /sbin/depmod /sbin/modinfo /sbin/lsmod \
23 /lib/libns*.so $k; do
24 [ -L .$ii ] && continue
25 case "$ii" in
26 /lib/libnss_file*) continue;;
27 /lib/libpthread*) continue;;
28 esac
29 j=$(dirname /usr/.moved$ii)
30 mkdir -p .$j
31 mv .$ii .$j
32 ln -s /usr/.moved$ii .$ii
33 done
34 echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr"
35 usr=usr
36 if [ -x bin/funionfs -o -d /var/lib/tazpkg/installed/aufs ]; then
37 usr=.usr.ro
38 mkdir .usr.ro .usr.rw
39 fi
40 if [ -x bin/funionfs -o -x usr/bin/mkcromfs ]; then
41 ln -s /$usr/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2
42 fi
43 if [ -x usr/bin/mkcromfs ]; then
44 usr/bin/mkcromfs -qq -f 262144 -b 16384 usr ../rootcd/usr.cromfs
45 rm -rf usr
46 mkdir usr
47 for ii in unmkcromfs cromfs-driver ; do
48 mv bin/$ii ../rootcd
49 ln -s /cdrom/$ii bin/$ii
50 done
51 elif [ -x usr/sbin/mksquashfs ]; then
52 usr/sbin/mksquashfs usr ../rootcd/usr.sqfs
53 rm -rf usr
54 mkdir usr
55 else
56 mv usr ../rootcd
57 [ "$usr" = "usr" ] || mv $usr usr
58 ln -s /cdrom/usr $usr
59 fi
60 if [ -d ../rootcd/usr/lib ]; then
61 for ii in *; do
62 case "$ii" in
63 usr|boot|home) continue;;
64 mnt|media|sys|proc|cdrom) mkdir ../rootcd/$ii;;
65 *) cp -a $ii ../rootcd/$ii;;
66 esac
67 done
68 for ii in media/*; do
69 [ "$ii" = "media/cdrom" ] || mkdir ../rootcd/$ii
70 done
71 for ii in keymap.conf locale.conf resolv.conf TZ motd; do
72 rm -f ../rootcd/etc/$ii
73 ln -s /tmp/$ii ../rootcd/etc/$ii
74 done
75 ln -s /tmp/detected-modules ../rootcd/var/lib/detected-modules
76 for ii in log run lock; do
77 mv ../rootcd/var/$ii ../rootcd/var/$ii.ORG
78 ln -s /tmp ../rootcd/var/$ii
79 done
80 mv ../rootcd/root ../rootcd/root.ORG
81 ln -s /tmp ../rootcd/root
82 ln -s /tmp ../rootcd/home
83 ln -s / ../rootcd/media/cdrom
84 mkdir ../rootcd/mnt/target
85 sed -i 's/CLEAN_UP_SYSTEM="yes"/CLEAN_UP_SYSTEM="no"/' ../rootcd/etc/rcS.conf
86 sed -i 's/RUN_DAEMONS=.*/RUN_DAEMONS=""/' ../rootcd/etc/rcS.conf
87 for ii in ../rootcd/boot/isolinux/*.cfg; do
88 cat $ii | awk '{ print } /append/ { printf "label loram\n\tkernel /boot/bzImage\n\tappend ro sound=noconf screen=text %s %s %s\n",$5,$6,$7 }' > $ii.tmp
89 mv -f $ii.tmp $ii
90 done
91 cat >> ../rootcd/boot/isolinux/enopts.txt <<EOT
92 With few RAM, you can use loram entry with the cdrom device; example:
93 boot: loram root=/dev/hdc
94 EOT
95 cat >> ../rootcd/boot/isolinux/options.txt <<EOT
96 Avec peu de RAM, utilisez l'entrée loram en précisant le cdrom, exemple:
97 boot: loram root=/dev/hdc
98 EOT
99 fi
100 for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \
101 bin/killall5 bin/seq bin/find bin/xargs bin/patch; do
102 [ -e $ii ] || ln -s busybox $ii
103 done
104 mkdir cdrom
105 COMPRESSION="gzip"