Skip to content

Commit 80ba2ad

Browse files
fix: always source inquirer from path on nix
1 parent 8a4d890 commit 80ba2ad

File tree

1 file changed

+50
-22
lines changed

1 file changed

+50
-22
lines changed

packages/winapps/setup.patch

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/setup.sh b/setup.sh
2-
index 6aa9b574..9fbefe65 100755
2+
index 8c6209fb..b7651485 100755
33
--- a/setup.sh
44
+++ b/setup.sh
5-
@@ -48,8 +48,8 @@ readonly SYS_BIN_PATH="/usr/local/bin" # UNIX path to 'bin' dir
5+
@@ -39,8 +39,8 @@ readonly SYS_BIN_PATH="/usr/local/bin" # UNIX path to 'bin' dir
66
readonly USER_BIN_PATH="${HOME}/.local/bin" # UNIX path to 'bin' directory for a '--user' WinApps installation.
77
readonly USER_BIN_PATH_WIN='\\tsclient\home\.local\bin' # WINDOWS path to 'bin' directory for a '--user' WinApps installation.
88
# 'SOURCE'
@@ -13,7 +13,7 @@ index 6aa9b574..9fbefe65 100755
1313
# 'APP'
1414
readonly SYS_APP_PATH="/usr/share/applications" # UNIX path to 'applications' directory for a '--system' WinApps installation.
1515
readonly USER_APP_PATH="${HOME}/.local/share/applications" # UNIX path to 'applications' directory for a '--user' WinApps installation.
16-
@@ -79,7 +79,7 @@ readonly TEST_PATH_WIN="${USER_APPDATA_PATH_WIN}\\FreeRDP_Connection_Test" # WIN
16+
@@ -70,7 +70,7 @@ readonly TEST_PATH_WIN="${USER_APPDATA_PATH_WIN}\\FreeRDP_Connection_Test" # WIN
1717
# 'WinApps Configuration File'
1818
readonly CONFIG_PATH="${HOME}/.config/winapps/winapps.conf" # UNIX path to the WinApps configuration file.
1919
# 'Inquirer Bash Script'
@@ -22,7 +22,7 @@ index 6aa9b574..9fbefe65 100755
2222

2323
# REMOTE DESKTOP CONFIGURATION
2424
readonly VM_NAME="RDPWindows" # Name of the Windows VM (FOR 'libvirt' ONLY).
25-
@@ -139,13 +139,13 @@ function waTerminateScript() {
25+
@@ -130,13 +130,13 @@ function waTerminateScript() {
2626
# Role: Displays usage information for the script.
2727
function waUsage() {
2828
echo -e "Usage:
@@ -43,16 +43,44 @@ index 6aa9b574..9fbefe65 100755
4343
}
4444

4545
# Name: 'waGetSourceCode'
46-
@@ -168,7 +168,7 @@ function waGetSourceCode() {
47-
$SUDO git clone --recurse-submodules --remote-submodules https://github.com/winapps-org/winapps.git "$SOURCE_PATH"
48-
else
49-
echo -e "${INFO_TEXT}WinApps installation already present at ${CLEAR_TEXT}${COMMAND_TEXT}${SOURCE_PATH}${CLEAR_TEXT}${INFO_TEXT}. Updating...${CLEAR_TEXT}"
50-
- $SUDO git -C "$SOURCE_PATH" pull --no-rebase
51-
+
46+
@@ -155,13 +155,6 @@ function waGetSourceCode() {
47+
echo -e "${WARNING_TEXT}[WARNING]${CLEAR_TEXT} You might want to remove your old installation on '${SCRIPT_DIR_PATH}'."
5248
fi
5349

50+
- if [[ ! -d "$SOURCE_PATH" ]]; then
51+
- $SUDO git clone --recurse-submodules --remote-submodules https://github.com/winapps-org/winapps.git "$SOURCE_PATH"
52+
- else
53+
- echo -e "${INFO_TEXT}WinApps installation already present at ${CLEAR_TEXT}${COMMAND_TEXT}${SOURCE_PATH}${CLEAR_TEXT}${INFO_TEXT}. Updating...${CLEAR_TEXT}"
54+
- $SUDO git -C "$SOURCE_PATH" pull --no-rebase
55+
- fi
56+
-
5457
# Silently change the working directory.
55-
@@ -395,7 +395,7 @@ function waCheckExistingInstall() {
58+
if ! cd "$SOURCE_PATH" &>/dev/null; then
59+
# Display the error type.
60+
@@ -186,21 +179,8 @@ function waGetSourceCode() {
61+
# Name: 'waGetInquirer'
62+
# Role: Loads the inquirer script, even if the source isn't cloned yet
63+
function waGetInquirer() {
64+
- local INQUIRER=$INQUIRER_PATH
65+
-
66+
- if [ -d "$SYS_SOURCE_PATH" ]; then
67+
- INQUIRER=$SYS_SOURCE_PATH/$INQUIRER_PATH
68+
- elif [ -d "$USER_SOURCE_PATH" ] ; then
69+
- INQUIRER=$USER_SOURCE_PATH/$INQUIRER_PATH
70+
- else
71+
- INQUIRER="/tmp/waInquirer.sh"
72+
- rm -f "$INQUIRER"
73+
-
74+
- curl -o "$INQUIRER" "https://raw.githubusercontent.com/winapps-org/winapps/main/install/inquirer.sh"
75+
- fi
76+
-
77+
# shellcheck source=/dev/null # Exclude this file from being checked by ShellCheck.
78+
- source "$INQUIRER"
79+
+ source "$INQUIRER_PATH"
80+
}
81+
82+
# Name: 'waCheckInput'
83+
@@ -390,7 +370,7 @@ function waCheckExistingInstall() {
5684

5785
# Display the suggested action(s).
5886
echo "--------------------------------------------------------------------------------"
@@ -61,7 +89,7 @@ index 6aa9b574..9fbefe65 100755
6189
echo "--------------------------------------------------------------------------------"
6290

6391
# Terminate the script.
64-
@@ -415,7 +415,7 @@ function waCheckExistingInstall() {
92+
@@ -410,7 +390,7 @@ function waCheckExistingInstall() {
6593

6694
# Display the suggested action(s).
6795
echo "--------------------------------------------------------------------------------"
@@ -70,7 +98,7 @@ index 6aa9b574..9fbefe65 100755
7098
echo "--------------------------------------------------------------------------------"
7199

72100
# Terminate the script.
73-
@@ -810,7 +810,7 @@ function waCheckGroupMembership() {
101+
@@ -805,7 +785,7 @@ function waCheckGroupMembership() {
74102
# Identify groups the current user belongs to.
75103
USER_GROUPS=$(groups "$(whoami)")
76104

@@ -79,7 +107,7 @@ index 6aa9b574..9fbefe65 100755
79107
# Complete the previous line.
80108
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
81109

82-
@@ -1244,11 +1244,11 @@ function waConfigureWindows() {
110+
@@ -1239,11 +1219,11 @@ function waConfigureWindows() {
83111
# Populate variables.
84112
WIN_BASH="\
85113
#!/usr/bin/env bash
@@ -93,7 +121,7 @@ index 6aa9b574..9fbefe65 100755
93121
Terminal=false
94122
Type=Application
95123
Icon=${APPDATA_PATH}/icons/windows.svg
96-
@@ -1295,13 +1295,13 @@ function waConfigureApp() {
124+
@@ -1290,13 +1270,13 @@ function waConfigureApp() {
97125
# Determine the content of the bash script for the application.
98126
APP_BASH="\
99127
#!/usr/bin/env bash
@@ -109,18 +137,18 @@ index 6aa9b574..9fbefe65 100755
109137
Terminal=false
110138
Type=Application
111139
Icon=${APP_ICON}
112-
@@ -1631,8 +1631,8 @@ function waInstall() {
140+
@@ -1626,8 +1606,8 @@ function waInstall() {
113141
waFindInstalled
114142

115143
# Install the WinApps bash scripts.
116144
- $SUDO ln -sf "${SOURCE_PATH}/bin/winapps" "${BIN_PATH}/winapps"
117145
- $SUDO ln -sf "${SOURCE_PATH}/setup.sh" "${BIN_PATH}/winapps-setup"
118-
+
119-
+
146+
+
147+
+
120148

121149
# Configure the Windows RDP session application launcher.
122150
waConfigureWindows
123-
@@ -1682,18 +1682,15 @@ function waUninstall() {
151+
@@ -1677,18 +1657,15 @@ function waUninstall() {
124152
local DESKTOP_FILE_NAME="" # Stores the name of the '.desktop' file for the application.
125153
local BASH_SCRIPT_NAME="" # Stores the name of the application.
126154

@@ -129,7 +157,7 @@ index 6aa9b574..9fbefe65 100755
129157
- $SUDO rm -f "${BIN_PATH}/winapps-setup"
130158
-
131159
# Remove WinApps configuration data, temporary files and logs.
132-
+ chmod -R +rw "$USER_APPDATA_PATH"
160+
+ chmod -R +rw "$USER_APPDATA_PATH"
133161
rm -rf "$USER_APPDATA_PATH"
134162

135163
# Remove application icons and shortcuts.
@@ -141,7 +169,7 @@ index 6aa9b574..9fbefe65 100755
141169

142170
# Remove each '.desktop' file.
143171
for DESKTOP_FILE_PATH in "${WINAPPS_DESKTOP_FILES[@]}"; do
144-
@@ -1714,7 +1711,7 @@ function waUninstall() {
172+
@@ -1709,7 +1686,7 @@ function waUninstall() {
145173
done
146174

147175
# Store the paths of bash scripts calling 'WinApps' to launch specific applications in an array, returning an empty array if no such files exist.
@@ -150,7 +178,7 @@ index 6aa9b574..9fbefe65 100755
150178

151179
# Remove each bash script.
152180
for BASH_SCRIPT_PATH in "${WINAPPS_APP_BASH_SCRIPTS[@]}"; do
153-
@@ -1735,10 +1732,9 @@ function waUninstall() {
181+
@@ -1730,10 +1707,9 @@ function waUninstall() {
154182
done
155183

156184
# Print caveats.

0 commit comments

Comments
 (0)