OpenSDE Packages Database (without history before r20070)
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.

130 lines
3.3 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../stone/stone_mod_setup.sh
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. #
  16. # This module should only be executed once directly after the installation
  17. make_fstab() {
  18. tmp1=`mktemp` ; tmp2=`mktemp`
  19. cat <<- EOT > $tmp2
  20. /dev/root / auto defaults 0 0
  21. none /proc proc defaults 0 0
  22. none /dev devfs defaults 0 0
  23. none /dev/pts devpts defaults 0 0
  24. none /dev/shm tmpfs defaults 0 0
  25. none /sys sysfs defaults 0 0
  26. none /tmp tmpfs defaults 0 0
  27. EOT
  28. for x in /dev/cdroms/cdrom[0-9] ; do
  29. if [ -e $x ] ; then
  30. trg=/mnt/${x/*\//} ; trg=${trg/cdrom0/cdrom}
  31. mkdir -p $trg
  32. echo "$x $trg iso9660 ro,noauto 0 0" >> $tmp2
  33. fi
  34. done
  35. for x in /dev/floppy/[0-9] ; do
  36. if [ -e $x ] ; then
  37. trg=/mnt/floppy${x/*\//} ; trg=${trg/floppy0/floppy}
  38. mkdir -p $trg
  39. echo "$x $trg auto sync,noauto 0 0" >> $tmp2
  40. fi
  41. done
  42. sed -e "s/ nfs [^ ]\+/ nfs rw/" < /etc/mtab | \
  43. sed "s/ rw,/ /; s/ rw / defaults /" >> $tmp2
  44. grep '^/dev/' /proc/swaps | cut -f1 -d' ' | \
  45. sed 's,$, swap swap defaults 0 0,' >> $tmp2
  46. cut -f2 -d' ' < $tmp2 | sort -u | while read dn ; do
  47. grep " $dn " $tmp2 | tail -n 1; done > $tmp1
  48. cat << EOT > $tmp2
  49. ARGIND == 1 {
  50. for (c=1; c<=NF; c++) if (ss[c] < length(\$c)) ss[c]=length(\$c);
  51. }
  52. ARGIND == 2 {
  53. for (c=1; c<NF; c++) printf "%-*s",ss[c]+2,\$c;
  54. printf "%s\n",\$NF;
  55. }
  56. EOT
  57. gawk -f $tmp2 $tmp1 $tmp1 | \
  58. sed 's,\( ext[23] .*\) 0 0$,\1 0 1,' > /etc/fstab
  59. while read a b c d e f ; do
  60. printf "%-60s %s\n" "$(
  61. printf "%-50s %s" "$(
  62. printf "%-40s %s" "$(
  63. printf "%-25s %s" "$a" "$b"
  64. )" $c
  65. )" "$d"
  66. )" "$e $f"
  67. done < /etc/fstab | tr ' ' '\240' > $tmp1
  68. gui_message $'Auto-created /etc/fstab file:\n\n'"$( cat $tmp1 )"
  69. rm -f $tmp1 $tmp2
  70. }
  71. set_rootpw() {
  72. if [ "$SETUPG" = dialog ] ; then
  73. tmp1="`mktemp`" ; tmp2="`mktemp`" ; rc=0
  74. gui_dialog --nocancel --passwordbox "Setting a root password. `
  75. `Type password:" 8 70 > $tmp1
  76. gui_dialog --nocancel --passwordbox "Setting a root password. `
  77. `Retype password:" 8 70 > $tmp2
  78. if [ -s $tmp1 ] && cmp -s $tmp1 $tmp2 ; then
  79. echo -n "root:" > $tmp1 ; echo >> $tmp2
  80. cat $tmp1 $tmp2 | chpasswd
  81. else
  82. gui_message "Password 1 and password 2 are `
  83. `not the same" ; rc=1
  84. fi
  85. rm $tmp1 $tmp2
  86. return $rc
  87. else
  88. passwd root
  89. return $?
  90. fi
  91. }
  92. main() {
  93. ldconfig
  94. export gui_nocancel=1
  95. make_fstab
  96. $STONE general set_keymap
  97. while ! set_rootpw; do :; done
  98. unset gui_nocancel
  99. # run the stone modules that registered itself for the first SETUP pass
  100. while read -u 200 a b c cmd ; do
  101. $STONE $cmd
  102. done 200< <( grep -h '^# \[SETUP\] [0-9][0-9] ' \
  103. $SETUPD/mod_*.sh | sort )
  104. cron.run
  105. # run the postinstall scripts right here
  106. for x in /etc/postinstall.d/* ; do
  107. [ -f $x ] || continue
  108. echo "Running $x ..."
  109. $x
  110. done
  111. exec $STONE
  112. }