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.

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