mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-06 07:07:18 +02:00
Add debug feature
This commit is contained in:
parent
2d5b3088a8
commit
bdd0e2e138
@ -33,9 +33,12 @@ You will need to create a `~/.config/winapps/winapps.conf` configuration file wi
|
|||||||
RDP_USER="MyWindowsUser"
|
RDP_USER="MyWindowsUser"
|
||||||
RDP_PASS="MyWindowsPassword"
|
RDP_PASS="MyWindowsPassword"
|
||||||
#RDP_IP="192.168.123.111"
|
#RDP_IP="192.168.123.111"
|
||||||
|
#DEBUG="true"
|
||||||
```
|
```
|
||||||
If you are using Option 2 below with a pre-existing non-KVM RDP server, you can use the `RDP_IP` to specify it's location. If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP.
|
If you are using Option 2 below with a pre-existing non-KVM RDP server, you can use the `RDP_IP` to specify it's location. If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP.
|
||||||
|
|
||||||
|
If you enable `DEBUG`, a log will be created on each application start in `~/.local/share/winapps/winapps.log`.
|
||||||
|
|
||||||
### Option 1 - Running KVM
|
### Option 1 - Running KVM
|
||||||
You can refer to the [KVM](https://www.linux-kvm.org) documentation for specifics, but the first thing you need to do is set up a Virtual Machine running Windows 10 Professional (or any version that supports RDP). Fist, clone WinApps and install KVM and FreeRDP:
|
You can refer to the [KVM](https://www.linux-kvm.org) documentation for specifics, but the first thing you need to do is set up a Virtual Machine running Windows 10 Professional (or any version that supports RDP). Fist, clone WinApps and install KVM and FreeRDP:
|
||||||
``` bash
|
``` bash
|
||||||
|
46
bin/winapps
46
bin/winapps
@ -1,16 +1,37 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$(dirname "$(readlink -f "$0")")"
|
DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
RUN="$(date)-${RANDOM}"
|
||||||
|
|
||||||
if [ -f /tmp/winapps ]; then
|
if [ ! -d "${HOME}/.local/share/winapps" ]; then
|
||||||
LAST_RAN=$(stat -t -c %Y /tmp/winapps)
|
mkdir -p "${HOME}/.local/share/winapps"
|
||||||
touch /tmp/winapps
|
fi
|
||||||
THIS_RUN=$(stat -t -c %Y /tmp/winapps)
|
|
||||||
|
if [ -f "${HOME}/.config/winapps/winapps.conf" ]; then
|
||||||
|
. "${HOME}/.config/winapps/winapps.conf"
|
||||||
|
else
|
||||||
|
. "${HOME}/.winapps"
|
||||||
|
fi
|
||||||
|
|
||||||
|
function dprint() {
|
||||||
|
if [ "${DEBUG}" = "true" ]; then
|
||||||
|
echo "[${RUN}] ${1}" >> "${HOME}/.local/share/winapps/winapps.log"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
dprint "START"
|
||||||
|
|
||||||
|
if [ -f "${HOME}/.local/share/winapps/run" ]; then
|
||||||
|
LAST_RAN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run")
|
||||||
|
dprint "LAST_RAN:${LAST_RAN}"
|
||||||
|
touch "${HOME}/.local/share/winapps/run"
|
||||||
|
THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run")
|
||||||
|
dprint "THIS_RUN:${THIS_RUN}"
|
||||||
if (( $THIS_RUN - $LAST_RAN < 2 )); then
|
if (( $THIS_RUN - $LAST_RAN < 2 )); then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
touch /tmp/winapps
|
touch "${HOME}/.local/share/winapps/run"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(which xfreerdp)" ]; then
|
if [ -z "$(which xfreerdp)" ]; then
|
||||||
@ -24,12 +45,6 @@ if [ ! -f "${HOME}/.config/winapps/winapps.conf" ] && [ ! -f "${HOME}/.winapps"
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "${HOME}/.config/winapps/winapps.conf" ]; then
|
|
||||||
. "${HOME}/.config/winapps/winapps.conf"
|
|
||||||
else
|
|
||||||
. "${HOME}/.winapps"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${RDP_IP}" ]; then
|
if [ -z "${RDP_IP}" ]; then
|
||||||
if [ -z "$(groups |grep libvirt)" ]; then
|
if [ -z "$(groups |grep libvirt)" ]; then
|
||||||
echo "You are not a member of the libvirt group. Run the below then reboot."
|
echo "You are not a member of the libvirt group. Run the below then reboot."
|
||||||
@ -46,14 +61,23 @@ if [ -z "${RDP_IP}" ]; then
|
|||||||
RDP_IP=${RDP_IP%%\/*}
|
RDP_IP=${RDP_IP%%\/*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dprint "1:${1}"
|
||||||
|
dprint "2:${2}"
|
||||||
|
dprint "@:${@}"
|
||||||
|
|
||||||
if [ "${1}" = "windows" ]; then
|
if [ "${1}" = "windows" ]; then
|
||||||
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 &
|
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 &
|
||||||
elif [ "${1}" != "install" ]; then
|
elif [ "${1}" != "install" ]; then
|
||||||
|
dprint "DIR:${DIR}"
|
||||||
. "${DIR}/../apps/${1}/info"
|
. "${DIR}/../apps/${1}/info"
|
||||||
if [ -n "${2}" ]; then
|
if [ -n "${2}" ]; then
|
||||||
|
dprint "HOME:${HOME}"
|
||||||
FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g')
|
FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g')
|
||||||
|
dprint "FILE:${HOME}"
|
||||||
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${DIR}/../apps/${1}/icon.svg" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 &
|
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${DIR}/../apps/${1}/icon.svg" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 &
|
||||||
else
|
else
|
||||||
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${DIR}/../apps/${1}/icon.svg" 1> /dev/null 2>&1 &
|
xfreerdp /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${DIR}/../apps/${1}/icon.svg" 1> /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dprint "END"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user