mirror of the now-defunct rocklinux.org
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.

184 lines
5.0 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/sysfiles/stone_mod_install.sh
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. part_mounted_action() {
  23. if gui_yesno "Do you want to un-mount the filesystem on $1/$2?"
  24. then umount /dev/$1/$2; fi
  25. }
  26. part_swap_action() {
  27. if gui_yesno "Do you want to de-activate the swap space on $1/$2?"
  28. then swapoff /dev/$1/$2; fi
  29. }
  30. part_mount() {
  31. local dir
  32. gui_input "Mount device $1/$2 on directory" '' dir
  33. if [ "$dir" ] ; then
  34. dir="$( echo $dir | sed 's,^/*,,; s,/*$,,' )"
  35. if [ -z "$dir" ] || grep -q " /mnt/target " /proc/mounts
  36. then
  37. mkdir -p /mnt/target/$dir
  38. mount /dev/$1/$2 /mnt/target/$dir
  39. else
  40. gui_message "Please mount a root filesystem first."
  41. fi
  42. fi
  43. }
  44. part_mkfs() {
  45. cmd="gui_menu part_mkfs 'Create filesystem on $1/$2'"
  46. cmd="$cmd 'ext2fs (non-journaling fs)'"
  47. cmd="$cmd 'mke2fs /dev/$1/$2'"
  48. cmd="$cmd 'ext3fs (journaling filesystem)'"
  49. cmd="$cmd 'mke2fs -j /dev/$1/$2'"
  50. cmd="$cmd 'reiserfs (journaling filesystem)'"
  51. cmd="$cmd 'mkreiserfs /dev/$1/$2'"
  52. cmd="$cmd 'IBM JFS (journaling filesystem)'"
  53. cmd="$cmd 'jfs_mkfs /dev/$1/$2'"
  54. cmd="$cmd 'SGI XFS (journaling filesystem)'"
  55. cmd="$cmd 'mkfs.xfs /dev/$1/$2'"
  56. eval "$cmd" && part_mount $1 $2
  57. }
  58. part_unmounted_action() {
  59. gui_menu part "$1/$2" \
  60. "Create a filesystem on the partition" \
  61. "part_mkfs $1 $2" \
  62. "Mount an existing filesystem from the partition" \
  63. "part_mount $1 $2" \
  64. "Create a swap space on the partition" \
  65. "mkswap /dev/$1/$2; swapon /dev/$1/$2" \
  66. "Activate an existing swap space on the partition" \
  67. "swapon /dev/$1/$2"
  68. }
  69. part_add() {
  70. local action="unmounted" location="currently not mounted"
  71. if grep -q "^/dev/$1/$2 " /proc/swaps; then
  72. action=swap ; location="swap <no mount point>"
  73. elif grep -q "^/dev/$1/$2 " /proc/mounts; then
  74. action=mounted
  75. location="`grep "^/dev/$1/$2 " /proc/mounts | cut -d ' ' -f 2 | \
  76. sed "s,^/mnt/target,," `"
  77. [ "$location" ] || location="/"
  78. fi
  79. type="`disktype /dev/$1/$2 | \
  80. grep -v -e '^ ' -e '^Block device' -e '^Partition' -e '^---' | \
  81. sed -e 's/[,(].*//' -e '/^$/d' -e 's/ $//' | tail -1`"
  82. [ "$type" ] || type="undetected"
  83. cmd="$cmd '`printf "%-8s %-24s" $2 "$location"` ($type)' 'part_${action}_action $1 $2'"
  84. }
  85. disk_action() {
  86. if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then
  87. gui_message "Partitions from $1 are currently in use, so you
  88. can't modify this disks partition table."
  89. return
  90. fi
  91. cmd="gui_menu disk 'Edit partition table of $1'"
  92. for x in cfdisk fdisk pdisk mac-fdisk ; do
  93. fn=""
  94. [ -f /bin/$x ] && fn="/bin/$x"
  95. [ -f /sbin/$x ] && fn="/sbin/$x"
  96. [ -f /usr/bin/$x ] && fn="/usr/bin/$x"
  97. [ -f /usr/sbin/$x ] && fn="/usr/sbin/$x"
  98. [ "$fn" ] && \
  99. cmd="$cmd \"Edit partition table using '$x'\" \"$x /dev/$1/disc\""
  100. done
  101. eval $cmd
  102. }
  103. disk_add() {
  104. local x y=0
  105. cmd="$cmd 'Partition table of $1:' 'disk_action $1'"
  106. for x in $( cd /dev/$1 ; ls part* 2> /dev/null )
  107. do
  108. part_add $1 $x ; y=1
  109. done
  110. if [ $y = 0 ]; then
  111. cmd="$cmd 'Partition table is empty.' ''"
  112. fi
  113. cmd="$cmd '' ''"
  114. }
  115. main() {
  116. local cmd install_now=0
  117. while
  118. cmd="gui_menu install 'Installing ROCK Linux
  119. Note: Everything you can do using this tool can also be done manualy
  120. on the command line.'"
  121. # protect for the case no discs where found ...
  122. if [ -e /dev/discs ] ; then
  123. for x in $( cd /dev/discs
  124. ls -l * | grep ' -> ' | cut -f2- -d/ ; )
  125. do
  126. disk_add $x
  127. done
  128. else
  129. cmd="$cmd 'No hard-disc found!' ''"
  130. fi
  131. cmd="$cmd 'Install the system ...'"
  132. cmd="$cmd 'install_now=1'"
  133. eval "$cmd" && [ "$install_now" -eq 0 ]
  134. do : ; done
  135. if [ "$install_now" -ne 0 ] ; then
  136. $STONE packages
  137. cat > /mnt/target/tmp/stone_postinst.sh << EOT
  138. #!/bin/sh
  139. mount -v /dev
  140. mount -v /proc
  141. . /etc/profile
  142. stone setup
  143. umount -v /dev
  144. umount -v /proc
  145. EOT
  146. chmod +x /mnt/target/tmp/stone_postinst.sh
  147. grep ' /mnt/target[/ ]' /proc/mounts | \
  148. sed 's,/mnt/target/\?,/,' > /mnt/target/etc/mtab
  149. cd /mnt/target ; chroot . ./tmp/stone_postinst.sh
  150. rm -fv ./tmp/stone_postinst.sh
  151. echo
  152. echo "You might want to umount all filesystems now and reboot"
  153. echo "the system now using the commands:"
  154. echo
  155. echo " umount -arv"
  156. echo " reboot -f"
  157. echo
  158. echo "Or by executing 'shutdown' which will run the above commands."
  159. echo
  160. fi
  161. }