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 ..."
|
|
|
|
|
2008-10-29 08:27:59 -05:00
|
|
|
RPMNAME=`rpm -qa | grep SEARCHPACKAGENAMEPLACEHOLDER`
|
2005-04-20 05:40:36 -05:00
|
|
|
|
|
|
|
if [ "x$RPMNAME" != "x" ]
|
|
|
|
then
|
2005-11-09 02:26:54 -06:00
|
|
|
PRODUCTINSTALLLOCATION="`rpm --query --queryformat "%{INSTALLPREFIX}" $RPMNAME`"
|
2008-10-29 08:27:59 -05:00
|
|
|
FULLPRODUCTINSTALLLOCATION="${PRODUCTINSTALLLOCATION}/PRODUCTDIRECTORYNAME"
|
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
|
2008-10-29 08:27:59 -05:00
|
|
|
read -p "Patching the installation in ${FULLPRODUCTINSTALLLOCATION}. Continue (y/n) ? " -n 1 reply leftover
|
2005-09-28 07:06:27 -05:00
|
|
|
echo
|
2010-10-09 03:39:27 -05:00
|
|
|
[ "$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
|
2008-10-29 08:27:59 -05:00
|
|
|
BOOTSTRAPRC="${FULLPRODUCTINSTALLLOCATION}/program/bootstraprc"
|
2005-09-28 07:06:27 -05:00
|
|
|
USERINST=`grep UserInstallation ${BOOTSTRAPRC}`
|
|
|
|
|
2007-12-05 10:37:51 -06:00
|
|
|
# Check, if kde-integration rpm is available
|
|
|
|
KDERPM=`ls $BASEDIR/RPMS/*.rpm | grep kde-integration`
|
|
|
|
|
|
|
|
if [ "x$KDERPM" != "x" ]; then
|
|
|
|
# Check, that $RPMLIST does not contain kde integration rpm (then it is already installed)
|
|
|
|
KDERPMINSTALLED=`grep kde-integration ${RPMLIST}`
|
|
|
|
|
2010-10-09 03:39:27 -05:00
|
|
|
if [ "x$KDERPMINSTALLED" = "x" ]; then
|
2007-12-05 10:37:51 -06:00
|
|
|
# Install the kde integration rpm
|
|
|
|
RPMLIST="$RPMLIST $KDERPM"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-09-28 07:06:27 -05:00
|
|
|
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
|