You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/bin/sh
-
- set -x
-
- # VPN
- NMCONN="49088a1e-18c2-48aa-a664-f212eb83a727"
- # RDP
- DEF_RESOLUTION="1920x1080"
- DRIVE="work,${HOME}/Documents/Work"
- DOMAIN="$(pass show Work/AD-LOGIN | awk '/domain:/ {print $2}')"
- USER="$(pass show Work/AD-LOGIN | awk '/user:/ {print $2}')"
- REMOTE="$(pass show Work/AD-LOGIN | awk '/remote:/ {print $2}')"
- PASSWORD="$(pass show Work/AD-LOGIN | head -1)"
-
- rdp() {
- # resolve REMOTE to IPv4 before connecting in order to avoid IPv6 usage
- REMOTE=$(dig ${REMOTE} A +short)
- # alternative to "dynamic-resolution" is "smart-sizing"
- if [ -z ${PASSWORD} ]; then
- PASWORD=$(zenity --entry --title="Password" \
- --text="Enter your _password:" --hide-text)
- fi
- xfreerdp /network:lan /gdi:hw +glyph-cache +fonts +aero \
- /bpp:32 /size:${DEF_RESOLUTION} /dynamic-resolution \
- /audio-mode:0 /sound:sys:pulse /microphone:sys:pulse \
- /kbd:German /drive:${DRIVE} \
- +auto-reconnect /auto-reconnect-max-retries:5 \
- /d:${DOMAIN} /u:${USER} /v:${REMOTE} /p:${PASSWORD}
- zenity --question --title="Disconnect?" \
- --text="RDP connection closed. Do you want to close the VPN connection too?" && \
- nmcli con down ${NMCONN}
- }
-
-
- if [ $(nmcli con show ${NMCONN} | awk '/GENERAL.STATE/ {print $2}') == "activated" ]; then
- rdp
- else
- nmcli --ask con up ${NMCONN}
- while [ $(nmcli con show ${NMCONN} | awk '/GENERAL.STATE/ {print $2}') != "activated" ]; do
- sleep 1
- done
- rdp
- fi
|