diff options
Diffstat (limited to 'src/initrd/common.sh')
-rw-r--r-- | src/initrd/common.sh | 46 |
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 | |||
20 | addmenu() | 21 | addmenu() |
21 | { | 22 | { |
22 | cat <<END >>$MENUFIFO # mind the tabs | 23 | cat <<END >>$MENUFIFO # mind the tabs |
23 | setItem "$1" "dummy" "$2" "$3" | 24 | setItem "$1" "dummy" "$2" "$3" |
24 | END | 25 | END |
25 | } | 26 | } |
27 | |||
26 | menutitle() | 28 | menutitle() |
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 | |||
31 | bootmenu() | 34 | bootmenu() |
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 | } |
46 | find_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 | } | ||
70 | xtrace() | 50 | xtrace() |
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 | |||
77 | sleepcmd() { | 58 | sleepcmd() { |
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 | |||
84 | sleep_forever_verbose() { | 66 | sleep_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 | |||
90 | warn() { [ -z "$warnings" ] || echo "$@" >&2; } | 73 | warn() { [ -z "$warnings" ] || echo "$@" >&2; } |
74 | |||
91 | panic() | 75 | panic() |
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 | |||
102 | bootwait() | 87 | bootwait() |
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 | |||
111 | bootdone() | 97 | bootdone() |
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 | |||
120 | my_openvt() | 107 | my_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 | |||
128 | gpg2() { gpg2_nobatch --batch "$@"; } | 115 | gpg2() { gpg2_nobatch --batch "$@"; } |
129 | 116 | ||
130 | xcp() { if [ -f "$1" -a ! -f "$2" ]; then cp "$1" "$2"; fi; } | 117 | xcp() { if [ -f "$1" -a ! -f "$2" ]; then cp "$1" "$2"; fi; } |
131 | |||
132 | mountsquashes() | ||
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 | |||