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.

117 lines
2.6 KiB

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