#!/bin/ksh # set -x # # First let's make sure we have superuser privilege # (although it's already performed in the calling # RPM-init.ksh script) # if [ `whoami` != "root" ] then echo "You must be superuser to run this script" exit 1 fi if [[ $1 = "" ]] then MOUNT_location=/mnt else MOUNT_location=$1 fi setup_location=$MOUNT_location/SETUP kit_location=$MOUNT_location/RPMS/alpha # PLEASE NOTE that the list of possible gnome packages (incompatible # with the new libraries in this OSSC kit) is checked for # in the calling RPM-init script, which will terminate if any of them # are found installed. # Because dozens of the OSSC rpm packages have dependencies on other # packages or shared libraries, it can become very problematic to # seamlessly upgrade pre-installed packages because the process # necessarily breaks (at least temporarily) other installed packages. # As the number of packages with dependencies has grown with each # release of the OSSC, this "mandatory" script has become more complex # and should probably be rewritten to be more managable. # In order to allow rpm to upgrade a package that it "knows" will break # another installed package, one must use either a "--force" or "--nodeps" # flag. The individual "/mnt/SETUP/install-*.ksh" files by default (when # invoked manually without an "upgrade" parameter) honor all dependencies # (with the exception of bison-1.28-4, flex-2.5.4-4 and readline-4.1-4 # which was necessary as long as the cygnus_src package was installed # because it installed conflicting files). We want to refrain from # ever utilizing the "--force" flag because that opens an unmanageable can # of worms for upgrade purposes. # If the "/mnt/SETUP/install-*.ksh" scripts were to always make use of # the "--nodeps" flag, it is quite likely that some dependency could be # overlooked, resulting in a likelyhood that an installed package # might not work (the fewer the number of installed packages on a system, # the higher the probablilty that a dependency might be missed due to # an oversight of the script's author). It is at least my personal preferance # to utilize the "--nodeps" override as sparingly as possible. # The intent of this mandatory script is to have a single place where the # overrides are performed. # This script is broken into 3 parts (a rpm-2.5 unique, rpm-3.0.2 unique, # and a common set of tasks). If rpm version 2.5 was installed then # we perform a "--rebuilddb" of the rpm database. if /usr/local/bin/rpm --version |grep 2.5 > /dev/null 2>&1 then RPM_version="2.5" fi if /usr/local/bin/rpm --version |grep 3.0.2 > /dev/null 2>&1 then RPM_version="3.0.2" fi # # The following disclaimer/chance to quit is already in RPM-init.ksh, so if we're # being called from there, we don't want to repeat it. # if [[ $2 = "" ]] 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 previous OSSC 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 install each package" echo " individually with \"/mnt/SETUP/tachometer install \"" 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 upgrade-packages script..." echo exit fi if [ "$answer" != "y" -a "$answer" != "Y" ] then echo "Response $answer is not recognized, " echo "Exiting upgrade-packages script..." echo exit 1 fi fi # We now create a temporary directory that only root has access to, # especially because we don't clean up the (tiny) files. mkdir -m 0200 -p /tmp/RPM-tmp chmod u+r /tmp/RPM-tmp ###################### Start of RPM version = 2.5 branch ######################## if [ $RPM_version = "2.5" ] then echo echo " W A R N I N G ! !" echo echo "If you have installed any custom RPM files on your system" echo "you may want to ensure that you have a copy of the package's" echo "rpm file prior to completing this procedure. Should your rpm" echo "database become corrupted, there may be no other means to" echo "reenter the package information into the rpm database." echo echo "Do you want to continue? [y/n]: \c" read answer echo if [ "$answer" = "n" ] || [ "$answer" = "N" ] then echo "Exiting upgrade-packages script..." echo exit fi if [ "$answer" != "y" -a "$answer" != "Y" ] then echo "Response $answer is not recognized, " echo "Exiting upgrade-packages script..." echo exit 1 fi # now we perform the restore of the 3.0.2 files... /usr/bin/gzip -dc $setup_location/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 $setup_location/rpmrc, lets remove the rpmrc-3.0.2 # file from /etc rm /etc/rpmrc-3.0.2 cp $setup_location/rpmrc /etc/rpmrc mv /etc/rpm-tmp /etc/rpm # now let's tell rpm to upgrade the databases # The first time the --rebuilddb command executes, the following error is # issued: # cannot open file //usr/local/lib/rpm/nameindex.rpm: Invalid argument # Subsequent --rebuilddb commands yield no error. I have yet to find a problem # with any rebuilt /usr/local/lib/rpm/nameindex.rpm database. Rather than # unnecessarily alarm users, I've redirected the error message to a file... /usr/local/bin/rpm --rebuilddb > /tmp/RPM-tmp/rpm-error 2>&1 rm /tmp/RPM-tmp/rpm-error fi ################# End of if rpm version = 2.5 unique branch ################## ######################## Start of if rpm = 3.0.2 branch ########################### if [ $RPM_version = "3.0.2" ] then # since we're only here in the event of a prior 3.0.2 installation # we don't overwrite the previous installation/database... # /usr/bin/gzip -dc $setup_location/rpm3.0.2archive.tar.gz | tar xpf - # but we still need to ensure that we have the latest rpmrc file installed if [[ -f /etc/rpmrc ]] then if ! grep "OSSC V5.1B" /etc/rpmrc > /dev/null 2>&1 then echo "Your /etc/rpmrc file is obsolete." echo "Saving /etc/rpmrc to /etc/rpmrc-pre5.1B..." cp /etc/rpmrc /etc/rpmrc-pre5.1B echo "Copying $MOUNT_location/SETUP/rpmrc to /etc/rpmrc" cp $MOUNT_location/SETUP/rpmrc /etc/rpmrc echo "" fi fi fi ####################### End of RPM-3.0.2 Unique branch ##################### ####################### Start of Common to both branch ##################### # as noted above, we want to remove any previously installed cygnus_src* # package first: if /usr/local/bin/rpm -q cygnus_src > /dev/null 2>&1 then cygnus_src_package=`/usr/local/bin/rpm -q cygnus_src` # bison-1.28-4 requires 1009664 bytes # diffutils-2.7-4 requires 617472 bytes # flex-2.5.4-4 requires 520192 bytes # cygnus_expect-99r1-4 requires 23420928 bytes # cygnus_gcc-g++-99r1-4 requires 25598976 bytes # gmake-3.79.1-4 requires 1639424 bytes # patch-2.5.4-4 requires 384000 bytes # readline-4.1-4 requires 1659904 bytes # texinfo-4.0-4 requires 4581376 bytes # -------- # 59431936 bytes # # cygnus_src-99r1-3 requires 65804288 bytes # - 59431936 bytes # -------- # 6372352 bytes # The removal of cygnus_src and upgrade of separate pieces # should leave us with 6372352 bytes more than we started with # Required_space=59431936 echo "The previous versions of the Cygnus GNUPro Toolkit" echo "(cygnus_src-99r1) have been repackaged into their" echo "individual components for this release. In order" echo "to update the package(s) it is necessary to first" echo "remove your current $cygnus_src_package package." echo echo "Removing previously installed $cygnus_src_package package..." echo /usr/local/bin/rpm -ev --nodeps $cygnus_src_package # Now that we've removed cygnus_src, we need to replace it with # the individual components: # We need to process texinfo first because other pkgs rely on install-info $setup_location/tachometer install texinfo bison diffutils flex cygnus_expect cygnus_gcc-g++ gmake patch readline fi # If cygnus_src was not pre-installed, then we will require that the # texinfo package get installed first because a number of packages # depend on the /usr/local/bin/install-info for post-package-installation # processing: if ! /usr/local/bin/rpm -q texinfo-4.0-4 > /dev/null 2>&1 then echo "Installing prerequisite texinfo package..." $setup_location/tachometer install texinfo echo fi # Finally, we do a generic "tachometer upgrade" to see if the system # has old packages that we can upgrade $setup_location/tachometer upgrade exit