mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-03 05:37:19 +02:00
Fixed infinite loop on install
This commit is contained in:
parent
067dcfbfee
commit
630f21a76a
53
install.sh
53
install.sh
@ -9,30 +9,42 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
# Check for installed apps
|
||||
echo -n " Checking for installed apps in RDP machine..."
|
||||
rm -f ${HOME}/.winapps.installed.bat
|
||||
rm -f ${HOME}/.winapps.installed
|
||||
rm -f ${HOME}/.local/share/winapps/installed.bat
|
||||
rm -f ${HOME}/.local/share/winapps/installed
|
||||
for F in $(ls "${DIR}/apps"); do
|
||||
. "${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;
|
||||
touch ${HOME}/.winapps.installed
|
||||
LAST_RAN=$(stat -t -c %Y ${HOME}/.winapps.installed)
|
||||
echo "ECHO DONE >> \\\\tsclient\\home\\.local\\share\\winapps\\installed" >> ${HOME}/.local/share/winapps/installed.bat
|
||||
touch ${HOME}/.local/share/winapps/installed
|
||||
LAST_RAN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
|
||||
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
|
||||
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
|
||||
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
|
||||
echo ""
|
||||
echo " Finished."
|
||||
cat ${HOME}/.local/share/winapps/installed
|
||||
|
||||
# Install apps
|
||||
for F in $(cat "${HOME}/.winapps.installed" |sed 's/\r/\n/g'); do
|
||||
. "${DIR}/apps/${F}/info"
|
||||
echo -n " Configuring ${NAME}..."
|
||||
sudo rm -f "/usr/share/applications/${F}.desktop"
|
||||
echo "[Desktop Entry]
|
||||
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"
|
||||
echo -n " Configuring ${NAME}..."
|
||||
sudo rm -f "/usr/share/applications/${F}.desktop"
|
||||
echo "[Desktop Entry]
|
||||
Name=${NAME}
|
||||
Exec=${DIR}/bin/winapps ${F} %F
|
||||
Terminal=false
|
||||
@ -47,11 +59,16 @@ MimeType=${MIME_TYPES}
|
||||
echo "#!/usr/bin/env bash
|
||||
${DIR}/bin/winapps ${F} $@
|
||||
" |sudo tee "/usr/local/bin/${F}" > /dev/null
|
||||
sudo chmod a+x "/usr/local/bin/${F}"
|
||||
echo " Finished."
|
||||
sudo chmod a+x "/usr/local/bin/${F}"
|
||||
echo " Finished."
|
||||
fi
|
||||
done
|
||||
rm -f "${HOME}/.winapps.installed"
|
||||
rm -f "${HOME}/.winapps.installed.bat"
|
||||
rm -f "${HOME}/.local/share/winapps/installed"
|
||||
rm -f "${HOME}/.local/share/winapps/installed.bat"
|
||||
if (( $COUNT == 0 )); then
|
||||
echo " No configured applications were found."
|
||||
fi
|
||||
|
||||
|
||||
# Install windows
|
||||
echo -n " Configuring Windows..."
|
||||
|
Loading…
x
Reference in New Issue
Block a user