Comment out games with #// instead of just # at top of file.
This commit is contained in:
@@ -7,6 +7,13 @@ Installer and launcher for accessible to the blind games that run natively in Li
|
|||||||
|
|
||||||
As the project grows, more dependencies will most likely be added. When LGM is launched, it will check to make sure it has the required dependencies for it to do the work of downloading and extracting the game. Note that because every distro has a different package manager, dependencies for games themselves will not be resolved. Please consult the game's documentation to find out what is needed for the game to run.
|
As the project grows, more dependencies will most likely be added. When LGM is launched, it will check to make sure it has the required dependencies for it to do the work of downloading and extracting the game. Note that because every distro has a different package manager, dependencies for games themselves will not be resolved. Please consult the game's documentation to find out what is needed for the game to run.
|
||||||
|
|
||||||
|
## Disabling game entries
|
||||||
|
|
||||||
|
To disable a game entry without deleting its script, set the first line of the script to start with `#//`.
|
||||||
|
|
||||||
|
- This applies to both `.install/*.sh` and `.launch/*.sh`.
|
||||||
|
- A normal comment like `# comment` on the first line does not disable an entry.
|
||||||
|
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
|||||||
@@ -455,8 +455,54 @@ clear_cache() {
|
|||||||
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Cache deleted."
|
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Cache deleted."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
download_with_fallback() {
|
||||||
|
local outputPath="$1"
|
||||||
|
local sourceUrl="$2"
|
||||||
|
local firstExitCode=0
|
||||||
|
local secondExitCode=0
|
||||||
|
local thirdExitCode=0
|
||||||
|
local errorFile=""
|
||||||
|
downloadCurlExitCodes=""
|
||||||
|
downloadErrorLog=""
|
||||||
|
|
||||||
|
if ! errorFile="$(mktemp)"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if curl -L4 -C - --retry 10 --output "${outputPath}" "${sourceUrl}" 2> "${errorFile}"; then
|
||||||
|
rm -f "${errorFile}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
firstExitCode=$?
|
||||||
|
|
||||||
|
# Some hosts reject resume requests. Retry from scratch.
|
||||||
|
rm -f "${outputPath}"
|
||||||
|
if curl -L4 --retry 10 --output "${outputPath}" "${sourceUrl}" 2>> "${errorFile}"; then
|
||||||
|
rm -f "${errorFile}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
secondExitCode=$?
|
||||||
|
|
||||||
|
# If IPv4-only fails, retry allowing either IP family.
|
||||||
|
rm -f "${outputPath}"
|
||||||
|
if curl -L --retry 10 --output "${outputPath}" "${sourceUrl}" 2>> "${errorFile}"; then
|
||||||
|
rm -f "${errorFile}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
thirdExitCode=$?
|
||||||
|
|
||||||
|
downloadCurlExitCodes="${firstExitCode}, ${secondExitCode}, ${thirdExitCode}"
|
||||||
|
if cp -f "${errorFile}" "${cache}/curl-error.log" 2> /dev/null; then
|
||||||
|
downloadErrorLog="${cache}/curl-error.log"
|
||||||
|
rm -f "${errorFile}"
|
||||||
|
else
|
||||||
|
downloadErrorLog="${errorFile}"
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
local source=($@)
|
local source=("$@")
|
||||||
for i in "${source[@]}" ; do
|
for i in "${source[@]}" ; do
|
||||||
local dest="${i##*/}"
|
local dest="${i##*/}"
|
||||||
dest="${dest//%20/ }"
|
dest="${dest//%20/ }"
|
||||||
@@ -469,8 +515,8 @@ download() {
|
|||||||
fi
|
fi
|
||||||
# Skip if the item is in cache.
|
# Skip if the item is in cache.
|
||||||
[[ -e "${cache}/${dest}" ]] && continue
|
[[ -e "${cache}/${dest}" ]] && continue
|
||||||
{ if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then
|
{ if ! download_with_fallback "${cache}/${dest}" "${i}" ; then
|
||||||
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"..."
|
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"...\n\ncurl exit codes: ${downloadCurlExitCodes}\nError details: ${downloadErrorLog}"
|
||||||
exit 1
|
exit 1
|
||||||
fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\""
|
fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\""
|
||||||
local downloadError=1
|
local downloadError=1
|
||||||
@@ -526,8 +572,8 @@ download_named() {
|
|||||||
fi
|
fi
|
||||||
# Skip if the item is in cache.
|
# Skip if the item is in cache.
|
||||||
test -e "${cache}/${dest}" && return
|
test -e "${cache}/${dest}" && return
|
||||||
if ! curl -L4 --output "${cache}/${dest}" "${2}" ; then
|
if ! download_with_fallback "${cache}/${dest}" "${2}" ; then
|
||||||
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"..."
|
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"...\n\ncurl exit codes: ${downloadCurlExitCodes}\nError details: ${downloadErrorLog}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -597,10 +643,10 @@ help() {
|
|||||||
game_installer() {
|
game_installer() {
|
||||||
# Create the menu of available games by reading from .install directory
|
# Create the menu of available games by reading from .install directory
|
||||||
declare -a menuList
|
declare -a menuList
|
||||||
# Get all .sh files from .install directory, excluding those starting with #, and sort them
|
# Get all .sh files from .install directory, excluding those starting with #//, and sort them
|
||||||
mapfile -t sortedGames < <(for f in "${0%/*}/.install/"*.sh; do
|
mapfile -t sortedGames < <(for f in "${0%/*}/.install/"*.sh; do
|
||||||
# Skip if first line starts with #
|
# Skip if first line starts with #//
|
||||||
[[ $(head -n1 "$f") == "#"* ]] && continue
|
[[ $(head -n1 "$f") == "#//"* ]] && continue
|
||||||
# Output filename without .sh extension
|
# Output filename without .sh extension
|
||||||
echo "${f##*/}"
|
echo "${f##*/}"
|
||||||
done | sort)
|
done | sort)
|
||||||
@@ -759,7 +805,7 @@ game_launcher() {
|
|||||||
if [[ -d ".launch" ]]; then
|
if [[ -d ".launch" ]]; then
|
||||||
find -L "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -print0 | sort -z | xargs -0 bash -c '
|
find -L "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -print0 | sort -z | xargs -0 bash -c '
|
||||||
for f; do
|
for f; do
|
||||||
[[ $(head -n1 "$f") =~ ^#$ ]] && continue
|
[[ $(head -n1 "$f") == "#//"* ]] && continue
|
||||||
name="${f##*/}"
|
name="${f##*/}"
|
||||||
echo "$f"
|
echo "$f"
|
||||||
echo "${name%.sh}"
|
echo "${name%.sh}"
|
||||||
|
|||||||
Reference in New Issue
Block a user