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
|
|
|
|
PRODUCTINSTALLLOCATION="`rpm -ql $RPMNAME | head -n 1`"
|
|
|
|
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}`
|
|
|
|
|
|
|
|
echo
|
|
|
|
rpm --upgrade -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST
|
|
|
|
echo
|
|
|
|
|
|
|
|
# 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
|