Skip to content

Commit

Permalink
Merge pull request #208 from escapefreeg/main
Browse files Browse the repository at this point in the history
optimize the logic for detecting the FreeRDP command
  • Loading branch information
oskardotglobal authored Aug 22, 2024
2 parents b6f6a93 + b92a427 commit 6381732
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
16 changes: 10 additions & 6 deletions bin/winapps
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,16 @@ function waGetFreeRDPCommand() {
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp"
fi
# Check for 'xfreerdp3'.
elif command -v xfreerdp3 &>/dev/null; then
# Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp3 --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | head -n 1 | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp3"
fi

# Check for 'xfreerdp3' command as a fallback option.
if [ -z "$FREERDP_COMMAND" ]; then
if command -v xfreerdp3 &>/dev/null; then
# Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp3 --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | head -n 1 | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp3"
fi
fi
fi

Expand Down
15 changes: 10 additions & 5 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,16 @@ function waCheckInstallDependencies() {
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp"
fi
elif command -v xfreerdp3 &>/dev/null; then
# Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp3 --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | head -n 1 | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp3"
fi

# Check for xfreerdp3 command as a fallback option.
if [ -z "$FREERDP_COMMAND" ]; then
if command -v xfreerdp3 &>/dev/null; then
# Check FreeRDP major version is 3 or greater.
FREERDP_MAJOR_VERSION=$(xfreerdp3 --version | head -n 1 | grep -o -m 1 '\b[0-9]\S*' | head -n 1 | cut -d'.' -f1)
if [[ $FREERDP_MAJOR_VERSION =~ ^[0-9]+$ ]] && ((FREERDP_MAJOR_VERSION >= 3)); then
FREERDP_COMMAND="xfreerdp3"
fi
fi
fi

Expand Down

0 comments on commit 6381732

Please sign in to comment.