Implemented get_installer.
This commit is contained in:
@@ -114,22 +114,52 @@ open_url() {
|
|||||||
GAME="$*" startx
|
GAME="$*" startx
|
||||||
}
|
}
|
||||||
|
|
||||||
get_installer() {
|
wait_for_enter() {
|
||||||
|
local message="$1"
|
||||||
|
|
||||||
|
printf '%s\n' "$message"
|
||||||
|
if [[ -r /dev/tty ]]; then
|
||||||
|
read -r < /dev/tty || true
|
||||||
|
else
|
||||||
|
read -r || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
collect_installer_file() {
|
||||||
local installerName="$1"
|
local installerName="$1"
|
||||||
local sourceDir
|
local sourceDir
|
||||||
|
|
||||||
if [[ -f "${cache}/${installerName}" ]]; then
|
for sourceDir in "${cache}" "${HOME}/Downloads" "${HOME}/Desktop"; do
|
||||||
|
[[ -d "$sourceDir" ]] || continue
|
||||||
|
find "$sourceDir" -maxdepth 1 -type f -name "$installerName" -exec mv -v {} "${cache}/" \; 2> /dev/null || true
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -f "${cache}/${installerName}" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
get_installer() {
|
||||||
|
local installerName="$1"
|
||||||
|
local downloadUrl="${2:-}"
|
||||||
|
local instructions
|
||||||
|
|
||||||
|
if collect_installer_file "$installerName"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for sourceDir in "${HOME}/Downloads" "${HOME}/Desktop"; do
|
if [[ -n "$downloadUrl" ]]; then
|
||||||
find "${sourceDir}" -type f -name "${installerName}" -exec mv -v {} "${cache}/" \; 2> /dev/null || true
|
instructions="Opening game download page, press enter to continue.
|
||||||
done
|
When the download finishes, please close your browser window to continue. You can do this by pressing control+w."
|
||||||
|
speak "$instructions" 1
|
||||||
|
wait_for_enter "Press enter to continue."
|
||||||
|
open_url "$downloadUrl"
|
||||||
|
|
||||||
if [[ ! -f "${cache}/${installerName}" ]]; then
|
if collect_installer_file "$installerName"; then
|
||||||
ui_msgbox "Game Installer" "Game Installer" "Could not find ${installerName}. Manual download support is not implemented yet."
|
return 0
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ui_msgbox "Game Installer" "Game Installer" "Could not find ${installerName}. Make sure the download completed and the file name is ${installerName}."
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
install_with_progress() {
|
install_with_progress() {
|
||||||
|
|||||||
Reference in New Issue
Block a user