* updated knights (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / hppa / palo / stone_mod_palo.sh
blobc97d89b10e7635903890b048b54ba2061b22118b
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/*/palo/stone_mod_palo.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 palo PALO Setup
16 # [SETUP] 90 palo
18 install_palo() {
19 palo -U "${bootdev%[0-9]*}"
22 create_kernel_list() {
23 first=1
24 echo "--format-as=3"
25 local part="${bootdev%[0-9]*}"
26 part="${bootdev#$part}"
27 for x in `(cd /boot/; ls vmlinux-*) | sort -r`; do
28 [ $first = 0 ] && continue
29 ver=${x/vmlinux-}
30 echo "--commandline=$part/$x initrd=$part/initrd-${ver} root=$rootdev"
31 first=0
32 done
35 create_palo_conf() {
36 create_kernel_list > $rootpath/etc/palo.conf
38 gui_message "This is the new $rootpath/etc/palo.conf file:
40 $(< $rootpath/etc/palo.conf)"
43 device4() {
44 local dev="`sed -n "s,\([^ ]*\) $1 .*,\1,p" /etc/fstab | tail -n 1`"
45 if [ ! "$dev" ]; then # try the higher dentry
46 local try="`dirname $1`"
47 dev="`grep \" $try \" /etc/fstab | tail -n 1 | \
48 cut -d ' ' -f 1`"
50 if [ -h "$dev" ]; then
51 echo "/dev/`readlink $dev`"
52 else
53 echo $dev
57 realpath() {
58 dir="`dirname $1`"
59 file="`basename $1`"
60 dir="`dirname $dir`/`readlink $dir`"
61 dir="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
62 echo $dir/$file
65 main() {
66 rootdev="`device4 /`"
67 bootdev="`device4 /boot`"
69 [ "$rootdev" = "$bootdev" ] && bootpath="/boot"
71 if [ ! -f $rootpath/etc/palo.conf ]; then
72 if gui_yesno "PALO does not appear to be configured.
73 Automatically configure PALO now?"; then
74 create_palo_conf && install_palo
78 while
80 gui_menu palo 'PALO Setup' \
81 "Following settings only for expert use: (default)" "" \
82 "Root Device ........... $rootdev" "" \
83 "Boot Device ........... $bootdev" "" \
84 '' '' \
85 "(Re-)Create default $rootpath/etc/palo.conf" 'create_palo_conf' \
86 '(Re-)Install PALO into the IPL' 'install_palo' \
87 '' '' \
88 "Edit $bootpath/palo.conf (Config file)" \
89 "gui_edit 'PALO Configuration' $rootpath/etc/palo.conf"
90 do : ; done