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.

123 lines
3.3 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_setup.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. #
  23. # This module should only be executed once directly after the installation
  24. make_fstab() {
  25. tmp1=`mktemp` ; tmp2=`mktemp`
  26. cat > $tmp2 <<- EOT
  27. /dev/root / auto defaults 0 0
  28. none /proc proc defaults 0 0
  29. none /dev devfs defaults 0 0
  30. none /dev/pts devpts defaults 0 0
  31. none /dev/shm ramfs defaults 0 0
  32. #none /tmp tmpfs defaults 0 0
  33. EOT
  34. for x in /dev/cdroms/cdrom[0-9] ; do
  35. if [ -e $x ] ; then
  36. mkdir -p /mnt/${x/*\//}
  37. echo "$x /mnt/${x/*\//} iso9660 ro,noauto 0 0" >> $tmp2
  38. fi
  39. done
  40. for x in /dev/floppy/[0-9] ; do
  41. if [ -e $x ] ; then
  42. mkdir -p /mnt/floppy${x/*\//}
  43. echo "$x /mnt/floppy${x/*\//} auto sync,noauto 0 0" >> $tmp2
  44. fi
  45. done
  46. sed -e "s/ nfs [^ ]\+/ nfs rw/" < /etc/mtab | \
  47. sed "s/ rw,/ /; s/ rw / defaults /" >> $tmp2
  48. grep '^/dev/' /proc/swaps | cut -f1 -d' ' | \
  49. sed 's,$, swap swap defaults 0 0,' >> $tmp2
  50. cut -f2 -d' ' < $tmp2 | sort -u | while read dn ; do
  51. grep " $dn " $tmp2 | tail -1; done > $tmp1
  52. cat << 'EOT' > $tmp2
  53. ARGIND == 1 {
  54. for (c=1; c<=NF; c++) if (ss[c] < length($c)) ss[c]=length($c);
  55. }
  56. ARGIND == 2 {
  57. for (c=1; c<NF; c++) printf "%-*s",ss[c]+2,$c;
  58. printf "%s\n",$NF;
  59. }
  60. EOT
  61. gawk -f $tmp2 $tmp1 $tmp1 | \
  62. sed 's,\( ext[23] .*\) 0 0$,\1 0 1,' > /etc/fstab
  63. while read a b c d e f ; do
  64. printf "%-60s %s\n" "$(
  65. printf "%-50s %s" "$(
  66. printf "%-40s %s" "$(
  67. printf "%-25s %s" "$a" "$b"
  68. )" $c
  69. )" "$d"
  70. )" "$e $f"
  71. done < /etc/fstab | tr ' ' '\240' > $tmp1
  72. gui_message $'Auto-created /etc/fstab file:\n\n'"$( cat $tmp1 )"
  73. rm -f $tmp1 $tmp2
  74. }
  75. set_rootpw() {
  76. if [ "$SETUPG" = dialog ] ; then
  77. tmp1="`mktemp`" ; tmp2="`mktemp`" ; rc=0
  78. gui_dialog --nocancel --passwordbox "Setting a root password. `
  79. `Type password:" 8 70 > $tmp1
  80. gui_dialog --nocancel --passwordbox "Setting a root password. `
  81. `Retype password:" 8 70 > $tmp2
  82. if [ -s $tmp1 ] && cmp -s $tmp1 $tmp2 ; then
  83. echo -n "root:" > $tmp1 ; echo >> $tmp2
  84. cat $tmp1 $tmp2 | chpasswd
  85. else
  86. gui_message "Password 1 and password 2 are `
  87. `not the same" ; rc=1
  88. fi
  89. rm $tmp1 $tmp2
  90. return $rc
  91. else
  92. passwd root
  93. return $?
  94. fi
  95. }
  96. main() {
  97. ldconfig
  98. export gui_nocancel=1
  99. make_fstab
  100. $STONE general set_keymap
  101. while ! set_rootpw; do :; done
  102. $STONE general set_tmzone
  103. $STONE general set_dtime
  104. $STONE general set_locale
  105. cron.run
  106. unset gui_nocancel
  107. exec $STONE
  108. }