Dash:
[t2.git] / package / boot / arcload / stone_mod_arcload.sh
blob5938782a0001245caa76ea95b9b8100bcb20e5f7
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/*/arcload/stone_mod_arcload.sh
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License. A copy of the
12 # GNU General Public License can be found in the file COPYING.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 # [MAIN] 70 arcload Arcload Setup
16 # [SETUP] 90 arcload
18 install_arcload() {
19 dvhtool -d "${bootdev%[0-9]*}" --unix-to-vh /boot/arcload sash64
22 create_kernel_list() {
23 first=1
24 for x in `(cd /boot/; ls vmlinux-*) | sort -r`; do
25 if [ $first = 1 ]; then
26 label=t2sde; first=0
27 else
28 label=t2sde-${x/vmlinux-/}
30 ver=${x/vmlinux-}
31 cat << EOT
32 $label {
33 image system "$bootpath/$x";
34 #initrd system "$bootpath/initrd-${ver}";
35 append "root=$rootdev";
37 EOT
38 done
41 create_arcload_conf() {
42 create_kernel_list > $bootpath/arc.cf
44 gui_message "This is the new $bootpath/arc.cf file:
46 $(< $bootpath/arc.cf)"
49 device4() {
50 local dev="`sed -n "s,\([^ ]*\) $1 .*,\1,p" /etc/fstab | tail -n 1`"
51 if [ ! "$dev" ]; then # try the higher dentry
52 local try="`dirname $1`"
53 dev="`grep \" $try \" /etc/fstab | tail -n 1 | \
54 cut -d ' ' -f 1`"
56 if [ -h "$dev" ]; then
57 echo "/dev/`readlink $dev`"
58 else
59 echo $dev
63 realpath() {
64 dir="`dirname $1`"
65 file="`basename $1`"
66 dir="`dirname $dir`/`readlink $dir`"
67 dir="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
68 echo $dir/$file
71 main() {
72 rootdev="`device4 /`"
73 bootdev="`device4 /boot`"
75 [ "$rootdev" = "$bootdev" ] && bootpath="/boot"
77 if [ ! -f $bootpath/arc.cf ]; then
78 if gui_yesno "Arcload does not appear to be configured.
79 Automatically configure Arcload now?"; then
80 create_arcload_conf && install_arcload
84 while
86 gui_menu arcload 'Arcload Setup' \
87 "Following settings only for expert use: (default)" "" \
88 "Root Device ........... $rootdev" "" \
89 "Boot Device ........... $bootdev" "" \
90 '' '' \
91 "(Re-)Create default $bootpath/arc.cf" 'create_arcload_conf' \
92 '(Re-)Install Arcload into the VH' 'install_arcload' \
93 '' '' \
94 "Edit $bootpath/arc.cf (Config file)" \
95 "gui_edit 'Arcload Configuration' $bootpath/arc.cf"
96 do : ; done