Fixed infinite loop on install

This commit is contained in:
Fmstrat 2020-11-10 15:36:03 -05:00 committed by Oskar Manhart
parent 067dcfbfee
commit 630f21a76a

View File

@ -9,26 +9,38 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Check for installed apps # Check for installed apps
echo -n " Checking for installed apps in RDP machine..." echo -n " Checking for installed apps in RDP machine..."
rm -f ${HOME}/.winapps.installed.bat rm -f ${HOME}/.local/share/winapps/installed.bat
rm -f ${HOME}/.winapps.installed rm -f ${HOME}/.local/share/winapps/installed
for F in $(ls "${DIR}/apps"); do for F in $(ls "${DIR}/apps"); do
. "${DIR}/apps/${F}/info" . "${DIR}/apps/${F}/info"
echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.winapps.installed" >> ${HOME}/.winapps.installed.bat echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed" >> ${HOME}/.local/share/winapps/installed.bat
done; done;
touch ${HOME}/.winapps.installed echo "ECHO DONE >> \\\\tsclient\\home\\.local\\share\\winapps\\installed" >> ${HOME}/.local/share/winapps/installed.bat
LAST_RAN=$(stat -t -c %Y ${HOME}/.winapps.installed) touch ${HOME}/.local/share/winapps/installed
LAST_RAN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
sleep 6 sleep 6
xfreerdp /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\\.winapps.installed.bat" 1> /dev/null 2>&1 & xfreerdp /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 &
sleep 6 sleep 6
THIS_RUN=$(stat -t -c %Y ${HOME}/.winapps.installed) COUNT=0
THIS_RUN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
while (( $THIS_RUN - $LAST_RAN < 5 )); do while (( $THIS_RUN - $LAST_RAN < 5 )); do
sleep 5 sleep 5
THIS_RUN=$(stat -t -c %Y ${HOME}/.winapps.installed) THIS_RUN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
COUNT=$((COUNT + 1))
if (( COUNT == 5 )); then
echo " Finished."
echo "The RDP connection failed to connect or run."
exit
fi
done done
echo "" echo " Finished."
cat ${HOME}/.local/share/winapps/installed
# Install apps # Install apps
for F in $(cat "${HOME}/.winapps.installed" |sed 's/\r/\n/g'); do COUNT=0
for F in $(cat "${HOME}/.local/share/winapps/installed" |sed 's/\r/\n/g'); do
if [ "${F}" != "DONE" ]; then
COUNT=$((COUNT + 1))
. "${DIR}/apps/${F}/info" . "${DIR}/apps/${F}/info"
echo -n " Configuring ${NAME}..." echo -n " Configuring ${NAME}..."
sudo rm -f "/usr/share/applications/${F}.desktop" sudo rm -f "/usr/share/applications/${F}.desktop"
@ -49,9 +61,14 @@ ${DIR}/bin/winapps ${F} $@
" |sudo tee "/usr/local/bin/${F}" > /dev/null " |sudo tee "/usr/local/bin/${F}" > /dev/null
sudo chmod a+x "/usr/local/bin/${F}" sudo chmod a+x "/usr/local/bin/${F}"
echo " Finished." echo " Finished."
fi
done done
rm -f "${HOME}/.winapps.installed" rm -f "${HOME}/.local/share/winapps/installed"
rm -f "${HOME}/.winapps.installed.bat" rm -f "${HOME}/.local/share/winapps/installed.bat"
if (( $COUNT == 0 )); then
echo " No configured applications were found."
fi
# Install windows # Install windows
echo -n " Configuring Windows..." echo -n " Configuring Windows..."