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