OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.6 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../silo/stone_mod_silo.sh
  5. # Copyright (C) 2004 - 2006 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 ---
  14. #
  15. # [MAIN] 70 silo SILO Boot Loader Setup
  16. # [SETUP] 90 silo
  17. create_kernel_list() {
  18. first=1
  19. for x in `(cd /boot/ ; ls vmlinux_* ) | sort -r` ; do
  20. if [ $first = 1 ] ; then
  21. label=linux ; first=0
  22. else
  23. label=linux-${x/vmlinux_/}
  24. fi
  25. ver=${x/vmlinux_}
  26. cat << EOT
  27. image=$bootpath/$x
  28. label=$label
  29. root=$rootdev
  30. initrd=$bootpath/initrd-${ver}.img
  31. read-only
  32. EOT
  33. done
  34. }
  35. create_silo_conf() {
  36. cat << EOT > /etc/silo.conf
  37. # /etc/silo.conf created with the T2 SDE SILO STONE module
  38. root=$bootdev
  39. # Second silo image chooser delay
  40. timeout=80
  41. EOT
  42. create_kernel_list >> /etc/silo.conf
  43. gui_message "This is the new /etc/silo.conf file:
  44. $( cat /etc/silo.conf )"
  45. }
  46. silo_install()
  47. {
  48. gui_cmd 'Installing SILO' "echo 'calling silo' ; silo"
  49. }
  50. device4()
  51. {
  52. local dev="`sed -n 's,\([^ ]*\) / .*,\1,p' /proc/mounts | tail -n 1`"
  53. if [ ! "$dev" ] ; then # try the higher dentry
  54. local try="`dirname $1`"
  55. dev="`grep \" $try \" /proc/mounts | tail -n 1 | \
  56. cut -d ' ' -f 1`"
  57. fi
  58. if [ -h "$dev" ] ; then
  59. echo "/dev/`readlink $dev`"
  60. else
  61. echo $dev
  62. fi
  63. }
  64. realpath() {
  65. dir="`dirname $1`"
  66. file="`basename $1`"
  67. dir="`dirname $dir`/`readlink $dir`"
  68. dir="`echo $dir | sed 's,[^/]*/\.\./,,g'`"
  69. echo $dir/$file
  70. }
  71. main() {
  72. rootdev="`device4 /`"
  73. bootdev="`device4 /boot`"
  74. if [ "$rootdev" = "$bootdev" ]
  75. then bootpath=/boot ; else bootpath="" ; fi
  76. if [ ! -f /etc/silo.conf ] ; then
  77. if gui_yesno "SILO does not appear to be configured.
  78. Automatically install SILO now?"; then
  79. create_silo_conf
  80. if ! silo_install; then
  81. gui_message "There was an error while installing SILO."
  82. fi
  83. fi
  84. fi
  85. while
  86. gui_menu yaboot 'SILO Boot Loader Setup' \
  87. "Root Device ........... $rootdev" "" \
  88. "Boot Device ........... $bootdev" "" \
  89. "Boot Path ............. $bootpath" "" \
  90. '' '' \
  91. '(Re-)Create silo.conf with installed kernels' 'create_silo_conf' \
  92. '(Re-)Install SILO' 'silo_install' \
  93. '' '' \
  94. "Edit /etc/silo.conf (Config file)" \
  95. "gui_edit 'STONE Configuration' /etc/silo.conf"
  96. do : ; done
  97. }