slitaz-modular view initramfs/init @ rev 175

initramfs: Add new linux-live scripts support.
author Christopher Rogers <slaxemulator@gmail.com>
date Wed Mar 13 17:07:55 2013 +0000 (2013-03-13)
parents d31b9a880249
children
line source
1 #!/bin/sh
2 # Initial script for Linux Live Kit
3 # Author: Tomas M <http://www.linux-live.org/>
5 export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
7 source /lib/.config
8 source /lib/livekitlib
10 transfer_initramfs
12 MEMORY=/memory
13 CHANGES=$MEMORY/changes
14 UNION=$MEMORY/union
15 DATAMNT=$MEMORY/data
16 BUNDLES=$MEMORY/bundles
18 header "Live Kit init <http://www.linux-live.org/>"
20 init_proc_sysfs
22 debug_start
23 debug_shell
25 init_devs
26 init_aufs
27 init_zram
29 # find data dir with filesystem bundles
30 DATA="$(find_data 60 "$DATAMNT")"
31 debug_shell
33 # setup persistent changes, if possible
34 persistent_changes "$DATA" "$CHANGES"
35 debug_shell
37 # copy to RAM if needed
38 DATA="$(copy_to_ram "$DATA" "$CHANGES")"
39 debug_shell
41 # init aufs union
42 init_union "$CHANGES" "$UNION"
43 debug_shell
45 echo "Copying initramfs to /initramfs"
46 copy_initramfs /initramfs
48 # setup initramfs if it exist
49 if [ -d /initramfs ]; then
50 echo "Setup initramfs for first module..."
51 mount -n -o remount,add:1:/initramfs=ro aufs $UNION
52 fi
53 debug_shell
55 # add data to union
56 union_append_bundles "$DATA" "$BUNDLES" "$UNION"
57 debug_shell
59 # rootcopy
60 copy_rootcopy_content "$DATA" "$UNION"
62 # create empty fstab
63 fstab_create "$UNION"
64 debug_shell
66 if [ -d $DATAMNT/mirror ]; then
67 echolog "Setup repo for mirror iso..."
68 mount -n -o remount,add:1:/$DATAMNT/mirror=ro aufs $UNION
69 fi
71 header "Live Kit done, starting $LIVEKITNAME"
73 change_root "$UNION"
75 header "!!ERROR occured, you shouldn't be here.!!"
76 /bin/sh