# This version of 'remove-gnome' does not prompt the user when '-q' is
# present on the command line. This allows the script to be incorporated into
# other scripts.
#
# Modified by Damien Carbery, 19 May 2003.
# -f option added by Laca, 25 Feb 2004
# jds support added by Laca, 10 Mar 2004
MYNAME="$0"
MYARGS="$*"
QUIET=0
FORCE=0
# List of JDS packages without JDS category. Will be removed if specified
# category is JDS and the packages are present.
EXTRA_PKGS_TO_REMOVE="SUNWmozgm SUNWmoznss SUNWmozpsm SUNWgnome-l10ndocument-ja SUNWgnome-l10nmessages-ja SUNWsogm SUNWsom SUNWsoagm SUNWsoam"
echo "$0 [-h|--help|-q|--quiet|-f|--force|--version 2.0|1.4|JDS|JDS<n>|-R rootdir]"
echo "Remove GNOME packages."
echo " -h, --help display this help"
echo " --version x remove version x (default: 2.0)"
echo " --quiet, -q don't prompt for confirmation before deletion."
echo " --force, -f ignore any errors and continue."
echo " -R rootdir remove packages from an alternative root directory."
exit 1
}
GNOME_VERSION=2.0
version_opt=2.0
# If the script is called 'remove-jds' the category will include all JDS
# components.
GNOME_CATEGORY="JDSosol,JDS,JDS2,JDS3,JDS3x,JDS4,JDS5,JDS6,JDS7,JDS8,JDS9,APOC,EVO146,EVO25,GLOW,JAI,JAVAAPPS,MUSCLE,FF15,FIREFOX,TB15,"
fi
while [ $# != 0 ]; do
case "$1" in
--help | -h )
;;
--version )
shift
if [ $# = 0 ]; then
echo "Error: argument expected after --version"
fi
case "$1" in
1.4 )
GNOME_VERSION=1.4
version_opt=1.4
;;
2.0 )
;;
GNOME_VERSION="2.x (JDS)"
GNOME_CATEGORY="JDS,JDS2,JDS3,JDS4,JDS5,JDS6,JDS7,JDS8,JDS9,JDS3x,JDSosol"
;;
GNOME_VERSION="2.x (JDS Release $jdsrel)"
GNOME_CATEGORY="JDS$jdsrel"
version_opt=$1
;;
GNOME_VERSION="OpenSolaris Desktop"
GNOME_CATEGORY="JDS3x,JDSosol"
version_opt=$1
;;
* )
echo "Error: version should be one of 1.4, 2.0, opensolaris or JDS"
;;
esac
;;
--quiet | -q )
QUIET=1
;;
--force | -f )
FORCE=1
;;
-R )
shift
ROOTDIR=$1
if [ "x$ROOTDIR" = x ]; then
echo "Option -R requires an argument"
fi
;;
--no_extras | -n )
;;
* )
echo "Error: $1: invalid argument"
;;
esac
shift
done
if [ -e "$1" ]; then
backup "$1~"
echo "Saving file $1 as $1~"
fi
}
fi
fi
rm -f $TMP_PRODREG
fi
fi
/tmp/remove-gnome.copy.* )
;;
esac
}
echo "Interrupted."
exit 1
}
echo $*
if [ $FORCE == 0 ]; then
echo "Use for -f or --force option to ignore errors."
echo "Exiting..."
exit 1
else
fi
}
echo $*
exit 0
}
echo $*
}
USER_IS_ROOT=$?
echo "WARNING: Run this script as root or make sure you have been assigned"
echo "the 'Software Installation' profile to be able to uninstall packages."
echo "See the user_attr(4) and profiles(1) man pages for more details"
fi
else
fi
*/sbin )
;;
esac
cat > $PRODREG_SCRIPT << EOF
:compid
/^[ ]*<compid>/{
N
/<\/compid>/!b compid
/.*<uniquename>@PACKAGE_TO_REMOVE@\n[ ]*<\/uniquename>.*$/d
}
EOF
mail=
runlevel=nocheck
conflict=nocheck
setuid=nocheck
action=nocheck
partial=nocheck
idepend=nocheck
rdepend=nocheck
space=quit
EOF
echo "This script will remove packages belonging to GNOME $GNOME_VERSION"
echo
echo "Looking for packages..."
if [ "x$ROOTDIR" != x ]; then
TMP_PKGS=`$PKGINFO -R "$ROOTDIR" -c $GNOME_CATEGORY | grep -v '^JDS[ ]*CBE'`|| msg_noerror "No packages found."
else
fi
# Add JDS extra packages that do not have the JDS category.
then
if [ $version_opt == "jds" ]
then
# Turn off traps - '$PKGINFO -q $pkg' triggers ERR if $pkg not installed.
do
# If package is present then add to list to be removed.
if [ $? -eq 0 ]
then
# Later code expects $PKGINFO style output which contains the
# "Category package_name Description"
GNOME2 $pkg Dummy description"
fi
done
# Restore the original trap triggers.
else
fi
fi
fi
( echo "The following packages were found:"
echo
while [ "x$answer" = x ]; do
echo "Would you like to remove the above packages? (y/n)"
read answer
done
msg_error "Cancelled."
fi
else
# Simply list the packages.
echo "The following packages were found:"
echo "$TMP_PKGS"
fi
# Packages need to be removed and we must be root to do this.
msg_error "ERROR: You must be root or have the 'Software Installation' profile to uninstall packages."
fi
# find the productregistry file
if [ $version_opt = "1.4" ]; then
IFS='
'
if [ -s $prodreg ]; then
fi
done
if [ -n "$PRODREG" ]; then
msg_error "Error copying $PRODREG to $TMP_PRODREG"
msg_error "Error copying $TMP_PRODREG to $PRODREG"
fi
fi
echo "Removing packages..."
IFS=' '
if [ "x$ROOTDIR" != x ]; then
else
fi
if [ -n "$PRODREG" ]; then
msg_warning "Warning: Failed to update the product registry file: $PRODREG"
fi
done
echo "Completed with warnings. Some packages could not be removed."
else
echo "Successfully removed all packages."
fi
if [ -n "$PRODREG" ]; then
# Delete backup product registry if unchanged.
if [ $? -eq 0 ]; then
echo "Product registry unchanged, removing backup file."
fi
fi