1#!/bin/bash 2 3# Linux deinstallation 4# No parameter required, all RPMs listed in $HOME/.RPM_OFFICEDATABASE 5# will be removed. 6 7if [ $# -ne 1 ] 8then 9 echo 10 echo "Usage:" $0 "<office-installation-dir>" 11 echo " <inst-destination-dir>: directory where the office to be removed is installed" 12 echo 13 exit 2 14fi 15 16INSTALLDIR=$1 17 18# Check for old style .RPM_OFFICEDATABASE first 19if [ -d ${INSTALLDIR}/.RPM_OFFICEDATABASE ]; then 20 RPM_DB_PATH=${INSTALLDIR}/.RPM_OFFICEDATABASE 21else 22 RPM_DB_PATH=${INSTALLDIR}/.RPM_DATABASE 23fi 24 25# the RPM_DB_PATH must be absolute 26if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then 27 RPM_DB_PATH=`cd ${RPM_DB_PATH}; pwd` 28fi 29 30RPMLIST=`rpm --dbpath $RPM_DB_PATH --query --all` 31 32# Output ... 33clear 34echo "#########################################" 35echo "# Deinstallation of Office RPMs #" 36echo "#########################################" 37echo 38echo "Path to the RPM database: " $RPM_DB_PATH 39echo "RPMs to deinstall:" 40echo "$RPMLIST" 41echo "====================================================================" 42echo 43 44# Restore original bootstraprc 45mv -f $1/program/bootstraprc.orig $1/program/bootstraprc 46 47rpm --dbpath $RPM_DB_PATH --erase $RPMLIST || exit 2 48 49echo "Removing RPM database ..." 50rm -rf $RPM_DB_PATH 51 52echo 53echo "Deinstallation done." 54 55exit 0 56