#!/usr/bin/env bash ##################################################################### ## __ __ _ ___________ ## ## \ \ / /| |____ ____| ## ## \ \ / / | | | | ## ## \ \ /\ / / | | | | ## ## \ \/ \/ / | | | | ## ## \ /\ / | | | | ## ## \/ \/ |_| |_| ## ## ## ## Wiimms ISO Tools ## ## https://wit.wiimm.de/ ## ## ## ##################################################################### ## ## ## This file is part of the WIT project. ## ## Visit https://wit.wiimm.de/ for project details and sources. ## ## ## ## Copyright (c) 2009-2021 by Dirk Clemens ## ## ## ##################################################################### ## ## ## This file installs the distribution on a windows system. ## ## ## ##################################################################### #------------------------------------------------------------------------------ # simple cygwin check if [[ $1 != --cygwin ]] then echo "Option --cygwin not set => exit" >&2 exit 1 fi #------------------------------------------------------------------------------ # pre definitions BIN_FILES="@@BIN-FILES@@" WDF_LINKS="@@WDF-LINKS@@" SHARE_FILES="@@SHARE-FILES@@" WIN_INSTALL_PATH="@@WIN-INSTALL-PATH@@" #------------------------------------------------------------------------------ # 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 $WDF_LINKS 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 #------------------------------------------------------------------------------ # remove WIT path to environment 'Path' echo "* remove WIT path from 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' #------------------------------------------------------------------------------