Updated installer for user vs system mode

This commit is contained in:
Fmstrat 2020-11-13 13:13:32 -05:00 committed by Oskar Manhart
parent 0ac0a448af
commit 8f0021d016
2 changed files with 92 additions and 14 deletions

View File

@ -157,10 +157,10 @@ You will see output from FreeRDP, as well as potentially have to accept the init
Then the final step is to run the installer:
``` bash
$ ./install.sh
[sudo] password for fmstrat:
$ ./installer.sh --user
Removing any old configurations...
Installing...
Checking for installed apps in RDP machine...
Checking for installed apps in RDP machine (this may take a while)... Finished.
Configuring Excel... Finished.
Configuring PowerPoint... Finished.
Configuring Word... Finished.
@ -209,10 +209,18 @@ WinApps offers a manual mode for running applications that are not configured. T
The installer can be run multiple times, so simply run:
``` bash
$ git pull
$ ./install.sh
[sudo] password for fmstrat:
$ ./installer.sh --user
Removing any old configurations...
Removing /home/fmstrat/.local/share/applications/excel.desktop... Finished.
Removing /home/fmstrat/.local/share/applications/powerpoint.desktop... Finished.
Removing /home/fmstrat/.local/share/applications/windows.desktop... Finished.
Removing /home/fmstrat/.local/share/applications/word.desktop... Finished.
Removing /home/fmstrat/.local/bin/excel... Finished.
Removing /home/fmstrat/.local/bin/powerpoint... Finished.
Removing /home/fmstrat/.local/bin/windows... Finished.
Removing /home/fmstrat/.local/bin/word... Finished.
Installing...
Checking for installed apps in RDP machine...
Checking for installed apps in RDP machine (this may take a while)... Finished.
Configuring Excel... Finished.
Configuring PowerPoint... Finished.
Configuring Word... Finished.
@ -220,6 +228,15 @@ Installing...
Installation complete.
```
## Installer usage
The following commands can be used to manage your application configurations:
``` bash
./installer.sh --user # Configure applications for the current user
./installer.sh --system # Configure applications for the entire system
./installer.sh --user --uninstall # Remove all configured applications for the current user
./installer.sh --system --uninstall # Remove all configured applications for the entire system
```
## Shout outs
- Some icons pulled from
- Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md)

View File

@ -2,11 +2,16 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function waUsage() {
echo 'Usage:
./install.sh --user # Install everything in ${HOME}
./install.sh --system # Install everything in /usr'
./installer.sh --user # Install everything in ${HOME}
./installer.sh --system # Install everything in /usr'
exit
}
function waNoSudo() {
echo 'You are attempting to switch from a --system install to a --user install.
Please run "./installer.sh --system --uninstall" first.'
exit
}
@ -15,7 +20,7 @@ function waInstall() {
}
function waFindInstalled() {
echo -n " Checking for installed apps in RDP machine..."
echo -n " Checking for installed apps in RDP machine (this may take a while)..."
rm -f ${HOME}/.local/share/winapps/installed.bat
rm -f ${HOME}/.local/share/winapps/installed
for F in $(ls "${DIR}/apps"); do
@ -25,13 +30,13 @@ function waFindInstalled() {
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
sleep 15
xfreerdp /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 &
sleep 6
sleep 15
COUNT=0
THIS_RUN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
while (( $THIS_RUN - $LAST_RAN < 5 )); do
sleep 5
sleep 15
THIS_RUN=$(stat -t -c %Y ${HOME}/.local/share/winapps/installed)
COUNT=$((COUNT + 1))
if (( COUNT == 5 )); then
@ -65,7 +70,7 @@ MimeType=${MIME_TYPES}
${SUDO} rm -f "${BIN_PATH}/${F}"
echo "#!/usr/bin/env bash
${DIR}/bin/winapps ${F} $@
" |${SUDO} tee "/usr/local/bin/${F}" > /dev/null
" |${SUDO} tee "${BIN_PATH}/${F}" > /dev/null
${SUDO} chmod a+x "${BIN_PATH}/${F}"
echo " Finished."
fi
@ -98,21 +103,77 @@ ${DIR}/bin/winapps windows
echo " Finished."
}
function waUninstallUser() {
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"*); do
echo -n " Removing ${F}..."
${SUDO} rm ${F}
echo " Finished."
done
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"*); do
echo -n " Removing ${F}..."
${SUDO} rm ${F}
echo " Finished."
done
}
function waUninstallSystem() {
for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"*); do
if [ -z "${SUDO}" ]; then
waNoSudo
fi
echo -n " Removing ${F}..."
${SUDO} rm ${F}
echo " Finished."
done
for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"*); do
if [ -z "${SUDO}" ]; then
waNoSudo
fi
echo -n " Removing ${F}..."
${SUDO} rm ${F}
echo " Finished."
done
}
if [ -z "${1}" ]; then
waUsage
elif [ "${1}" = '--user' ]; then
SUDO=""
BIN_PATH="${HOME}/.local/bin"
APP_PATH="${HOME}/.local/share/applications"
if [ -n "${2}" ]; then
if [ "${2}" = '--uninstall' ]; then
# Uninstall
echo "Uninstalling..."
waUninstallUser
exit
else
usage
fi
fi
elif [ "${1}" = '--system' ]; then
SUDO="sudo"
sudo ls > /dev/null
BIN_PATH="/usr/local/bin"
APP_PATH="/usr/share/applications"
if [ -n "${2}" ]; then
if [ "${2}" = '--uninstall' ]; then
# Uninstall
echo "Uninstalling..."
waUninstallSystem
exit
else
usage
fi
fi
else
waUsage
fi
echo "Removing any old configurations..."
waUninstallUser
waUninstallSystem
echo "Installing..."
# Inititialize