mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-05 22:57:19 +02:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
fb1c3f4805
commit
a3ed167291
13
bin/winapps
13
bin/winapps
@ -44,15 +44,12 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${FREERDP_COMMAND}" ]; then
|
if [ -z "${FREERDP_COMMAND}" ]; then
|
||||||
if command -v xfreerdp &> /dev/null
|
if command -v xfreerdp &>/dev/null; then
|
||||||
then
|
|
||||||
FREERDP_COMMAND="xfreerdp"
|
FREERDP_COMMAND="xfreerdp"
|
||||||
elif command -v xfreerdp3 &> /dev/null
|
elif command -v xfreerdp3 &>/dev/null; then
|
||||||
then
|
|
||||||
FREERDP_COMMAND="xfreerdp3"
|
FREERDP_COMMAND="xfreerdp3"
|
||||||
fi
|
fi
|
||||||
elif command -v "$FREERDP_COMMAND" &> /dev/null
|
elif command -v "$FREERDP_COMMAND" &>/dev/null; then
|
||||||
then
|
|
||||||
dprint "Using custom freerdp command $FREERDP_COMMAND"
|
dprint "Using custom freerdp command $FREERDP_COMMAND"
|
||||||
else
|
else
|
||||||
echo "You have supplied a custom FreeRDP command, but the command is not available."
|
echo "You have supplied a custom FreeRDP command, but the command is not available."
|
||||||
@ -86,7 +83,7 @@ if [ "$MULTIMON" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Append additional flags or parameters to FreeRDP
|
# Append additional flags or parameters to FreeRDP
|
||||||
if [[ -n "$RDP_FLAGS" ]]; then
|
if [[ -n $RDP_FLAGS ]]; then
|
||||||
FREERDP_COMMAND="$FREERDP_COMMAND $RDP_FLAGS"
|
FREERDP_COMMAND="$FREERDP_COMMAND $RDP_FLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -120,7 +117,7 @@ elif [ "$1" = "windows" ]; then
|
|||||||
"+dynamic-resolution"
|
"+dynamic-resolution"
|
||||||
"+auto-reconnect"
|
"+auto-reconnect"
|
||||||
"+home-drive"
|
"+home-drive"
|
||||||
"/wm-class:\"Microsoft Windows\""
|
'/wm-class:"Microsoft Windows"'
|
||||||
"/v:${RDP_IP}"
|
"/v:${RDP_IP}"
|
||||||
)
|
)
|
||||||
# Run the command in the background, redirecting both stdout and stderr to /dev/null
|
# Run the command in the background, redirecting both stdout and stderr to /dev/null
|
||||||
|
@ -83,7 +83,7 @@ function inqMenu() {
|
|||||||
2>&1 >/dev/tty) || exit 0
|
2>&1 >/dev/tty) || exit 0
|
||||||
|
|
||||||
# Remove white space added previously.
|
# Remove white space added previously.
|
||||||
RETURN_STRING=$(echo "$SELECTED_OPTIONS_STRING" | \
|
RETURN_STRING=$(echo "$SELECTED_OPTIONS_STRING" |
|
||||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
|
||||||
# Remove escapes (introduced by 'dialog' if options have parentheses).
|
# Remove escapes (introduced by 'dialog' if options have parentheses).
|
||||||
@ -168,8 +168,8 @@ function inqChkBx() {
|
|||||||
# Convert the output string into an array.
|
# Convert the output string into an array.
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
while IFS= read -r LINE; do
|
while IFS= read -r LINE; do
|
||||||
LINE="${LINE/#\"}" # Remove leading double quote.
|
LINE="${LINE/#\"/}" # Remove leading double quote.
|
||||||
LINE="${LINE/%\"}" # Remove trailing double quote.
|
LINE="${LINE/%\"/}" # Remove trailing double quote.
|
||||||
RETURN_ARRAY+=("$LINE") # Add to array.
|
RETURN_ARRAY+=("$LINE") # Add to array.
|
||||||
done < <(echo "$SELECTED_OPTIONS_STRING" | sed 's/\" \"/\"\n\"/g')
|
done < <(echo "$SELECTED_OPTIONS_STRING" | sed 's/\" \"/\"\n\"/g')
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ function inqChkBx() {
|
|||||||
for ((i = 0; i < ${#RETURN_ARRAY[@]}; i++)); do
|
for ((i = 0; i < ${#RETURN_ARRAY[@]}; i++)); do
|
||||||
# Remove white space added previously.
|
# Remove white space added previously.
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
RETURN_ARRAY[i]=$(echo "${RETURN_ARRAY[i]}" | \
|
RETURN_ARRAY[i]=$(echo "${RETURN_ARRAY[i]}" |
|
||||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
|
||||||
# Remove escapes (introduced by 'dialog' if options have parentheses).
|
# Remove escapes (introduced by 'dialog' if options have parentheses).
|
||||||
|
61
installer.sh
61
installer.sh
@ -33,15 +33,15 @@ readonly EC_APPQUERY_FAIL="14" # Failed to query the Windows VM for in
|
|||||||
# 'BIN'
|
# 'BIN'
|
||||||
readonly SYS_BIN_PATH="/usr/local/bin" # UNIX path to 'bin' directory for a '--system' WinApps installation.
|
readonly SYS_BIN_PATH="/usr/local/bin" # UNIX path to 'bin' directory for a '--system' WinApps installation.
|
||||||
readonly USER_BIN_PATH="${HOME}/.local/bin" # UNIX path to 'bin' directory for a '--user' WinApps installation.
|
readonly USER_BIN_PATH="${HOME}/.local/bin" # UNIX path to 'bin' directory for a '--user' WinApps installation.
|
||||||
readonly USER_BIN_PATH_WIN="\\\\tsclient\\home\\.local\\bin" # WINDOWS path to 'bin' directory for a '--user' WinApps installation.
|
readonly USER_BIN_PATH_WIN='\\tsclient\home\.local\bin' # WINDOWS path to 'bin' directory for a '--user' WinApps installation.
|
||||||
# 'APP'
|
# 'APP'
|
||||||
readonly SYS_APP_PATH="/usr/share/applications" # UNIX path to 'applications' directory for a '--system' WinApps installation.
|
readonly SYS_APP_PATH="/usr/share/applications" # UNIX path to 'applications' directory for a '--system' WinApps installation.
|
||||||
readonly USER_APP_PATH="${HOME}/.local/share/applications" # UNIX path to 'applications' directory for a '--user' WinApps installation.
|
readonly USER_APP_PATH="${HOME}/.local/share/applications" # UNIX path to 'applications' directory for a '--user' WinApps installation.
|
||||||
readonly USER_APP_PATH_WIN="\\\\tsclient\\home\\.local\\share\\applications" # WINDOWS oath to 'applications' directory for a '--user' WinApps installation.
|
readonly USER_APP_PATH_WIN='\\tsclient\home\.local\share\applications' # WINDOWS oath to 'applications' directory for a '--user' WinApps installation.
|
||||||
# 'APPDATA'
|
# 'APPDATA'
|
||||||
readonly SYS_APPDATA_PATH="/usr/local/share/winapps" # UNIX path to 'application data' directory for a '--system' WinApps installation.
|
readonly SYS_APPDATA_PATH="/usr/local/share/winapps" # UNIX path to 'application data' directory for a '--system' WinApps installation.
|
||||||
readonly USER_APPDATA_PATH="${HOME}/.local/share/winapps" # UNIX path to 'application data' directory for a '--user' WinApps installation.
|
readonly USER_APPDATA_PATH="${HOME}/.local/share/winapps" # UNIX path to 'application data' directory for a '--user' WinApps installation.
|
||||||
readonly USER_APPDATA_PATH_WIN="\\\\tsclient\\home\\.local\\share\\winapps" # WINDOWS path to 'application data' directory for a '--user' WinApps installation.
|
readonly USER_APPDATA_PATH_WIN='\\tsclient\home\.local\share\winapps' # WINDOWS path to 'application data' directory for a '--user' WinApps installation.
|
||||||
# 'Installed Batch Script'
|
# 'Installed Batch Script'
|
||||||
readonly BATCH_SCRIPT_PATH="${USER_APPDATA_PATH}/installed.bat" # UNIX path to a batch script used to search the Windows VM for applications.
|
readonly BATCH_SCRIPT_PATH="${USER_APPDATA_PATH}/installed.bat" # UNIX path to a batch script used to search the Windows VM for applications.
|
||||||
readonly BATCH_SCRIPT_PATH_WIN="${USER_APPDATA_PATH_WIN}\\installed.bat" # WINDOWS path to a batch script used to search the Windows VM for applications.
|
readonly BATCH_SCRIPT_PATH_WIN="${USER_APPDATA_PATH_WIN}\\installed.bat" # WINDOWS path to a batch script used to search the Windows VM for applications.
|
||||||
@ -68,16 +68,15 @@ readonly INQUIRER_PATH="./install/inquirer.sh"
|
|||||||
# REMOTE DESKTOP CONFIGURATION
|
# REMOTE DESKTOP CONFIGURATION
|
||||||
readonly VM_NAME="RDPWindows" # Name of the Windows VM.
|
readonly VM_NAME="RDPWindows" # Name of the Windows VM.
|
||||||
readonly RDP_PORT=3389 # Port used for RDP on the Windows VM.
|
readonly RDP_PORT=3389 # Port used for RDP on the Windows VM.
|
||||||
readonly WINAPPS_CONFIG="\
|
readonly WINAPPS_CONFIG='RDP_USER="MyWindowsUser"
|
||||||
RDP_USER=\"MyWindowsUser\"
|
RDP_PASS="MyWindowsPassword"
|
||||||
RDP_PASS=\"MyWindowsPassword\"
|
#RDP_DOMAIN="MYDOMAIN"
|
||||||
#RDP_DOMAIN=\"MYDOMAIN\"
|
#RDP_IP="192.168.123.111"
|
||||||
#RDP_IP=\"192.168.123.111\"
|
|
||||||
#RDP_SCALE=100
|
#RDP_SCALE=100
|
||||||
#RDP_FLAGS=\"\"
|
#RDP_FLAGS=""
|
||||||
#MULTIMON=\"true\"
|
#MULTIMON="true"
|
||||||
#DEBUG=\"true\"
|
#DEBUG="true"
|
||||||
#FREERDP_COMMAND=\"xfreerdp\"" # Default WinApps configuration file content.
|
#FREERDP_COMMAND="xfreerdp"' # Default WinApps configuration file content.
|
||||||
|
|
||||||
### GLOBAL VARIABLES ###
|
### GLOBAL VARIABLES ###
|
||||||
# USER INPUT
|
# USER INPUT
|
||||||
@ -219,7 +218,7 @@ function waCheckInput() {
|
|||||||
inqMenu "Install or uninstall WinApps?" OPTIONS SELECTED_OPTION
|
inqMenu "Install or uninstall WinApps?" OPTIONS SELECTED_OPTION
|
||||||
|
|
||||||
# Set flags.
|
# Set flags.
|
||||||
if [[ "$SELECTED_OPTION" == "Uninstall" ]]; then
|
if [[ $SELECTED_OPTION == "Uninstall" ]]; then
|
||||||
OPT_UNINSTALL=1
|
OPT_UNINSTALL=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -228,9 +227,9 @@ function waCheckInput() {
|
|||||||
inqMenu "Configure WinApps for the current user '$(whoami)' or the whole system?" OPTIONS SELECTED_OPTION
|
inqMenu "Configure WinApps for the current user '$(whoami)' or the whole system?" OPTIONS SELECTED_OPTION
|
||||||
|
|
||||||
# Set flags.
|
# Set flags.
|
||||||
if [[ "$SELECTED_OPTION" == "Current User" ]]; then
|
if [[ $SELECTED_OPTION == "Current User" ]]; then
|
||||||
OPT_USER=1
|
OPT_USER=1
|
||||||
elif [[ "$SELECTED_OPTION" == "System" ]]; then
|
elif [[ $SELECTED_OPTION == "System" ]]; then
|
||||||
OPT_SYSTEM=1
|
OPT_SYSTEM=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -240,7 +239,7 @@ function waCheckInput() {
|
|||||||
inqMenu "Automatically install supported applications or choose manually?" OPTIONS SELECTED_OPTION
|
inqMenu "Automatically install supported applications or choose manually?" OPTIONS SELECTED_OPTION
|
||||||
|
|
||||||
# Set flags.
|
# Set flags.
|
||||||
if [[ "$SELECTED_OPTION" == "Automatic" ]]; then
|
if [[ $SELECTED_OPTION == "Automatic" ]]; then
|
||||||
OPT_AOSA=1
|
OPT_AOSA=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -571,7 +570,7 @@ function waCheckVMRunning() {
|
|||||||
# Obtain VM Status
|
# Obtain VM Status
|
||||||
VM_STATE=$(virsh list --all | grep -w "$VM_NAME")
|
VM_STATE=$(virsh list --all | grep -w "$VM_NAME")
|
||||||
|
|
||||||
if [[ "$VM_STATE" == *"shut off"* ]]; then
|
if [[ $VM_STATE == *"shut off"* ]]; then
|
||||||
# Complete the previous line.
|
# Complete the previous line.
|
||||||
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
||||||
|
|
||||||
@ -589,7 +588,7 @@ function waCheckVMRunning() {
|
|||||||
|
|
||||||
# Terminate the script.
|
# Terminate the script.
|
||||||
return "$EC_VM_OFF"
|
return "$EC_VM_OFF"
|
||||||
elif [[ "$VM_STATE" == *"paused"* ]]; then
|
elif [[ $VM_STATE == *"paused"* ]]; then
|
||||||
# Complete the previous line.
|
# Complete the previous line.
|
||||||
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
||||||
|
|
||||||
@ -607,7 +606,7 @@ function waCheckVMRunning() {
|
|||||||
|
|
||||||
# Terminate the script.
|
# Terminate the script.
|
||||||
return "$EC_VM_PAUSED"
|
return "$EC_VM_PAUSED"
|
||||||
elif [[ "$VM_STATE" != *"running"* ]]; then
|
elif [[ $VM_STATE != *"running"* ]]; then
|
||||||
# Complete the previous line.
|
# Complete the previous line.
|
||||||
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
||||||
|
|
||||||
@ -723,9 +722,7 @@ function waCheckRDPAccess() {
|
|||||||
+home-drive \
|
+home-drive \
|
||||||
-wallpaper \
|
-wallpaper \
|
||||||
+dynamic-resolution \
|
+dynamic-resolution \
|
||||||
/app:\
|
/app:program:"C:\Windows\System32\cmd.exe",cmd:"/C type NUL > "$TEST_PATH_WIN" && tsdiscon" \
|
||||||
program:"C:\Windows\System32\cmd.exe",\
|
|
||||||
cmd:"/C type NUL > "$TEST_PATH_WIN" && tsdiscon" \
|
|
||||||
/v:"$RDP_IP" &>"$FREERDP_LOG" &
|
/v:"$RDP_IP" &>"$FREERDP_LOG" &
|
||||||
|
|
||||||
# Store the FreeRDP process ID.
|
# Store the FreeRDP process ID.
|
||||||
@ -853,9 +850,7 @@ function waFindInstalled() {
|
|||||||
+home-drive \
|
+home-drive \
|
||||||
-wallpaper \
|
-wallpaper \
|
||||||
+dynamic-resolution \
|
+dynamic-resolution \
|
||||||
/app:\
|
/app:program:"C:\Windows\System32\cmd.exe",cmd:"/C "$BATCH_SCRIPT_PATH_WIN"" \
|
||||||
program:"C:\Windows\System32\cmd.exe",\
|
|
||||||
cmd:"/C "$BATCH_SCRIPT_PATH_WIN"" \
|
|
||||||
/v:"$RDP_IP" &>"$FREERDP_LOG" &
|
/v:"$RDP_IP" &>"$FREERDP_LOG" &
|
||||||
|
|
||||||
# Store the FreeRDP process ID.
|
# Store the FreeRDP process ID.
|
||||||
@ -1080,7 +1075,7 @@ function waConfigureApps() {
|
|||||||
inqMenu "How would you like to handle officially supported applications?" OPTIONS APP_INSTALL
|
inqMenu "How would you like to handle officially supported applications?" OPTIONS APP_INSTALL
|
||||||
|
|
||||||
# Remove unselected officially supported applications from the 'install' file.
|
# Remove unselected officially supported applications from the 'install' file.
|
||||||
if [[ "$APP_INSTALL" == "Choose specific officially supported applications to set up" ]]; then
|
if [[ $APP_INSTALL == "Choose specific officially supported applications to set up" ]]; then
|
||||||
inqChkBx "Which officially supported applications would you like to set up?" APPS SELECTED_APPS
|
inqChkBx "Which officially supported applications would you like to set up?" APPS SELECTED_APPS
|
||||||
|
|
||||||
# Clear/create the 'install' file.
|
# Clear/create the 'install' file.
|
||||||
@ -1099,7 +1094,7 @@ function waConfigureApps() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure selected (or all) officially supported applications.
|
# Configure selected (or all) officially supported applications.
|
||||||
if [[ "$APP_INSTALL" != "Skip setting up any officially supported applications" ]]; then
|
if [[ $APP_INSTALL != "Skip setting up any officially supported applications" ]]; then
|
||||||
waConfigureOfficiallySupported
|
waConfigureOfficiallySupported
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -1143,7 +1138,7 @@ function waConfigureDetectedApps() {
|
|||||||
EXE_FILENAME_NOEXT="${EXE_FILENAME%.*}"
|
EXE_FILENAME_NOEXT="${EXE_FILENAME%.*}"
|
||||||
|
|
||||||
# Check if the executable was previously configured as part of setting up officially supported applications.
|
# Check if the executable was previously configured as part of setting up officially supported applications.
|
||||||
if [[ ! " ${INSTALLED_EXES[*]} " == *" ${EXE_FILENAME_LOWERCASE} "* ]]; then
|
if [[ " ${INSTALLED_EXES[*]} " != *" ${EXE_FILENAME_LOWERCASE} "* ]]; then
|
||||||
# If not previously configured, add the application to the list of detected applications.
|
# If not previously configured, add the application to the list of detected applications.
|
||||||
APPS+=("${NAMES[$INDEX]} (${EXE_FILENAME_NOEXT})")
|
APPS+=("${NAMES[$INDEX]} (${EXE_FILENAME_NOEXT})")
|
||||||
fi
|
fi
|
||||||
@ -1165,9 +1160,9 @@ function waConfigureDetectedApps() {
|
|||||||
inqMenu "How would you like to handle other detected applications?" OPTIONS APP_INSTALL
|
inqMenu "How would you like to handle other detected applications?" OPTIONS APP_INSTALL
|
||||||
|
|
||||||
# Store selected detected applications.
|
# Store selected detected applications.
|
||||||
if [[ "$APP_INSTALL" == "Select which applications to set up" ]]; then
|
if [[ $APP_INSTALL == "Select which applications to set up" ]]; then
|
||||||
inqChkBx "Which other applications would you like to set up?" APPS SELECTED_APPS
|
inqChkBx "Which other applications would you like to set up?" APPS SELECTED_APPS
|
||||||
elif [[ "$APP_INSTALL" == "Set up all detected applications" ]]; then
|
elif [[ $APP_INSTALL == "Set up all detected applications" ]]; then
|
||||||
readarray -t SELECTED_APPS <<<"${APPS[@]}"
|
readarray -t SELECTED_APPS <<<"${APPS[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1184,7 +1179,7 @@ function waConfigureDetectedApps() {
|
|||||||
# Loop through all detected applications to find the detected application being processed.
|
# Loop through all detected applications to find the detected application being processed.
|
||||||
for INDEX in "${!NAMES[@]}"; do
|
for INDEX in "${!NAMES[@]}"; do
|
||||||
# Check for a matching detected application entry.
|
# Check for a matching detected application entry.
|
||||||
if [[ "${NAMES[$INDEX]}" == "$PROGRAM_NAME" ]] && [[ "${EXES[$INDEX]}" == *"\\$EXE_FILENAME_NOEXT"* ]]; then
|
if [[ ${NAMES[$INDEX]} == "$PROGRAM_NAME" ]] && [[ ${EXES[$INDEX]} == *"\\$EXE_FILENAME_NOEXT"* ]]; then
|
||||||
# Print feedback.
|
# Print feedback.
|
||||||
echo -n "Creating an application entry for ${PROGRAM_NAME}... "
|
echo -n "Creating an application entry for ${PROGRAM_NAME}... "
|
||||||
|
|
||||||
@ -1237,14 +1232,14 @@ function waInstall() {
|
|||||||
waCheckDependencies
|
waCheckDependencies
|
||||||
|
|
||||||
# Update $MULTI_FLAG.
|
# Update $MULTI_FLAG.
|
||||||
if [[ "$MULTIMON" == "true" ]]; then
|
if [[ $MULTIMON == "true" ]]; then
|
||||||
MULTI_FLAG="/multimon"
|
MULTI_FLAG="/multimon"
|
||||||
else
|
else
|
||||||
MULTI_FLAG="+span"
|
MULTI_FLAG="+span"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Append additional FreeRDP flags if required.
|
# Append additional FreeRDP flags if required.
|
||||||
if [[ -n "$RDP_FLAGS" ]]; then
|
if [[ -n $RDP_FLAGS ]]; then
|
||||||
FREERDP_COMMAND="${FREERDP_COMMAND} ${RDP_FLAGS}"
|
FREERDP_COMMAND="${FREERDP_COMMAND} ${RDP_FLAGS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user