From aae906ab364aea30e60ac68f622694dc2ab64313 Mon Sep 17 00:00:00 2001 From: Alchemi1963 Date: Thu, 30 May 2024 23:18:31 +0200 Subject: [PATCH 01/11] Fixed printf \tsclient and no newline errors. --- installer.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/installer.sh b/installer.sh index 3784a6c..117ad23 100755 --- a/installer.sh +++ b/installer.sh @@ -42,15 +42,13 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in "$DIR"/apps/*; do - [[ -e "$F" ]] || break + for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 - . "$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" "$WIN_EXECUTABLE" "$F" >>"$HOME/.local/share/winapps/installed.bat" + . "$DIR/apps/$F/info" + printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done - printf "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>"$HOME/.local/share/winapps/installed.bat" - # shellcheck disable=SC2140 + printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" + printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do @@ -117,7 +115,10 @@ MimeType=$MIME_TYPES function waConfigureApps() { APPS=() while IFS= read -r F; do + [[ -n $F ]] || continue # shellcheck disable=SC1090 + F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From 9a4c689a6ab19e048c874bd27149369a7557fafd Mon Sep 17 00:00:00 2001 From: Alchemi1963 Date: Thu, 30 May 2024 23:22:05 +0200 Subject: [PATCH 02/11] Added empty parameter catch around line 90 --- installer.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/installer.sh b/installer.sh index 117ad23..bb5b33a 100755 --- a/installer.sh +++ b/installer.sh @@ -83,6 +83,9 @@ function waFindInstalled() { } function waConfigureApp() { + if [[ -z $1 ]]; then + return 1 + fi if [ -z "$ICON" ]; then ICON=$SYS_PATH/apps/$1/icon.$2 fi From 45b7111d5b5ee554c1333987c158d5f7a610eead Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 30 May 2024 21:47:54 +0000 Subject: [PATCH 03/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- installer.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer.sh b/installer.sh index bb5b33a..d687d6b 100755 --- a/installer.sh +++ b/installer.sh @@ -45,7 +45,7 @@ function waFindInstalled() { for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" + printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 @@ -84,7 +84,7 @@ function waFindInstalled() { function waConfigureApp() { if [[ -z $1 ]]; then - return 1 + return 1 fi if [ -z "$ICON" ]; then ICON=$SYS_PATH/apps/$1/icon.$2 @@ -118,10 +118,10 @@ MimeType=$MIME_TYPES function waConfigureApps() { APPS=() while IFS= read -r F; do - [[ -n $F ]] || continue + [[ -n $F ]] || continue # shellcheck disable=SC1090 - F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \"$F\" >> test + F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From f5bafe4e2cad03627add6a4fb15fe7fd2f5068bd Mon Sep 17 00:00:00 2001 From: Alchemi Date: Fri, 31 May 2024 10:21:51 +0200 Subject: [PATCH 04/11] Moved shellcheck line one down at line 51 --- installer.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index d687d6b..f41013b 100755 --- a/installer.sh +++ b/installer.sh @@ -48,7 +48,8 @@ function waFindInstalled() { printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 + printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" + # shellcheck disable=SC2140 $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do From b658df0a4cffb02276f6a7f4906d6ad16178f627 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Fri, 31 May 2024 08:36:59 +0000 Subject: [PATCH 05/11] fix: prevent backslashes being escaped at all --- installer.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index f41013b..2d15073 100755 --- a/installer.sh +++ b/installer.sh @@ -45,12 +45,12 @@ function waFindInstalled() { for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" + printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done - printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" + printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" + printf "%s\n" 'RENAME \\tsclient\home\.local\share\winapps\installed.tmp installed' >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"$(printf '/C %s' '\\tsclient\home\.local\share\winapps\installed.bat')" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do sleep 5 From 24f2ef4f33a3d1c3f821850823cd3cc90e16897d Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:35:05 +0200 Subject: [PATCH 06/11] Fix shellcheck --- installer.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 2d15073..0284601 100755 --- a/installer.sh +++ b/installer.sh @@ -42,7 +42,8 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in $(ls "${DIR}/apps"); do + for F in "$DIR"/apps/*; do + [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" @@ -120,9 +121,9 @@ function waConfigureApps() { APPS=() while IFS= read -r F; do [[ -n $F ]] || continue + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \""$F"\" >> test # shellcheck disable=SC1090 - F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From 2fff49ee42c7e9e2551d9438faa53492b028839d Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:36:32 +0200 Subject: [PATCH 07/11] Fix shellcheck SC2238 --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 0284601..506c274 100755 --- a/installer.sh +++ b/installer.sh @@ -122,7 +122,7 @@ function waConfigureApps() { while IFS= read -r F; do [[ -n $F ]] || continue F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \""$F"\" >> test + echo \""$F"\" >> "test" # shellcheck disable=SC1090 . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") From 79652eeec53073fbafde80ea65fcf8edfa36ab87 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:27:21 +0200 Subject: [PATCH 08/11] fix: remove test --- installer.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/installer.sh b/installer.sh index 506c274..d8d664e 100755 --- a/installer.sh +++ b/installer.sh @@ -122,7 +122,6 @@ function waConfigureApps() { while IFS= read -r F; do [[ -n $F ]] || continue F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \""$F"\" >> "test" # shellcheck disable=SC1090 . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") From e43fce77079e97f7ddefa28f3bb7c0198c6a8036 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:30:27 +0200 Subject: [PATCH 09/11] fix: this path is already absolute --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index d8d664e..5165fab 100755 --- a/installer.sh +++ b/installer.sh @@ -45,7 +45,7 @@ function waFindInstalled() { for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 - . "$DIR/apps/$F/info" + . "$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" From f8cef50eadd5198e9199ed48a70496a0c40dbbef Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:35:53 +0200 Subject: [PATCH 10/11] fix: remove trailing spaces from all loops --- installer.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 5165fab..6a1116c 100755 --- a/installer.sh +++ b/installer.sh @@ -44,8 +44,10 @@ function waFindInstalled() { cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break + F="$(basename "$F")" + # shellcheck disable=SC1090,SC1091 - . "$F/info" + . "$DIR/apps/$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" @@ -152,6 +154,8 @@ function waConfigureApps() { COUNT=0 if [ "$APP_INSTALL" != "Do not set up any pre-configured applications" ]; then while IFS= read -r F; do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg @@ -168,6 +172,8 @@ function waConfigureAppsAllOfficiallySupported(){ $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 while IFS= read -r F; do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg @@ -285,12 +291,16 @@ function waUninstallUser() { rm -rf "$HOME/.local/share/winapps" grep -l -d skip "bin/winapps" "$HOME/.local/share/applications/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo -n " Removing $F..." $SUDO rm "$F" echo " Finished." done grep -l -d skip "bin/winapps" "$HOME/.local/bin/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo -n " Removing $F..." $SUDO rm "$F" echo " Finished." @@ -302,6 +312,8 @@ function waUninstallSystem() { $SUDO rm -rf "/usr/local/share/winapps" grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [ -z "$SUDO" ]; then waNoSudo fi @@ -311,6 +323,8 @@ function waUninstallSystem() { done grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [ -z "$SUDO" ]; then waNoSudo fi From 754a483e64e713ac48e3b94816f9b70bb4eb364e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:36:00 +0000 Subject: [PATCH 11/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index 6a1116c..ac09d99 100755 --- a/installer.sh +++ b/installer.sh @@ -44,7 +44,7 @@ function waFindInstalled() { cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break - F="$(basename "$F")" + F="$(basename "$F")" # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" @@ -173,7 +173,7 @@ function waConfigureAppsAllOfficiallySupported(){ COUNT=0 while IFS= read -r F; do F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg