summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/initrd/common.sh46
1 files changed, 10 insertions, 36 deletions
diff --git a/src/initrd/common.sh b/src/initrd/common.sh
index 4aa8528..09906d9 100644
--- a/src/initrd/common.sh
+++ b/src/initrd/common.sh
@@ -17,17 +17,20 @@ debug_log()
17 set -x 17 set -x
18 fi 18 fi
19} 19}
20
20addmenu() 21addmenu()
21{ 22{
22 cat <<END >>$MENUFIFO # mind the tabs 23 cat <<END >>$MENUFIFO # mind the tabs
23setItem "$1" "dummy" "$2" "$3" 24setItem "$1" "dummy" "$2" "$3"
24END 25END
25} 26}
27
26menutitle() 28menutitle()
27{ 29{
28 printf 'setTitle "%s"\n' "$1" >>$MENUFIFO 30 printf 'setTitle "%s"\n' "$1" >>$MENUFIFO
29 printf 'setWelcomeText "%s"\n' "$2" >>$MENUFIFO 31 printf 'setWelcomeText "%s"\n' "$2" >>$MENUFIFO
30} 32}
33
31bootmenu() 34bootmenu()
32{ 35{
33 local do_trigger="$1" no_panic="$2" 36 local do_trigger="$1" no_panic="$2"
@@ -43,30 +46,7 @@ bootmenu()
43 udevadm trigger --subsystem-match=block --action=add 46 udevadm trigger --subsystem-match=block --action=add
44 fi 47 fi
45} 48}
46find_squashfs_root()
47{
48 # TODO: "make" puts the correct location in $iso_squashfs_dir. Get
49 # information into this function!
50 49
51 bootwait samizdat-cdrom
52 for dir in /cdrom/live /cdrom/liveos /cdrom/aptosid /cdrom/*
53 do
54 [ -d "$dir" ] || continue;
55 if [ -f "$dir"/filesystem.module ]; then
56 while read fs; do
57 [ -f "$dir"/"$fs" ] && echo "$dir" "$fs"
58 done < "$dir"/filesystem.module
59 return
60 fi
61 done
62 for fs in /cdrom/live/filesystem.squashfs /cdrom/live/grml-small.squashfs /cdrom/liveos/squashfs.img /cdrom/aptosid/aptosid.* /cdrom/*/*.squashfs
63 do
64 if [ -f "$fs" ]; then
65 echo "${fs%/*}" "${fs##*/}"
66 break
67 fi
68 done
69}
70xtrace() 50xtrace()
71{ 51{
72 case "$-" in 52 case "$-" in
@@ -74,6 +54,7 @@ xtrace()
74 *) set -x; "$@"; set +x ;; 54 *) set -x; "$@"; set +x ;;
75 esac 55 esac
76} 56}
57
77sleepcmd() { 58sleepcmd() {
78 local t=$1 59 local t=$1
79 shift 60 shift
@@ -81,13 +62,16 @@ sleepcmd() {
81 sleep $t 62 sleep $t
82 "$@" 63 "$@"
83} 64}
65
84sleep_forever_verbose() { 66sleep_forever_verbose() {
85 sleep 4294967295 & 67 sleep 4294967295 &
86 local sleep=$! 68 local sleep=$!
87 warn "sleeping until you kill $sleep..." 69 warn "sleeping until you kill $sleep..."
88 wait $sleep 70 wait $sleep
89} 71}
72
90warn() { [ -z "$warnings" ] || echo "$@" >&2; } 73warn() { [ -z "$warnings" ] || echo "$@" >&2; }
74
91panic() 75panic()
92{ 76{
93 set +x 77 set +x
@@ -99,6 +83,7 @@ panic()
99 chvt 1 83 chvt 1
100 exec /bin/sh -i 84 exec /bin/sh -i
101} 85}
86
102bootwait() 87bootwait()
103{ 88{
104 mkdir -p /bootwait 89 mkdir -p /bootwait
@@ -108,6 +93,7 @@ bootwait()
108 done 93 done
109 wait_for_files "$@" 94 wait_for_files "$@"
110} 95}
96
111bootdone() 97bootdone()
112{ 98{
113 mkdir -p /bootwait 99 mkdir -p /bootwait
@@ -117,6 +103,7 @@ bootdone()
117 done 103 done
118 touch "$@" 104 touch "$@"
119} 105}
106
120my_openvt() 107my_openvt()
121{ 108{
122 /bin/openvt -c "$@" 109 /bin/openvt -c "$@"
@@ -128,16 +115,3 @@ gpg2_nobatch() { GPG_TTY=$(tty) command gpg2 --ignore-time-conflict --ignore-val
128gpg2() { gpg2_nobatch --batch "$@"; } 115gpg2() { gpg2_nobatch --batch "$@"; }
129 116
130xcp() { if [ -f "$1" -a ! -f "$2" ]; then cp "$1" "$2"; fi; } 117xcp() { if [ -f "$1" -a ! -f "$2" ]; then cp "$1" "$2"; fi; }
131
132mountsquashes()
133{
134 local name dirname basename
135 while read dirname basename && [ -d "$dirname" -a -f "$dirname/$basename" ]; do
136 name=${basename%.squashfs}
137 mkdir -p "/squashes/$name" || return 1
138 xcp "$dirname"/filesystem.module /squashes/filesystem.module || return 1
139 mountpoint -q "/squashes/$name" ||
140 mount -o ro,loop "$dirname/$basename" "/squashes/$name" || return 1
141 done
142}
143