* updated firefox (133.0.3 -> 134.0.2)
[t2sde.git] / package / boot / silo / stone_mod_silo.sh
blob014f9f86fb5122615760ed3ee78660ce360f39ae
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/silo/stone_mod_silo.sh
3 # Copyright (C) 2004 - 2025 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 # [MAIN] 70 silo SILO Boot Loader Setup
13 # [SETUP] 90 silo
15 create_kernel_list() {
16 local first=1
17 for x in `(cd /boot/; ls vmlinuz-*) | sort -Vr`; do
18 if [ $first = 1 ]; then
19 label=linux first=0
20 else
21 label=linux-${x/vmlinuz-/}
23 ver=${x/vmlinuz-}
24 cat << EOT
26 image=$bootpath/$x
27 label=$label
28 root=$rootdev
29 initrd=$bootpath/initrd-${ver}
30 read-only
31 EOT
32 done
35 create_silo_conf() {
36 cat << EOT > /boot/silo.conf
38 # /boot/silo.conf created with the T2 SDE SILO STONE module
40 root=$bootdev
42 # Second silo image chooser delay
43 timeout=80
45 EOT
47 create_kernel_list >> /boot/silo.conf
49 gui_message "This is the new /boot/silo.conf file:
51 $( cat /boot/silo.conf )"
54 silo_install()
56 gui_cmd 'Installing SILO' "echo 'calling silo'; silo -C /boot/silo.conf"
59 device4()
61 local dev="`grep \" $1 \" /proc/mounts | tail -n 1 |
62 cut -d ' ' -f 1`"
63 if [ ! "$dev" ]; then # try the higher dentry
64 local try="`dirname $1`"
65 dev="`grep \" $try \" /proc/mounts | tail -n 1 | \
66 cut -d ' ' -f 1`"
68 if [ -h "$dev" ]; then
69 echo "/dev/`readlink $dev`"
70 else
71 echo $dev
75 realpath() {
76 dir="`dirname $1`"
77 file="`basename $1`"
78 dir="`dirname $dir`/`readlink $dir`"
79 dir="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
80 echo $dir/$file
83 main() {
84 rootdev="`device4 /`"
85 bootdev="`device4 /boot`"
87 if [ "$rootdev" = "$bootdev" ]
88 then bootpath=/boot; else bootpath=""; fi
90 if [ ! -f /boot/silo.conf ]; then
91 if gui_yesno "SILO does not appear to be configured.
92 Automatically install SILO now?"; then
93 create_silo_conf
94 if ! silo_install; then
95 gui_message "There was an error while installing SILO."
100 while
102 gui_menu yaboot 'SILO Boot Loader Setup' \
103 "Root Device ........... $rootdev" "" \
104 "Boot Device ........... $bootdev" "" \
105 "Boot Path ............. $bootpath" "" \
106 '' '' \
107 '(Re-)Create silo.conf with installed kernels' 'create_silo_conf' \
108 '(Re-)Install SILO' 'silo_install' \
109 '' '' \
110 "Edit /boot/silo.conf (Config file)" \
111 "gui_edit 'STONE Configuration' /boot/silo.conf"
112 do : ; done