[go: up one dir, main page]

Skip to content

Commit

Permalink
Fix freerdp detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark42ed committed Apr 1, 2024
1 parent d19927e commit eca0c4b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
31 changes: 18 additions & 13 deletions bin/winapps
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,24 @@ else
touch "${HOME}/.local/share/winapps/run"
fi

if [ -z "$(which xfreerdp)" ]; then
if [ -n "$(which xfreerdp3)" ]; then
FREERDP="xfreerdp3"
FREERDP_VERSION="3"
elif [ -n "$(which xfreerdp)" ]; then
FREERDP="xfreerdp"
FREERDP_VERSION="2"
else
echo "You need xfreerdp!"
echo " sudo apt-get install -y freerdp2-x11"
exit
fi

# Verify freerdp version, some distros might
# package it differently.
if [[ `$FREERDP --version` =~ ([0-9]+)\.[0-9]+\.[0-9]+ ]]; then
FREERDP_VERSION="${BASH_REMATCH[1]}"
fi

if [ -z "${RDP_IP}" ]; then
if [ -z "$(groups |grep libvirt)" ]; then
echo "You are not a member of the libvirt group. Run the below then reboot."
Expand All @@ -72,29 +84,22 @@ if [ "${MULTIMON}" = "true" ]; then
MULTI_FLAG="multimon"
fi

FREERDP="xfreerdp"

FREERDP_VERSION="2"
if [[ `$FREERDP --version` =~ ([0-9]+)\.[0-9]+\.[0-9]+ ]]; then
FREERDP_VERSION="${BASH_REMATCH[1]}"
fi

if [ "${1}" = "windows" ]; then
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 &
else
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} /dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 &
fi
elif [ "${1}" = "check" ]; then
dprint "CHECK"
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} +dynamic-resolution /${MULTI_FLAG} /app:program:"explorer.exe"
else
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"explorer.exe"
fi
elif [ "${1}" = "manual" ]; then
dprint "MANUAL:${2}"
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} +dynamic-resolution /${MULTI_FLAG} /app:program:"${2}" 1> /dev/null 2>&1 &
else
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"${2}" 1> /dev/null 2>&1 &
Expand All @@ -118,13 +123,13 @@ elif [ "${1}" != "install" ]; then
dprint "HOME:${HOME}"
FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g')
dprint "FILE:${FILE}"
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} +dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",cmd:"\"${FILE}\"" 1> /dev/null 2>&1 &
else
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 &
fi
else
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} +dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}" 1> /dev/null 2>&1 &
else
$FREERDP ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 &
Expand Down
17 changes: 14 additions & 3 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ USEDEMO=0

INSTALLED_EXES=()

FREERDP="xfreerdp"
if [ -n "$(which xfreerdp3)" ]; then
FREERDP="xfreerdp3"
FREERDP_VERSION="3"
elif [ -n "$(which xfreerdp)" ]; then
FREERDP="xfreerdp"
FREERDP_VERSION="2"
else
echo "You need xfreerdp!"
echo " sudo apt-get install -y freerdp2-x11"
exit
fi

FREERDP_VERSION="2"
# Verify freerdp version, some some distros might
# package it differently.
if [[ `$FREERDP --version` =~ ([0-9]+)\.[0-9]+\.[0-9]+ ]]; then
FREERDP_VERSION="${BASH_REMATCH[1]}"
fi
Expand Down Expand Up @@ -48,7 +59,7 @@ function waFindInstalled() {
done;
echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >> ${HOME}/.local/share/winapps/installed.bat
echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >> ${HOME}/.local/share/winapps/installed.bat
if [[ "${FREERDP_VERSION}" = "3" ]]; then
if [ "${FREERDP_VERSION}" = "3" ]; then
$FREERDP /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"RDPInstaller" /app:program:"C:\Windows\System32\cmd.exe",icon:"${DIR}/../icons/windows.svg",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" 1> /dev/null 2>&1 &
else
$FREERDP /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"RDPInstaller" /app:"C:\Windows\System32\cmd.exe" /app-icon:"${DIR}/../icons/windows.svg" /app-cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" 1> /dev/null 2>&1 &
Expand Down

0 comments on commit eca0c4b

Please sign in to comment.