diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-02 23:53:35 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-02 23:53:35 +0000 |
commit | 9ea26feb2bf820138f3125fe5abe998d4e100694 (patch) | |
tree | 318d83ecb0b3f5618e1a5c8c2717058fa0e7c90e /distrib | |
parent | 4bbf86fd4f660f7d945809fd560f6582c1ce4fac (diff) |
Nuke sissy verbiage about losing data. No more special casing for
restarted installs/upgrades. They should just work the same as first
attempts except for presenting some remembered info as default
answers.
ok deraadt@
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sh | 232 | ||||
-rw-r--r-- | distrib/miniroot/install.sub | 39 |
2 files changed, 123 insertions, 148 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh index 4c2574e5921..c470b5383db 100644 --- a/distrib/miniroot/install.sh +++ b/distrib/miniroot/install.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sh,v 1.198 2009/06/01 02:57:40 krw Exp $ +# $OpenBSD: install.sh,v 1.199 2009/06/02 23:53:34 krw Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback @@ -63,126 +63,126 @@ MODE=install # include common subroutines and initialization code . install.sub -# If /etc/fstab already exists, skip disk initialization. cd /tmp -if [[ ! -f /etc/fstab ]]; then - DISK= - _DKDEVS=$(get_dkdevs) - - while :; do - _DKDEVS=$(rmel "$DISK" $_DKDEVS) - - # Always do ROOTDISK first, and repeat until it is configured. - if isin $ROOTDISK $_DKDEVS; then - resp=$ROOTDISK - rm -f fstab - # Make sure empty files exist so we don't have to - # keep checking for their existence before grep'ing. - else - # Force the user to think and type in a disk name by - # making 'done' the default choice. - ask_which "disk" "do you wish to initialize" "$_DKDEVS" done - [[ $resp == done ]] && break - fi - - DISK=$resp - makedev $DISK || continue - - # Deal with disklabels, including editing the root disklabel - # and labeling additional disks. This is machine-dependent since - # some platforms may not be able to provide this functionality. - # fstab.$DISK is created here with 'disklabel -f'. - rm -f *.$DISK - AUTOROOT=n - md_prep_disklabel $DISK || { DISK= ; continue ; } - - # Make sure there is a '/' mount point. - grep -qs " / ffs " fstab.$ROOTDISK || \ - { DISK= ; echo "'/' must be configured!" ; continue ; } - - if [[ -f fstab.$DISK ]]; then - # Avoid duplicate mount points on different disks. - while read _pp _mp _rest; do - [[ fstab.$DISK == $(grep -l " $_mp " fstab.*) ]] || \ - { _rest=$DISK ; DISK= ; break ; } - done <fstab.$DISK - if [[ -z $DISK ]]; then - # Allow disklabel(8) to read mountpoint info. - cat fstab.$_rest >/etc/fstab - rm fstab.$_rest - set -- $(grep " $_mp " fstab.*[0-9]) - echo "$_pp and $1 can't both be mounted at $_mp." - continue - fi - - # newfs 'ffs' filesystems and add them to the list. - _i=${#_fsent[*]} - while read _pp _mp _rest; do - _OPT= - [[ $_mp == / ]] && _OPT=$MDROOTFSOPT - newfs -q $_OPT ${_pp##/dev/} - # N.B.: '!' is lexically < '/'. That is - # required for correct sorting of - # mount points. - _fsent[$_i]="$_mp!$_pp" - : $(( _i += 1 )) - done <fstab.$DISK +DISK= +_DKDEVS=$(get_dkdevs) + +# Remove traces of previous install attempt. +umount -a +rm -f /tmp/fstab.shadow /tmp/fstab /tmp/fstab.* + +while :; do + _DKDEVS=$(rmel "$DISK" $_DKDEVS) + + # Always do ROOTDISK first, and repeat until it is configured. + if isin $ROOTDISK $_DKDEVS; then + resp=$ROOTDISK + rm -f fstab + # Make sure empty files exist so we don't have to + # keep checking for their existence before grep'ing. + else + # Force the user to think and type in a disk name by + # making 'done' the default choice. + ask_which "disk" "do you wish to initialize" "$_DKDEVS" done + [[ $resp == done ]] && break + fi + + DISK=$resp + makedev $DISK || continue + + # Deal with disklabels, including editing the root disklabel + # and labeling additional disks. This is machine-dependent since + # some platforms may not be able to provide this functionality. + # fstab.$DISK is created here with 'disklabel -f'. + rm -f *.$DISK + AUTOROOT=n + md_prep_disklabel $DISK || { DISK= ; continue ; } + + # Make sure there is a '/' mount point. + grep -qs " / ffs " fstab.$ROOTDISK || \ + { DISK= ; echo "'/' must be configured!" ; continue ; } + + if [[ -f fstab.$DISK ]]; then + # Avoid duplicate mount points on different disks. + while read _pp _mp _rest; do + [[ fstab.$DISK == $(grep -l " $_mp " fstab.*) ]] || \ + { _rest=$DISK ; DISK= ; break ; } + done <fstab.$DISK + if [[ -z $DISK ]]; then + # Allow disklabel(8) to read mountpoint info. + cat fstab.$_rest >/etc/fstab + rm fstab.$_rest + set -- $(grep " $_mp " fstab.*[0-9]) + echo "$_pp and $1 can't both be mounted at $_mp." + continue fi - # New swap partitions? - disklabel $DISK 2>&1 | sed -ne \ - "/^ *\([a-p]\): .* swap /s,,/dev/$DISK\1 none swap sw 0 0,p" | \ - grep -v "^/dev/$SWAPDEV " >>fstab - done - - # Write fstab entries to fstab in mount point alphabetic order - # to enforce a rational mount order. - for _mp in $(bsort ${_fsent[*]}); do - _pp=${_mp##*!} - _mp=${_mp%!*} - echo -n "$_pp $_mp ffs rw" - - # Only '/' is neither nodev nor nosuid. i.e. it can obviously - # *always* contain devices or setuid programs. - [[ $_mp == / ]] && { echo " 1 1" ; continue ; } - - # Every other mounted filesystem is nodev. If the user chooses - # to mount /dev as a separate filesystem, then on the user's - # head be it. - echo -n ",nodev" - - # The only directories that the install puts suid binaries into - # (as of 3.2) are: - # - # /sbin - # /usr/bin - # /usr/sbin - # /usr/libexec - # /usr/libexec/auth - # /usr/X11R6/bin - # - # and ports and users can do who knows what to /usr/local and - # sub directories thereof. - # - # So try to ensure that only filesystems that are mounted at - # or above these directories can contain suid programs. In the - # case of /usr/libexec, give blanket permission for - # subdirectories. - case $_mp in - /sbin|/usr) ;; - /usr/bin|/usr/sbin) ;; - /usr/libexec|/usr/libexec/*) ;; - /usr/local|/usr/local/*) ;; - /usr/X11R6|/usr/X11R6/bin) ;; - *) echo -n ",nosuid" ;; - esac - echo " 1 2" - done >>fstab - - munge_fstab -fi + # newfs 'ffs' filesystems and add them to the list. + _i=${#_fsent[*]} + while read _pp _mp _rest; do + _OPT= + [[ $_mp == / ]] && _OPT=$MDROOTFSOPT + newfs -q $_OPT ${_pp##/dev/} + # N.B.: '!' is lexically < '/'. That is + # required for correct sorting of + # mount points. + _fsent[$_i]="$_mp!$_pp" + : $(( _i += 1 )) + done <fstab.$DISK + fi + + # New swap partitions? + disklabel $DISK 2>&1 | sed -ne \ + "/^ *\([a-p]\): .* swap /s,,/dev/$DISK\1 none swap sw 0 0,p" | \ + grep -v "^/dev/$SWAPDEV " >>fstab +done + +# Write fstab entries to fstab in mount point alphabetic order +# to enforce a rational mount order. +for _mp in $(bsort ${_fsent[*]}); do + _pp=${_mp##*!} + _mp=${_mp%!*} + echo -n "$_pp $_mp ffs rw" + + # Only '/' is neither nodev nor nosuid. i.e. it can obviously + # *always* contain devices or setuid programs. + [[ $_mp == / ]] && { echo " 1 1" ; continue ; } + + # Every other mounted filesystem is nodev. If the user chooses + # to mount /dev as a separate filesystem, then on the user's + # head be it. + echo -n ",nodev" + + # The only directories that the install puts suid binaries into + # (as of 3.2) are: + # + # /sbin + # /usr/bin + # /usr/sbin + # /usr/libexec + # /usr/libexec/auth + # /usr/X11R6/bin + # + # and ports and users can do who knows what to /usr/local and + # sub directories thereof. + # + # So try to ensure that only filesystems that are mounted at + # or above these directories can contain suid programs. In the + # case of /usr/libexec, give blanket permission for + # subdirectories. + case $_mp in + /sbin|/usr) ;; + /usr/bin|/usr/sbin) ;; + /usr/libexec|/usr/libexec/*) ;; + /usr/local|/usr/local/*) ;; + /usr/X11R6|/usr/X11R6/bin) ;; + *) echo -n ",nosuid" ;; + esac + echo " 1 2" +done >>fstab cd / +munge_fstab mount_fs "-o async" install_sets diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 826331c5f29..abca60339b3 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.568 2009/06/02 22:44:27 krw Exp $ +# $OpenBSD: install.sub,v 1.569 2009/06/02 23:53:34 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback @@ -95,8 +95,6 @@ set_term() { } welcome() { - local _q - cat <<__EOT Welcome to the $OBSD $MODE program. @@ -109,44 +107,21 @@ inconsistent state. __EOT - case $MODE in - upgrade) + if [[ $MODE == upgrade ]]; then cat <<__EOT -IS YOUR DATA BACKED UP? Upgrades are never as simple as they seem. While -carefully designed, this process could lead to SIGNIFICANT data loss. - NOTE: Once your system has been upgraded, you must manually merge any -changes to files in the 'etc' set into the files already on your system, -perhaps using the sysmerge(8) command. +changes to files in the 'etc' set into the files already on your system. +sysmerge(8) can help. __EOT - _q="Proceed with upgrade?" - ;; - - install) - if [ -f /etc/fstab ]; then - cat <<__EOT -You seem to be trying to restart an interrupted installation! You can skip -the disk preparation steps and continue, or you can reboot and start over. - -__EOT - _q="Skip disk initialization?" - else - cat <<__EOT -If you change your mind and do not want to install, type Control-C now -and then type 'reboot' at the command prompt. -__EOT - return - fi - ;; - esac + fi - [[ -n $_q ]] && ask_yn "$_q" + ask_yn "Proceed with $MODE?" if [[ $resp == n ]]; then cat <<__EOT - Remove your install media (if any), and enter 'reboot' at the command prompt to return to your original OS. + __EOT exit fi |