2005-04-20 05:40:36 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"`
|
|
|
|
|
|
|
|
if [ $MYUID -ne 0 ]
|
|
|
|
then
|
2005-09-28 07:06:27 -05:00
|
|
|
echo You need to have super-user permissions to run this patch script
|
2005-04-20 05:40:36 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Searching for the PRODUCTNAMEPLACEHOLDER installation ..."
|
|
|
|
|
|
|
|
RPMNAME=`rpm -qa | grep PRODUCTNAMEPLACEHOLDER-core01`
|
|
|
|
|
|
|
|
if [ "x$RPMNAME" != "x" ]
|
|
|
|
then
|
2005-11-09 02:26:54 -06:00
|
|
|
PRODUCTINSTALLLOCATION="`rpm --query --queryformat "%{INSTALLPREFIX}" $RPMNAME`"
|
2005-04-20 05:40:36 -05:00
|
|
|
else
|
|
|
|
echo "PRODUCTNAMEPLACEHOLDER is not installed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
# Last chance to exit ..
|
2005-04-20 05:40:36 -05:00
|
|
|
echo
|
2005-09-28 07:06:27 -05:00
|
|
|
read -p "Patching the installation in ${PRODUCTINSTALLLOCATION}. Continue (y/n) ? " -n 1 reply leftover
|
|
|
|
echo
|
|
|
|
[ "$reply" == "y" ] || exit 1
|
2005-04-20 05:40:36 -05:00
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
echo
|
|
|
|
echo "About to update the following packages ..."
|
2005-04-20 05:40:36 -05:00
|
|
|
|
2005-07-08 05:45:29 -05:00
|
|
|
BASEDIR=`dirname $0`
|
|
|
|
|
2005-05-13 03:39:21 -05:00
|
|
|
RPMLIST=""
|
2005-07-08 05:45:29 -05:00
|
|
|
for i in `ls $BASEDIR/RPMS/*.rpm`
|
2005-05-13 03:39:21 -05:00
|
|
|
do
|
2005-09-28 07:06:27 -05:00
|
|
|
rpm --query `rpm --query --queryformat "%{NAME}\n" --package $i` && RPMLIST="$RPMLIST $i"
|
2005-05-13 03:39:21 -05:00
|
|
|
done
|
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
# Save UserInstallation value
|
|
|
|
BOOTSTRAPRC="${PRODUCTINSTALLLOCATION}/program/bootstraprc"
|
|
|
|
USERINST=`grep UserInstallation ${BOOTSTRAPRC}`
|
|
|
|
|
2007-07-06 06:16:12 -05:00
|
|
|
# Check, if searchtoolbar extension rpm is available
|
|
|
|
SEARCHTOOLBARRPM=`ls $BASEDIR/RPMS/*.rpm | grep searchtoolbar`
|
|
|
|
|
|
|
|
if [ "x$SEARCHTOOLBARRPM" != "x" ]; then
|
|
|
|
# Check, that $RPMLIST does not contain search toolbar rpm (then it is already installed)
|
|
|
|
SEARCHTOOLBARINSTALLED=`grep searchtoolbar ${RPMLIST}`
|
|
|
|
|
|
|
|
if [ "x$SEARCHTOOLBARINSTALLED" == "x" ]; then
|
|
|
|
# Install the online update rpm
|
|
|
|
RPMLIST="$RPMLIST $SEARCHTOOLBARRPM"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
echo
|
|
|
|
rpm --upgrade -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST
|
|
|
|
echo
|
|
|
|
|
2006-08-04 03:51:41 -05:00
|
|
|
# Check, if online update rpm is available
|
|
|
|
ONLINEUPDATERPM=`ls $BASEDIR/RPMS/*.rpm | grep onlineupdate`
|
|
|
|
|
|
|
|
if [ "x$ONLINEUPDATERPM" != "x" ]; then
|
|
|
|
# Check, that $RPMLIST does not contain online update rpm (then it is already installed)
|
|
|
|
ONLINEPDATEINSTALLED=`grep onlineupdate ${RPMLIST}`
|
|
|
|
|
|
|
|
if [ "x$ONLINEPDATEINSTALLED" == "x" ]; then
|
|
|
|
# Ask user, if online update shall be installed
|
|
|
|
echo
|
|
|
|
read -p "Do you want to install the new online update feature (y/n) ? " -n 1 reply leftover
|
|
|
|
echo
|
|
|
|
|
|
|
|
if [ "$reply" == "y" ]; then
|
|
|
|
# Install the online update rpm
|
|
|
|
rpm --install -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $ONLINEUPDATERPM
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
# Some RPM versions have problems with -U and --prefix
|
|
|
|
if [ ! -f ${BOOTSTRAPRC} ]; then
|
|
|
|
echo Update failed due to a bug in RPM, uninstalling ..
|
|
|
|
rpm --erase -v --nodeps --notriggers `rpm --query --queryformat "%{NAME} " --package $RPMLIST`
|
|
|
|
echo
|
|
|
|
echo Now re-installing new packages ..
|
|
|
|
echo
|
|
|
|
rpm --install -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Restore the UserInstallation key if necessary
|
|
|
|
DEFUSERINST=`grep UserInstallation ${BOOTSTRAPRC}`
|
|
|
|
if [ "${USERINST}" != "${DEFUSERINST}" ]; then
|
|
|
|
mv -f ${BOOTSTRAPRC} ${BOOTSTRAPRC}.$$
|
|
|
|
sed "s|UserInstallation.*|${USERINST}|" ${BOOTSTRAPRC}.$$ > ${BOOTSTRAPRC}
|
|
|
|
rm -f ${BOOTSTRAPRC}.$$
|
|
|
|
fi
|
2005-04-20 05:40:36 -05:00
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
echo "Done."
|
2005-04-20 05:40:36 -05:00
|
|
|
|
|
|
|
exit 0
|