1#!/bin/bash 2# 3# This file is part of the LibreOffice project. 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, You can obtain one at http://mozilla.org/MPL/2.0/. 8# 9# This file incorporates work covered by the following license notice: 10# 11# Licensed to the Apache Software Foundation (ASF) under one or more 12# contributor license agreements. See the NOTICE file distributed 13# with this work for additional information regarding copyright 14# ownership. The ASF licenses this file to you under the Apache 15# License, Version 2.0 (the "License"); you may not use this file 16# except in compliance with the License. You may obtain a copy of 17# the License at http://www.apache.org/licenses/LICENSE-2.0 . 18# 19 20# Linux deinstallation 21# No parameter required, all RPMs listed in $HOME/.RPM_OFFICEDATABASE 22# will be removed. 23 24if [ $# -ne 1 ] 25then 26 echo 27 echo "Usage:" $0 "<office-installation-dir>" 28 echo " <inst-destination-dir>: directory where the office to be removed is installed" 29 echo 30 exit 2 31fi 32 33INSTALLDIR=$1 34 35# Check for old style .RPM_OFFICEDATABASE first 36if [ -d ${INSTALLDIR}/.RPM_OFFICEDATABASE ]; then 37 RPM_DB_PATH=${INSTALLDIR}/.RPM_OFFICEDATABASE 38else 39 RPM_DB_PATH=${INSTALLDIR}/.RPM_DATABASE 40fi 41 42# the RPM_DB_PATH must be absolute 43if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then 44 RPM_DB_PATH=`cd ${RPM_DB_PATH}; pwd` 45fi 46 47RPMLIST=`rpm --dbpath $RPM_DB_PATH --query --all` 48 49# Output ... 50clear 51echo "#########################################" 52echo "# Deinstallation of Office RPMs #" 53echo "#########################################" 54echo 55echo "Path to the RPM database: " $RPM_DB_PATH 56echo "RPMs to deinstall:" 57echo "$RPMLIST" 58echo "====================================================================" 59echo 60 61# Restore original bootstraprc 62mv -f $1/program/bootstraprc.orig $1/program/bootstraprc 63 64rpm --dbpath $RPM_DB_PATH --erase $RPMLIST || exit 2 65 66echo "Removing RPM database ..." 67rm -rf $RPM_DB_PATH 68 69echo 70echo "Deinstallation done." 71 72exit 0 73