home *** CD-ROM | disk | FTP | other *** search
- # /etc/build.u
- # Tue Nov 16 12:35:00 1993 CST
-
- # Save any special files before update just in case the user wants to
- # get the old ones back...
-
- # /etc/build does "/etc/build.u /mnt"
-
- . /usr/lib/shell_lib.sh
-
- MNT=$1
-
- if [ ! -d "$MNT" ]; then
- echo "$0: Can't access system directory \"$MNT\""
- exit 1
- fi
-
- /bin/echo "About to save old system files."
-
- # Older systems contain a /bin/shutdown so we need to move it
- # so 1) they can still shutdown if they abort and 2) it will
- # be overwritten by the update
-
- if [ -f /bin/shutdown ]
- then
- /bin/echo "Moving /bin/shutdown to /etc/shutdown...\n"
- mv /bin/shutdown /etc/shutdown
- fi
-
- # See if there is already an archive out there.
-
- SKIP_SAVE=n
-
- _ARCHIVE=old_coh.taz
- while [ -f $MNT/$_ARCHIVE ]; do
-
- echo "
- WARNING: Archive $_ARCHIVE already exists, probably has saved system
- files from a previous update.\n"
-
- read_input "Overwrite old archive $_ARCHIVE" \
- yesno "n" require_yes_or_no
-
- is_yes $yesno && break
-
- read_input "Skip saving system files" SKIP_SAVE "n" require_yes_or_no
-
- is_yes $SKIP_SAVE && {
- /bin/echo "System files not saved."
- break
- }
-
- read_input "Name for new save archive" _ARCHIVE
-
- done
-
- # Make list of files in upd_save which are on the present system.
-
- is_yes $SKIP_SAVE || {
- cd $MNT
- TMPLIST=/tmp/upd_save
- > $TMPLIST
- for F in $(cat /conf/upd_save); do
- for G in $(echo $F); do
- if [ -f $G ] ; then
- echo $G >> $TMPLIST
- fi
- done
- done
-
- # Use gtar to make the archive.
-
- cd $MNT
- echo "Saving files..."
- /usr/bin/gtar -czf $_ARCHIVE $(cat $TMPLIST)
- rm -f $TMPLIST
- sync
-
- # Sign-off.
-
- echo "Your system files are saved to $_ARCHIVE. After updating, you can type
- /usr/bin/gtar -tzf /$_ARCHIVE
- for a listing of saved files.
- Hit <Enter> "
- read JUNK
- }
-
- # Do conf-related cleanup during update.
-
- # Validation for new directory name entry.
- require_new_mnt () {
- if [ -d $MNT/$1 -o -f $MNT/$1 ]; then
- echo "$1 already exists. Please use a different name."
- return 1
- else
- return 0
- fi
- }
-
- # Remove old /conf/id-* files - they will just add to the confusion.
- /bin/rm -f $MNT/conf/id-cmd $MNT/conf/id-var
-
- # Fix permission problem in 4.0.1A
- /bin/chmog 755 bin bin $MNT/usr/include/sys
-
- # Default: rename etc/conf on MNT to OLD_CONF.
-
- SAV_CONF="etc/old_conf"
-
- ETC_CONF=etc/conf
- MNT_ETC_CONF=$MNT/$ETC_CONF
-
- # If etc/conf exists
- # If want to delete it
- # Delete old etc/conf
- # If want to rename it
- # Do forever
- # Get new name for etc/conf
- # If able to rename etc/conf, exit loop
- # Else report error
- # Done
- if [ -d $MNT_ETC_CONF ]; then
-
- echo "
- WARNING: Directory etc/conf already exists, probably has config
- files from a previous installation.\n"
-
- read_input "Delete config directory $ETC_CONF" \
- yesno "n" require_yes_or_no
-
- if is_yes $yesno; then
- /bin/echo "Deleting old config directory."
- /bin/rm -rf $MNT_ETC_CONF
- else
- while :; do
- /bin/echo "Will rename $ETC_CONF"
-
- read_input "New name" SAV_CONF $SAV_CONF \
- require_new_mnt
-
- MNT_SAV_CONF=$MNT/$SAV_CONF
- if /etc/mvdir $MNT_ETC_CONF $MNT_SAV_CONF; then
- break
- fi
- done
- fi
- fi
- sync
- exit 0
-