home *** CD-ROM | disk | FTP | other *** search
- :
- #
- # @(#) prep.xsrvr 1.25 91/11/15
- #
- # Define return values
- : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
-
- # Define traps for critical and non critical code.
- trap 'echo "\nInterrupted! Exiting ..."; cleanup $FAIL' 1 2 3 15
-
- tmp=/tmp/xx$$
- LIBDIR=/usr/lib/X11
-
- # Files and dirs to back up.
- BUFILES="$LIBDIR/fonts/misc/fonts.alias \
- $LIBDIR/fonts/100dpi/fonts.alias \
- $LIBDIR/fonts/75dpi/fonts.alias \
- $LIBDIR/rgb.txt "
-
- BUDIRS="/usr/lib/grafinfo \
- $LIBDIR/keymaps \
- $LIBDIR/csxmaps \
- $LIBDIR/xsconfig "
-
- # Files and dirs to remove.
- RMFILES="/usr/lib/grafinfo/moninfo \
- $LIBDIR/.Xsight.cfg \
- /usr/bin/X11/Xsight \
- /usr/lib/vidconf/devices \
- /usr/man/cat.X/Xsco.X.z \
- /usr/man/cat.X/X.X.z \
- /usr/man/cat.X/bdftosnf.X.z \
- /usr/man/cat.X/mkfntdir.X.z \
- /usr/man/cat.X/mkfontdir.X.z \
- /usr/man/cat.X/rgb.X.z \
- /usr/man/cat.X/showrgb.X.z \
- /usr/man/cat.X/xinit.X.z \
- /usr/man/cat.X/xmodmap.X.z \
- /usr/man/cat.X/showsnf.X.z \
- /usr/man/cat.X/startx.X.z \
- /usr/man/cat.X/clnscrn.X.z \
- /usr/man/cat.X/xswkey.X.z \
- /usr/man/cat.X/xsconfig.X.z \
- /usr/man/cat.X/xset.X.z \
- /usr/man/cat.X/xhost.X.z \
- /usr/man/cat.X/xauth.X.z"
-
- # Functions --
- # cleanup() --
- # Remove temp files and exit with the status passed as argument
- # Usage: cleanup status
- # References: $tmp indicates prefix of files to remove
- # Notes: cleanup exits with whatever value it is passed.
- #
- cleanup()
- {
- trap '' 1 2 3 15
- [ "$tmp" ] && rm -f $tmp*
- exit $1
- }
-
- #
- # create a heirarchy of directories (mkdir that makes everything)
- #
- mkdirhier()
- {
- for f in $*; do
- parts=`echo $f | sed 's,\(.\)/\(.\),\1 \2,g' | sed 's,/$,,'`;
- path="";
- for p in $parts; do
- if [ x"$path" = x ]; then
- dir=$p;
- else
- dir=$path/$p;
- fi;
- if [ ! -d $dir ]; then
- #echo mkdir $dir;
- mkdir $dir;
- chmod a+rx $dir;
- fi;
- path=$dir;
- done;
- done
- dir=""
- }
-
- # main()
- #
- # verify that the system is in single user mode
- # Note: cant run grep in a pipe, as it'll (the string 'getty')
- # then show up on the ps output, so do it to a tmp file.
- ps -ealf > $tmp
- grep getty $tmp >/dev/null 2>&1
- [ $? -eq 0 ] && {
- echo "
- Error: This product must be installed in single user mode,
- exit from custom and type 'init 1'.
- When the system is down to single user mode,
- you may proceed with the custom installation of this product.
- "
- cleanup $FAIL
- }
-
- # remove some files that we don't want around.
- for f in $RMFILES ; do
- [ -f $f -o -d $f ] && rm -rf $f;
- done
-
- #
- # If the CONFIG_SAVE var is not set, set it to /usr/lib/custom/save
- # so that we can save some files for the user.
- # In the InPlace Upgrade environment, it will be set to a dir for us to
- # copy the old user config files into.
- [ -z "$CONFIG_SAVE" ] && {
- CONFIG_SAVE=/usr/lib/custom/save
- }
-
- # Set up the directory to copy saved ODT-View files in to.
- DEST=$CONFIG_SAVE/xsight
- COPY="copy -r"
-
- # do the saving of dirs
- for d in $BUDIRS ; do
- [ -d $d ] && {
- mkdirhier $DEST$d
- $COPY $d $DEST$d
- # remove the original
- rm -rf $d
- }
- done
-
- # Saving of files for InPlace Upgrade
- for file in $BUFILES
- do
- [ -f $file ] && {
- mkdirhier $DEST`dirname $file`
- $COPY $file $DEST$file
- # remove the original
- rm -f $file
- }
- done
-
- cleanup $OK
-