Added installer support for FreeRDP Flatpak.

This commit is contained in:
Rohan Barar 2024-07-16 18:46:14 +10:00
parent 08324b2a75
commit 66a2d9e365
3 changed files with 38 additions and 7 deletions

View File

@ -107,7 +107,7 @@ If you already have a Windows VM or server you wish to use with WinApps, you wil
sudo emerge --ask=n sys-libs/dialog net-misc/freerdp:3 sudo emerge --ask=n sys-libs/dialog net-misc/freerdp:3
``` ```
> WinApps requires `FreeRDP v3` or later. If not available for your distribution through your package manager, you can install the [Flatpak](https://github.com/FreeRDP/FreeRDP/wiki/Prebuilds). > WinApps requires `FreeRDP` version 3 or later. If not available for your distribution through your package manager, you can install the [Flatpak](https://flathub.org/apps/com.freerdp.FreeRDP).
### Step 3: Create a WinApps Configuration File ### Step 3: Create a WinApps Configuration File
Create a configuration file at `~/.config/winapps/winapps.conf` containing the following: Create a configuration file at `~/.config/winapps/winapps.conf` containing the following:

View File

@ -120,6 +120,7 @@ elif [ "$1" = "manual" ]; then
"/app:program:${2}" "/app:program:${2}"
"/v:${RDP_IP}" "/v:${RDP_IP}"
) )
echo "${COMMAND[@]}"
# 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
"${COMMAND[@]}" 1>/dev/null 2>&1 & "${COMMAND[@]}" 1>/dev/null 2>&1 &
elif [ "$1" != "install" ]; then elif [ "$1" != "install" ]; then

View File

@ -424,6 +424,9 @@ function waLoadConfig() {
# Name: 'waCheckDependencies' # Name: 'waCheckDependencies'
# Role: Terminate script if dependencies are missing. # Role: Terminate script if dependencies are missing.
function waCheckDependencies() { function waCheckDependencies() {
# Declare variables.
local FREERDP_MAJOR_VERSION="" # Stores the major version of the installed copy of FreeRDP.
# Print feedback. # Print feedback.
echo -n "Checking whether all dependencies are installed... " echo -n "Checking whether all dependencies are installed... "
@ -457,14 +460,36 @@ function waCheckDependencies() {
# 'FreeRDP' (Version 3). # 'FreeRDP' (Version 3).
# Attempt to set a FreeRDP command if the command variable is empty. # Attempt to set a FreeRDP command if the command variable is empty.
if [ -z "$FREERDP_COMMAND" ]; then if [ -z "$FREERDP_COMMAND" ]; then
# Check common commands used to launch FreeRDP.
if command -v xfreerdp &>/dev/null; then if command -v xfreerdp &>/dev/null; then
FREERDP_COMMAND="xfreerdp" # Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && (( $FREERDP_MAJOR_VERSION >= 3 )); then
FREERDP_COMMAND="xfreerdp"
fi
elif command -v xfreerdp3 &>/dev/null; then elif command -v xfreerdp3 &>/dev/null; then
FREERDP_COMMAND="xfreerdp3" # Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp3 --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && (( $FREERDP_MAJOR_VERSION >= 3 )); then
FREERDP_COMMAND="xfreerdp3"
fi
fi
# Check for FreeRDP flatpak as a fallback option.
if [ -z "$FREERDP_COMMAND" ]; then
if command -v flatpak &>/dev/null; then
if flatpak list --columns=application | grep -q "^com.freerdp.FreeRDP$"; then
# Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(flatpak list --columns=application,version | grep "^com.freerdp.FreeRDP" | awk '{print $2}' | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && (( $FREERDP_MAJOR_VERSION >= 3 )); then
FREERDP_COMMAND="flatpak run --command=xfreerdp com.freerdp.FreeRDP"
fi
fi
fi
fi fi
fi fi
if ! command -v "$FREERDP_COMMAND" &>/dev/null; then if ! command -v "$FREERDP_COMMAND" &>/dev/null && [ "$FREERDP_COMMAND" != "flatpak run --command=xfreerdp com.freerdp.FreeRDP" ]; 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"
@ -472,7 +497,7 @@ function waCheckDependencies() {
echo -e "${ERROR_TEXT}ERROR:${CLEAR_TEXT} ${BOLD_TEXT}MISSING DEPENDENCIES.${CLEAR_TEXT}" echo -e "${ERROR_TEXT}ERROR:${CLEAR_TEXT} ${BOLD_TEXT}MISSING DEPENDENCIES.${CLEAR_TEXT}"
# Display the error details. # Display the error details.
echo -e "${INFO_TEXT}Please install 'FreeRDP' to proceed.${CLEAR_TEXT}" echo -e "${INFO_TEXT}Please install 'FreeRDP' version 3 to proceed.${CLEAR_TEXT}"
# Display the suggested action(s). # Display the suggested action(s).
echo "--------------------------------------------------------------------------------" echo "--------------------------------------------------------------------------------"
@ -484,6 +509,11 @@ function waCheckDependencies() {
echo -e " ${COMMAND_TEXT}sudo pacman -S freerdp${CLEAR_TEXT}" echo -e " ${COMMAND_TEXT}sudo pacman -S freerdp${CLEAR_TEXT}"
echo "Gentoo Linux systems:" echo "Gentoo Linux systems:"
echo -e " ${COMMAND_TEXT}sudo emerge --ask net-misc/freerdp${CLEAR_TEXT}" echo -e " ${COMMAND_TEXT}sudo emerge --ask net-misc/freerdp${CLEAR_TEXT}"
echo ""
echo "You can also install FreeRDP as a Flatpak."
echo "Install Flatpak, add the Flathub repository and then install FreeRDP:"
echo -e "${COMMAND_TEXT}flatpak install flathub com.freerdp.FreeRDP${CLEAR_TEXT}"
echo -e "${COMMAND_TEST}sudo flatpak override --filesystem=home com.freerdp.FreeRDP${CLEAR_TEXT}"
echo "--------------------------------------------------------------------------------" echo "--------------------------------------------------------------------------------"
# Terminate the script. # Terminate the script.
@ -712,7 +742,7 @@ function waCheckRDPAccess() {
# Note: The following final line is expected within the log, indicating successful execution of the 'tsdiscon' command and termination of the RDP session. # Note: The following final line is expected within the log, indicating successful execution of the 'tsdiscon' command and termination of the RDP session.
# [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server. # [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server.
# shellcheck disable=SC2140,SC2027 # Disable warnings regarding unquoted strings. # shellcheck disable=SC2140,SC2027 # Disable warnings regarding unquoted strings.
"$FREERDP_COMMAND" \ $FREERDP_COMMAND \
/cert:tofu \ /cert:tofu \
/d:"$RDP_DOMAIN" \ /d:"$RDP_DOMAIN" \
/u:"$RDP_USER" \ /u:"$RDP_USER" \
@ -840,7 +870,7 @@ function waFindInstalled() {
# Note: The following final line is expected within the log, indicating successful execution of the 'tsdiscon' command and termination of the RDP session. # Note: The following final line is expected within the log, indicating successful execution of the 'tsdiscon' command and termination of the RDP session.
# [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server. # [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server.
# shellcheck disable=SC2140,SC2027 # Disable warnings regarding unquoted strings. # shellcheck disable=SC2140,SC2027 # Disable warnings regarding unquoted strings.
"$FREERDP_COMMAND" \ $FREERDP_COMMAND \
/cert:tofu \ /cert:tofu \
/d:"$RDP_DOMAIN" \ /d:"$RDP_DOMAIN" \
/u:"$RDP_USER" \ /u:"$RDP_USER" \