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.

180 lines
4.8 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. cmd="$cmd '`printf "%-8s" $2` $location' 'part_${action}_action $1 $2'"
  80. }
  81. disk_action() {
  82. if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then
  83. gui_message "Partitions from $1 are currently in use, so you
  84. can't modify this disks partition table."
  85. return
  86. fi
  87. cmd="gui_menu disk 'Edit partition table of $1'"
  88. for x in cfdisk fdisk pdisk mac-fdisk ; do
  89. fn=""
  90. [ -f /bin/$x ] && fn="/bin/$x"
  91. [ -f /sbin/$x ] && fn="/sbin/$x"
  92. [ -f /usr/bin/$x ] && fn="/usr/bin/$x"
  93. [ -f /usr/sbin/$x ] && fn="/usr/sbin/$x"
  94. [ "$fn" ] && \
  95. cmd="$cmd \"Edit partition table using '$x'\" \"$x /dev/$1/disc\""
  96. done
  97. eval $cmd
  98. }
  99. disk_add() {
  100. local x y=0
  101. cmd="$cmd 'Partition table of $1:' 'disk_action $1'"
  102. for x in $( cd /dev/$1 ; ls part* 2> /dev/null )
  103. do
  104. part_add $1 $x ; y=1
  105. done
  106. if [ $y = 0 ]; then
  107. cmd="$cmd 'Partition table is empty.' ''"
  108. fi
  109. cmd="$cmd '' ''"
  110. }
  111. main() {
  112. local cmd install_now=0
  113. while
  114. cmd="gui_menu install 'Installing ROCK Linux
  115. Note: Everything you can do using this tool can also be done manualy
  116. on the command line.'"
  117. # protect for the case no discs where found ...
  118. if [ -e /dev/discs ] ; then
  119. for x in $( cd /dev/discs
  120. ls -l * | grep ' -> ' | cut -f2- -d/ ; )
  121. do
  122. disk_add $x
  123. done
  124. else
  125. cmd="$cmd 'No hard-disc found!' ''"
  126. fi
  127. cmd="$cmd 'Install the system ...'"
  128. cmd="$cmd 'install_now=1'"
  129. eval "$cmd" && [ "$install_now" -eq 0 ]
  130. do : ; done
  131. if [ "$install_now" -ne 0 ] ; then
  132. $STONE packages
  133. cat > /mnt/target/tmp/stone_postinst.sh << EOT
  134. #!/bin/sh
  135. mount -v /dev
  136. mount -v /proc
  137. . /etc/profile
  138. stone setup
  139. umount -v /dev
  140. umount -v /proc
  141. EOT
  142. chmod +x /mnt/target/tmp/stone_postinst.sh
  143. grep ' /mnt/target[/ ]' /proc/mounts | \
  144. sed 's,/mnt/target/\?,/,' > /mnt/target/etc/mtab
  145. cd /mnt/target ; chroot . ./tmp/stone_postinst.sh
  146. rm -fv ./tmp/stone_postinst.sh
  147. echo
  148. echo "You might want to umount all filesystems now and reboot"
  149. echo "the system now using the commands:"
  150. echo
  151. echo " umount -arv"
  152. echo " reboot -f"
  153. echo
  154. echo "Or by executing 'shutdown' which will run the above commands."
  155. echo
  156. fi
  157. }