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.

128 lines
3.6 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 - 2006 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. proc /proc proc defaults 0 0
  29. devpts /dev/pts devpts defaults 0 0
  30. tmpfs /dev/shm tmpfs defaults 0 0
  31. sysfs /sys sysfs defaults 0 0
  32. /dev/bus/usb /proc/bus/usb bind bind 0 0
  33. #tmpfs /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. [ -L "$x" ] && x="`readlink -f $x`"
  40. echo "$x $trg iso9660 ro,noauto 0 0" >> $tmp2
  41. fi
  42. done
  43. for x in /dev/floppy/[0-9] ; do
  44. if [ -e $x ] ; then
  45. trg=/mnt/floppy${x/*\//} ; trg=${trg/floppy0/floppy}
  46. mkdir -p $trg
  47. [ -L "$x" ] && x="`readlink -f $x`"
  48. echo "$x $trg auto sync,noauto 0 0" >> $tmp2
  49. fi
  50. done
  51. sed -e "s/ nfs [^ ]\+/ nfs rw/" < /etc/mtab | \
  52. sed "s/ rw,/ /; s/ rw / defaults /" >> $tmp2
  53. grep '^/dev/' /proc/swaps | cut -f1 -d' ' | \
  54. sed 's,$, swap swap defaults 0 0,' >> $tmp2
  55. cut -f2 -d' ' < $tmp2 | sort -u | while read dn ; do
  56. grep " $dn " $tmp2 | tail -n 1; done > $tmp1
  57. fsregex="$( echo -n $( ls /sbin/fsck.* | \
  58. cut -f2- -d. ) | sed 's, ,\\|,g' )"
  59. gawk '{ printf("%-58s %d %d\n",
  60. sprintf("%-45s ", sprintf("%-35s ",
  61. sprintf("%-20s ", $1) $2) $3) $4,
  62. $5, $6); }' < $tmp1 | \
  63. sed "/ \/[^ ].*\($fsregex\) / s, 0$, 1," > /etc/fstab
  64. tr ' ' '\240' < /etc/fstab > $tmp1
  65. gui_message $'Auto-created /etc/fstab file:\n\n'"$( cat $tmp1 )"
  66. rm -f $tmp1 $tmp2
  67. }
  68. set_rootpw() {
  69. if [ "$SETUPG" = dialog ] ; then
  70. tmp1="`mktemp`" ; tmp2="`mktemp`" ; rc=0
  71. gui_dialog --nocancel --passwordbox "Setting a root password. `
  72. `Type password:" 8 70 > $tmp1
  73. gui_dialog --nocancel --passwordbox "Setting a root password. `
  74. `Retype password:" 8 70 > $tmp2
  75. if [ -s $tmp1 ] && cmp -s $tmp1 $tmp2 ; then
  76. echo -n "root:" > $tmp1 ; echo >> $tmp2
  77. cat $tmp1 $tmp2 | chpasswd
  78. else
  79. gui_message "Password 1 and password 2 are `
  80. `not the same" ; rc=1
  81. fi
  82. rm $tmp1 $tmp2
  83. return $rc
  84. else
  85. passwd root
  86. return $?
  87. fi
  88. }
  89. main() {
  90. ldconfig
  91. export gui_nocancel=1
  92. make_fstab
  93. $STONE general set_keymap
  94. while ! set_rootpw; do :; done
  95. $STONE general set_tmarea
  96. $STONE general set_dtime
  97. $STONE general set_locale
  98. $STONE general set_vcfont
  99. # source postinstall scripts added by misc packages
  100. for x in ${SETUPD}/setup_*.sh ; do
  101. [ -f $x ] && . $x
  102. done
  103. # postinstall is called by cron.run / 00-updates - it wouldn't get
  104. # called at all if cron isn't installed, so let's call it at lease
  105. # once after installing / chrooting.
  106. if [ -n "`which cron.run`" ] ; then
  107. cron.run
  108. else
  109. postinstall -a
  110. fi
  111. unset gui_nocancel
  112. exec $STONE
  113. }