#! /bin/ksh # # This script does some preliminary checks to ensure that the USER that # invoked the script has proper priv's and that the Tru64 UNIX version # is at the required 5.1 and checks for a previous RPM installation # on the system. Once these prerequisites have been met, the script will either # restore the RPM archive and initialize the new RPM database (if no prior rpm), # or, if an rpm 2.5 installation is found, prompts the user to upgrade rpm, # and upgrade previously installed packages to the newer versions. # if [[ $1 = "" ]] then MOUNT_location=/mnt else MOUNT_location=$1 fi # # First let's make sure we have superuser privilege # if [ `whoami` != "root" ] then echo "You must be superuser to run this script" echo "Exiting RPM-init script." echo exit 1 fi # # We need to ensure that it's a V5.1* system... # OS_VERSION=`/usr/sbin/sizer -v | cut -d" " -f 4 | cut -b 2-5` if [[ $OS_VERSION < "5.1" ]] then echo "You need Tru64 UNIX V5.1 or V5.1A to install any of the" echo "rpm kits from this CD-ROM!" echo "Please refer to the /mnt/README file for instructions" echo exit 1 fi # Before we go any further, let's check for the incompatible gnome # packages from the original Linux Affinity distribution. No point # in echoing a lot of verbiage if we need to exit out later, # The shared libraries new as of the OSSC V5.1A SP1 kit are incompatible # with the older versions required by the first release of the # "Linux Affinity CD-ROM kit". We have even attempted to use "--force" # for the zlib installation. We were only successful in so far as # making rpm "happy", however the gnome application(s) would no longer # function. The following test will query for ANY gnome package from # the first Linux Affinity kit, and if found, will exit this script # with a message to the user. Gnome_list="gnome-core-1.4.0.4-3" if [[ -f /usr/local/bin/rpm ]] then for i in $Gnome_list do if /usr/local/bin/rpm -q $i > /dev/null 2>&1 then found_gnome_package=1 fi done fi if [[ $found_gnome_package -eq 1 ]] then echo echo " N O T I C E ! !" echo echo "An gnome rpm package from the original \"Linux and Tru64" echo "UNIX Affinity Toolkit\" distribution was found in your" echo "rpm database!" echo echo "The new versions of shared libraries installed by this" echo "mandatory script would render your gnome installation" echo "unusable." echo echo "You will not be able to use this procedure until updated" echo "versions of the gnome rpm packages are installed." echo echo "A new version of the gnome rpms (compatible with this" echo "OSSC kit) is now available from:" echo echo "http://www.tru64unix.compaq.com/affinity/" echo echo "Exiting RPM-init script..." echo exit 1 fi # # Now let's check for a prior RPM installation # if /usr/local/bin/rpm -qa > /dev/null 2>&1 then if /usr/local/bin/rpm --version |grep 2.5 > /dev/null 2>&1 then echo echo echo echo " This script will upgrade an rpm version 2.5 installation to" echo " rpm version 3.0.2, and will upgrade all rpm packages that" echo " have been installed from the V5.0 release to the newer" echo " versions. If a prior rpm version 3.0.2 installation is found" echo " it will upgrade any packages that have been installed from" echo " the V5.0A, or V5.1 OSSC releases." echo echo " This script will NOT install any of the rpm packages that are" echo " new to this distribution, nor will it install any packages that" echo " have not previously been installed." echo echo " In order to add packages new to this kit you may either execute" echo " /mnt/SETUP/tachometer install-all or invoke the individual" echo " package installations with:" echo echo " /mnt/SETUP/tachometer install " echo echo " after the completion of this script." echo echo " As with any system software installation," echo " BE SURE TO PERFORM BACKUPS before proceeding with this procedure." echo echo echo "Do you want to continue? [y/n]: \c" read answer echo if [ "$answer" = "n" ] || [ "$answer" = "N" ] then echo "Exiting RPM-init script..." exit fi if [ "$answer" != "y" -a "$answer" != "Y" ] then echo "Response $answer is not recognized, " echo "Exiting RPM-init script..." echo exit 1 fi # if we get here, then we have an rpm 2.5 installation, and the user # is satisfied with system backups... $MOUNT_location/SETUP/upgrade-rpm.ksh "$MOUNT_location" "Disclaimer" echo "Exiting RPM-init script..." exit fi fi # # If we get this far, we can assume that there is not an RPM 2.5 installation, however, # it is possible that the /usr/local/bin/rpm binary file might exist if there is an # "interim" version of RPM installed. Because our version of the installation places # the RPM database in /usr/local/lib/rpm instead of the default /var/local/lib/rpm, # We could easily run into trouble. A "non-standard" RPM installation will likely # include some "non-standard" package files (which we have no possibility of upgrading). ... # if /usr/local/bin/rpm -qa > /dev/null 2>&1 then if /usr/local/bin/rpm --version |grep 3.0.2 > /dev/null 2>&1 then echo echo echo echo " This script will save and replace your /etc/rpmrc file" echo " and will upgrade all rpm packages that have been installed" echo " from the OSSC V5.0/V5.0A/V5.1/V5.1A releases to the newer" echo " versions." echo echo " With required exceptions noted in the top level README file," echo " this script will NOT install any of the rpm packages that are" echo " new to this distribution, nor will it install any packages that" echo " have not previously been installed." echo echo " In order to add packages new to this kit you may either execute" echo " /mnt/SETUP/tachometer install-all or invoke the individual" echo " package installations with:" echo echo " /mnt/SETUP/tachometer install " echo echo " after the completion of this script." echo echo " As with any system software installation," echo " BE SURE TO PERFORM BACKUPS before proceeding with this procedure." echo echo echo "Do you want to continue? [y/n]: \c" read answer echo if [ "$answer" = "n" ] || [ "$answer" = "N" ] then echo "Exiting RPM-init script..." exit fi if [ "$answer" != "y" -a "$answer" != "Y" ] then echo "Response $answer is not recognized, " echo "Exiting RPM-init script..." echo exit 1 fi # if we get here, then we have an rpm 3.0.2 installation, and the user # is satisfied with system backups... $MOUNT_location/SETUP/upgrade-rpm.ksh "$MOUNT_location" "Disclaimer" echo "Exiting RPM-init script..." exit fi fi # There have been some modifications to the /etc/rpmrc file since the V5.1 release # of this kit. The $MOUNT_location/SETUP/upgrade-packages.ksh will ensure that # the latest one is copied (in the event of a prior RPM installation). # # The following file is the default location if not overridden in /etc/rpmrc # if [[ -f /var/local/lib/rpm/packages.rpm ]] then echo "A Non-OSSC RPM installation appears to be installed on this system" echo echo "Found a /var/local/lib/rpm/packages.rpm file..." echo echo "Please refer to the /mnt/README file for instructions" echo "Exiting RPM-init script." echo exit 1 fi # # If we get this far, chances are very good that there isn't a previous RPM # installation. # # # We need to make sure that we can find the RPM archive... # if [[ ! -f $MOUNT_location/SETUP/rpm3.0.2archive.tar.gz ]] then echo "Unable to locate the $MOUNT_location/SETUP/rpm3.0.2archive.tar.gz file !" echo "Please ensure that this CD-ROM is mounted on /mnt" echo "OR pass the (alternate) mount point as the first parameter" echo "to this script" echo echo "Exiting RPM-init script." echo exit 1 fi # # We must have located the file, so let's restore the RPM archive. # echo "Restoring the rpmkit archive..." echo # # The rpm3.0.2archive.tar.gz file was created from "/", so there is no need # to change our current working directory # /usr/bin/gzip -dc $MOUNT_location/SETUP/rpm3.0.2archive.tar.gz | tar xpf - # lets rename the following file & directory: # mv /etc/rpmrc-3.0.2 /etc/rpmrc # # The /etc/rpmrc-3.0.2 file has become obsolete, but is still in the archive. # since we now use $MOUNT_location/SETUP/rpmrc, lets remove the rpmrc-3.0.2 # file from /etc rm /etc/rpmrc-3.0.2 cp $MOUNT_location/SETUP/rpmrc /etc/rpmrc mv /etc/rpm-tmp /etc/rpm # # Lastly let's initialize the RPM database # echo "initializing your new rpm database..." echo /usr/local/bin/rpm --initdb echo echo "Finished installing RPM on your system." echo