Update installer multi-select

This commit is contained in:
Fmstrat 2020-11-19 23:05:07 -05:00 committed by Oskar Manhart
parent a7b2dce33d
commit 01e0bb3b09
2 changed files with 63 additions and 43 deletions

View File

@ -377,16 +377,17 @@ on_checkbox_input_enter() {
fi fi
done done
tput cud $((${#_checkbox_list[@]}-${_current_index}))
tput cub "$(tput cols)"
if (( ${#_checkbox_list[@]} <= 5 )); then if (( ${#_checkbox_list[@]} <= 5 )); then
tput cud $((${#_checkbox_list[@]}-${_current_index}))
tput cub "$(tput cols)"
for i in $(seq $((${#_checkbox_list[@]}+1))); do for i in $(seq $((${#_checkbox_list[@]}+1))); do
tput el1 tput el1
tput el tput el
tput cuu1 tput cuu1
done done
else else
tput cud $((6-${_current_row}))
tput cub "$(tput cols)"
for i in $(seq 8); do for i in $(seq 8); do
tput el1 tput el1
tput el tput el

View File

@ -2,6 +2,9 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
MAKEDEMO=0
USEDEMO=1
. "${DIR}/install/inquirer.sh" . "${DIR}/install/inquirer.sh"
INSTALLED_EXES=() INSTALLED_EXES=()
@ -26,44 +29,57 @@ function waInstall() {
function waFindInstalled() { function waFindInstalled() {
echo -n " Checking for installed apps in RDP machine (this may take a while)..." echo -n " Checking for installed apps in RDP machine (this may take a while)..."
rm -f ${HOME}/.local/share/winapps/installed.bat if [ $USEDEMO != 1 ]; then
rm -f ${HOME}/.local/share/winapps/installed.tmp rm -f ${HOME}/.local/share/winapps/installed.bat
rm -f ${HOME}/.local/share/winapps/installed rm -f ${HOME}/.local/share/winapps/installed.tmp
cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1 rm -f ${HOME}/.local/share/winapps/installed
for F in $(ls "${DIR}/apps"); do rm -f ${HOME}/.local/share/winapps/detected
. "${DIR}/apps/${F}/info" cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1
echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >> ${HOME}/.local/share/winapps/installed.bat for F in $(ls "${DIR}/apps"); do
done; . "${DIR}/apps/${F}/info"
echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >> ${HOME}/.local/share/winapps/installed.bat echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >> ${HOME}/.local/share/winapps/installed.bat
echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >> ${HOME}/.local/share/winapps/installed.bat done;
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 & echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >> ${HOME}/.local/share/winapps/installed.bat
COUNT=0 echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >> ${HOME}/.local/share/winapps/installed.bat
while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do 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 5 COUNT=0
COUNT=$((COUNT + 1)) while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do
if (( COUNT == 15 )); then sleep 5
echo " Finished." COUNT=$((COUNT + 1))
echo "" if (( COUNT == 15 )); then
echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:" echo " Finished."
echo " bin/winapps check" echo ""
echo "" echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:"
echo "If it cannot connect, this is most likely due to:" echo " bin/winapps check"
echo " - You need to accept the security cert the first time you connect (with 'check')" echo ""
echo " - Not enabling RDP in the Windows VM" echo "If it cannot connect, this is most likely due to:"
echo " - Not being able to connect to the IP of the VM" echo " - You need to accept the security cert the first time you connect (with 'check')"
echo " - Incorrect user credentials in winapps.conf" echo " - Not enabling RDP in the Windows VM"
echo " - Not merging install/RDPApps.reg into the VM" echo " - Not being able to connect to the IP of the VM"
echo " - Incorrect user credentials in winapps.conf"
echo " - Not merging install/RDPApps.reg into the VM"
exit
fi
done
if [ $MAKEDEMO = 1 ]; then
rm -rf /tmp/winapps_demo
cp -a ${HOME}/.local/share/winapps /tmp/winapps_demo
exit exit
fi fi
done else
rm -rf ${HOME}/.local/share/winapps
cp -a /tmp/winapps_demo ${HOME}/.local/share/winapps
#sleep 3
fi
echo " Finished." echo " Finished."
} }
function waConfigureApp() { function waConfigureApp() {
. "${SYS_PATH}/apps/${1}/info" . "${SYS_PATH}/apps/${1}/info"
echo -n " Configuring ${NAME}..." echo -n " Configuring ${NAME}..."
${SUDO} rm -f "${APP_PATH}/${1}.desktop" if [ ${USEDEMO} != 1 ]; then
echo "[Desktop Entry] ${SUDO} rm -f "${APP_PATH}/${1}.desktop"
echo "[Desktop Entry]
Name=${NAME} Name=${NAME}
Exec=${BIN_PATH}/winapps ${1} %F Exec=${BIN_PATH}/winapps ${1} %F
Terminal=false Terminal=false
@ -74,11 +90,12 @@ Comment=${FULL_NAME}
Categories=${CATEGORIES} Categories=${CATEGORIES}
MimeType=${MIME_TYPES} MimeType=${MIME_TYPES}
" |${SUDO} tee "${APP_PATH}/${1}.desktop" > /dev/null " |${SUDO} tee "${APP_PATH}/${1}.desktop" > /dev/null
${SUDO} rm -f "${BIN_PATH}/${1}" ${SUDO} rm -f "${BIN_PATH}/${1}"
echo "#!/usr/bin/env bash echo "#!/usr/bin/env bash
${BIN_PATH}/winapps ${1} $@ ${BIN_PATH}/winapps ${1} $@
" |${SUDO} tee "${BIN_PATH}/${1}" > /dev/null " |${SUDO} tee "${BIN_PATH}/${1}" > /dev/null
${SUDO} chmod a+x "${BIN_PATH}/${1}" ${SUDO} chmod a+x "${BIN_PATH}/${1}"
fi
echo " Finished." echo " Finished."
} }
@ -191,10 +208,11 @@ MIME_TYPES=\"\"
function waConfigureWindows() { function waConfigureWindows() {
echo -n " Configuring Windows..." echo -n " Configuring Windows..."
${SUDO} rm -f "${APP_PATH}/windows.desktop" if [ ${USEDEMO} != 1 ]; then
${SUDO} mkdir -p "${SYS_PATH}/icons" ${SUDO} rm -f "${APP_PATH}/windows.desktop"
${SUDO} cp "${DIR}/icons/windows.svg" "${SYS_PATH}/icons/windows.svg" ${SUDO} mkdir -p "${SYS_PATH}/icons"
echo "[Desktop Entry] ${SUDO} cp "${DIR}/icons/windows.svg" "${SYS_PATH}/icons/windows.svg"
echo "[Desktop Entry]
Name=Windows Name=Windows
Exec=${BIN_PATH}/winapps windows %F Exec=${BIN_PATH}/winapps windows %F
Terminal=false Terminal=false
@ -204,11 +222,12 @@ StartupWMClass=Micorosoft Windows
Comment=Micorosoft Windows Comment=Micorosoft Windows
Categories=Windows Categories=Windows
" |${SUDO} tee "${APP_PATH}/windows.desktop" > /dev/null " |${SUDO} tee "${APP_PATH}/windows.desktop" > /dev/null
${SUDO} rm -f "${BIN_PATH}/windows" ${SUDO} rm -f "${BIN_PATH}/windows"
echo "#!/usr/bin/env bash echo "#!/usr/bin/env bash
${BIN_PATH}/winapps windows ${BIN_PATH}/winapps windows
" |${SUDO} tee "/${BIN_PATH}/windows" > /dev/null " |${SUDO} tee "/${BIN_PATH}/windows" > /dev/null
${SUDO} chmod a+x "${BIN_PATH}/windows" ${SUDO} chmod a+x "${BIN_PATH}/windows"
fi
echo " Finished." echo " Finished."
} }