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.

131 lines
3.3 KiB

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