aboutsummaryrefslogtreecommitdiff
path: root/project/setup/windows-uninstall.sh
diff options
context:
space:
mode:
authorroot <root@dc13.lemmi>2020-07-21 10:00:46 +0200
committerroot <root@dc13.lemmi>2020-07-21 10:00:46 +0200
commit1192c4575ea7afdf38e3fa0df4587a08620af11e (patch)
tree6910a62487c282d0840d2e668aa7eb40b7c8a3fd /project/setup/windows-uninstall.sh
parent76de8a89f7c1d1b4522eb66e8f89d248e8c1781f (diff)
SZS v2.18a
Diffstat (limited to 'project/setup/windows-uninstall.sh')
-rw-r--r--project/setup/windows-uninstall.sh103
1 files changed, 103 insertions, 0 deletions
diff --git a/project/setup/windows-uninstall.sh b/project/setup/windows-uninstall.sh
new file mode 100644
index 0000000..4a19c33
--- /dev/null
+++ b/project/setup/windows-uninstall.sh
@@ -0,0 +1,103 @@
+#!/usr/bin/env bash
+
+ #####################################################################
+ ## _______ _______ _______ ##
+ ## | ___ |____ | ___ | ##
+ ## | | |_| / /| | |_| ##
+ ## | |_____ / / | |_____ ##
+ ## |_____ | / / |_____ | ##
+ ## _ | | / / _ | | ##
+ ## | |___| |/ /____| |___| | ##
+ ## |_______|_______|_______| ##
+ ## ##
+ ## Wiimms SZS Tools ##
+ ## http://szs.wiimm.de/ ##
+ ## ##
+ #####################################################################
+ ## ##
+ ## This file is part of the SZS project. ##
+ ## Visit http://szs.wiimm.de/ for project details and sources. ##
+ ## ##
+ ## Copyright (c) 2011-2019 by Dirk Clemens <wiimm@wiimm.de> ##
+ ## ##
+ #####################################################################
+
+#------------------------------------------------------------------------------
+# simple cygwin check
+
+if [[ $1 != --cygwin ]]
+then
+ echo "Option --cygwin not set => exit" >&2
+ exit 1
+fi
+
+#------------------------------------------------------------------------------
+# pre definitions
+
+BIN_FILES="wszst wbmgt wimgt wkclt wkmpt wstrt "
+SHARE_FILES=""
+WIN_INSTALL_PATH="Wiimm/SZS"
+
+#------------------------------------------------------------------------------
+# setup
+
+echo "* setup"
+
+export PATH=".:$PATH"
+
+key="/machine/SOFTWARE/Microsoft/Windows/CurrentVersion/ProgramFilesDir"
+if ! WIN_PROG_PATH="$(regtool get "$key")" || [[ $WIN_PROG_PATH = "" ]]
+then
+ echo "Can't determine Windows program path => abort" >&2
+ exit 1
+fi
+#CYGWIN_PROG_PATH="$( realpath "$WIN_PROG_PATH" )"
+CYGWIN_PROG_PATH="${WIN_PROG_PATH//\\//}"
+
+WDEST="$WIN_PROG_PATH\\${WIN_INSTALL_PATH//\//\\}"
+CDEST="$CYGWIN_PROG_PATH/$WIN_INSTALL_PATH"
+
+#------------------------------------------------------------------------------
+# remove application pathes
+
+for tool in $BIN_FILES
+do
+ key="/machine/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/$tool.exe"
+ if regtool check "$key" >/dev/null 2>&1
+ then
+ echo "* remove application path for '$tool.exe'"
+ regtool unset "$key/" "${WDEST}\\${tool}.exe"
+ regtool unset "$key/Path" "${WDEST}\\"
+ regtool remove "$key"
+ fi
+done
+
+#------------------------------------------------------------------------------
+# add WIT path to environment 'Path'
+
+echo "* add SZS path to environment 'Path'"
+
+function set_path()
+{
+ local key="$1"
+
+ local p=
+ local count=0
+ local new_path=
+
+ # split at ';' & substitute ' ' temporary to ';' to be space save
+ for p in $( regtool --quiet get "$key" | tr '; ' '\n;' )
+ do
+ p="${p//;/ }"
+ #echo " -> |$p|"
+ [[ "$p" = "$WDEST" ]] || new_path="$new_path;$p"
+ done
+
+ [[ $new_path = "" ]] || regtool set -e "$key" "${new_path:1}"
+}
+
+set_path '/machine/SYSTEM/CurrentControlSet/Control/Session Manager/Environment/Path'
+set_path '/user/Environment/Path'
+
+#------------------------------------------------------------------------------
+