[PATCH 2 of 3] Create uninstaller
Wald Commits
scm-commit at wald.intevation.org
Thu Sep 18 13:30:01 CEST 2014
# HG changeset patch
# User Sascha Wilde <wilde at intevation.de>
# Date 1411039677 -7200
# Node ID a72d59f8c3ea70afbd672ea12774bafe3707cbe9
# Parent 96ecd345c9614bd79624179442808c276e7d0305
Create uninstaller.
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/CMakeLists.txt
--- a/packaging/CMakeLists.txt Thu Sep 18 12:04:30 2014 +0200
+++ b/packaging/CMakeLists.txt Thu Sep 18 13:27:57 2014 +0200
@@ -3,9 +3,11 @@
configure_file (create-dist-package.sh.in create-dist-package.sh @ONLY)
configure_file (linux-createpackage.sh.in linux-createpackage.sh @ONLY)
configure_file (linux-installer.inc linux-installer.inc COPYONLY)
+configure_file (linux-uninstaller.inc linux-uninstaller.inc COPYONLY)
configure_file (linux-installer-common.inc.in linux-installer-common.inc @ONLY)
configure_file (linux-installer-uninstall.inc linux-installer-uninstall.inc COPYONLY)
configure_file (linux-installer.l10n-de linux-installer.l10n-de COPYONLY)
+configure_file (linux-uninstaller.l10n-de linux-uninstaller.l10n-de COPYONLY)
configure_file (linux-installer-common.l10n-de linux-installer-common.l10n-de COPYONLY)
configure_file (linux-installer-uninstall.l10n-de linux-installer-uninstall.l10n-de COPYONLY)
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-createpackage.sh.in
--- a/packaging/linux-createpackage.sh.in Thu Sep 18 12:04:30 2014 +0200
+++ b/packaging/linux-createpackage.sh.in Thu Sep 18 13:27:57 2014 +0200
@@ -39,11 +39,13 @@
fi
INSTALLER="@CMAKE_BINARY_DIR@/TrustBridge- at PROJECT_VERSION@.sh"
+UNINSTALLER="$TMPDIR/bin/trustbridge-deinstall.sh"
EXEFILES=("@CMAKE_BINARY_DIR@/cinst/cinst"
"@CMAKE_BINARY_DIR@/cinst/mozilla"
"@CMAKE_BINARY_DIR@/ui/trustbridge"
- "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh")
+ "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh"
+ "$UNINSTALLER")
ICON="@CMAKE_SOURCE_DIR@/ui/img/logo-128.png"
HELPFILES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html \
@@ -67,10 +69,6 @@
install "${EXEFILES[@]}" "$TMPDIR/bin"
install "$ICON" "$TMPDIR/share/pixmaps/trustbridge/trustbridge.png"
-echo "Building $INSTALLER..."
-cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
-process_includes "$INSTALLER" "@CMAKE_BINARY_DIR@/packaging"
-
binnames=""
for file in "${EXEFILES[@]}" ; do
binnames="`basename $file` $binnames"
@@ -92,20 +90,32 @@
helpnames_sources="`basename $file` $helpnames_sources"
done
+echo "Building $INSTALLER and $UNINSTALLER ..."
+
+cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER"
+cp "@CMAKE_BINARY_DIR@/packaging/linux-uninstaller.inc" "$UNINSTALLER"
+
+declare -a INSTALLER_SCRIPTS
+INSTALLER_SCRIPTS=("$INSTALLER" "$UNINSTALLER")
+
+for script in "${INSTALLER_SCRIPTS[@]}" ; do
+ process_includes "$script" "@CMAKE_BINARY_DIR@/packaging"
+ sed -i "s/###BINNAMES###/${binnames}/" "$script"
+ sed -i "s/###ICONNAME###/trustbridge.png/" "$script"
+ sed -i "s/###HELPNAMES###/${helpnames}/" "$script"
+ sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$script"
+ sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$script"
+ sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$script"
+ sed -i "s/###ARCH###/${ARCH}/" "$script"
+ chmod +x "$script"
+done
+
echo "Creating shar archive ..."
cd "$TMPDIR"
shar -z -B `find -type f` | sed 's/^exit 0//' >>"$TMPSHAR"
-sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER"
-sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER"
sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER"
-sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER"
-sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER"
-sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER"
-sed -i "s/###HELPNAMES_IMG###/${helpnames_img}/" "$INSTALLER"
-sed -i "s/###ARCH###/${ARCH}/" "$INSTALLER"
-chmod +x "$INSTALLER"
echo "Signing"
"@CMAKE_SOURCE_DIR@/ui/tests/append-sig.sh" \
"@CMAKE_SOURCE_DIR@/ui/tests/data/codesign/codesigning.key" \
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-installer-common.inc.in
--- a/packaging/linux-installer-common.inc.in Thu Sep 18 12:04:30 2014 +0200
+++ b/packaging/linux-installer-common.inc.in Thu Sep 18 13:27:57 2014 +0200
@@ -35,9 +35,7 @@
)
declare -A L10N_DE
-###INCLUDE:linux-installer.l10n-de
###INCLUDE:linux-installer-common.l10n-de
-###INCLUDE:linux-installer-uninstall.l10n-de
getxt()
{
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-installer-uninstall.inc
--- a/packaging/linux-installer-uninstall.inc Thu Sep 18 12:04:30 2014 +0200
+++ b/packaging/linux-installer-uninstall.inc Thu Sep 18 13:27:57 2014 +0200
@@ -1,4 +1,7 @@
#-*-sh-*-
+
+###INCLUDE:linux-installer-uninstall.l10n-de
+
rm_empty_dirs()
{
# Args: $1 - DIRECTORY
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-installer.inc
--- a/packaging/linux-installer.inc Thu Sep 18 12:04:30 2014 +0200
+++ b/packaging/linux-installer.inc Thu Sep 18 13:27:57 2014 +0200
@@ -33,6 +33,7 @@
set -u
###INCLUDE:linux-installer-common.inc
+###INCLUDE:linux-installer.l10n-de
###INCLUDE:linux-installer-uninstall.inc
@@ -113,7 +114,7 @@
getxt "To remove the application and the root certificates it has inserted,\n"
getxt "call the deinstall command:\n"
- echo " $RUNCMD ${instcfg[PREFIX]}/bin/trustbridge-deinstall-TODO.sh"
+ echo " $RUNCMD ${instcfg[PREFIX]}/bin/trustbridge-deinstall.sh"
echo "#################################################################################"
getxt "Press enter to launch '%s'\n" "${instcfg[PREFIX]}/bin/trustbridge"
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-uninstaller.inc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/linux-uninstaller.inc Thu Sep 18 13:27:57 2014 +0200
@@ -0,0 +1,69 @@
+#!/bin/bash
+set -u
+
+###INCLUDE:linux-installer-common.inc
+###INCLUDE:linux-uninstaller.l10n-de
+
+###INCLUDE:linux-installer-uninstall.inc
+
+DEINSTALL=1
+
+usage()
+{
+ getxt "Usage: %s [OPTION]...\n" "$ME"
+ getxt "Uninstall TrustBridge.\n\n"
+ getxt "Options:\n"
+ getxt " -s, --system do a system wide deinstallation\n"
+ getxt " --help display this help and exit\n"
+ getxt " --version output version information and exit\n"
+ exit $1
+}
+
+parse_args()
+{
+ OPTS=`getopt \
+ -l help,system,version \
+ -o s -n "$ME" -- "$@"`
+ [ $? -eq 0 ] || usage 23
+
+ eval set -- "$OPTS"
+
+ while true ; do
+ case "$1" in
+ --system|-s)
+ SYSINST=1
+ shift 1
+ ;;
+ --help)
+ usage 0
+ ;;
+ --version)
+ version
+ ;;
+ --)
+ shift
+ break
+ ;;
+ esac
+ done
+}
+
+#======================================================================
+# main()
+
+parse_args "$@"
+check_priv
+init_vars
+read_oldinstcfg
+
+cat <<EOF
+------------------------------------------------------------------------
+
+ TrustBridge - Uninstaller
+ Version ${instcfg[VERSION]} - ${ARCH} (Testversion)
+
+------------------------------------------------------------------------
+EOF
+
+deinstall
+exit 0
diff -r 96ecd345c961 -r a72d59f8c3ea packaging/linux-uninstaller.l10n-de
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packaging/linux-uninstaller.l10n-de Thu Sep 18 13:27:57 2014 +0200
@@ -0,0 +1,8 @@
+L10N_DE+=(
+ [" --help display this help and exit\n"]=" --help diese Hilfe anzeigen und beenden\n"
+ [" --version output version information and exit\n"]=" --version Versions-Information ausgeben und beenden\n"
+ [" -s, --system do a system wide deinstallation\n"]=" -s, --system Systemweit deinstallieren\n"
+ ["Options:\n"]="Optionen:\n"
+ ["Uninstall TrustBridge.\n\n"]="TrustBridge deinstallieren.\n\n"
+ ["Usage: %s [OPTION]...\n"]="Aufruf: %s [OPTION]...\n"
+)
More information about the Trustbridge-commits
mailing list