Commit 4b01459e authored by Antoine Le Gonidec's avatar Antoine Le Gonidec

2.10.4 — main script — Update search paths for library and game scripts

Allow to use main script without prior call to `make install`
Fix #52
Fix #114
parent 7ef38319
Pipeline #85423 passed with stage
in 28 seconds
......@@ -6,28 +6,28 @@ INPUT_FILE="$1"
LIB_ONLY=true
[ -n "$XDG_DATA_HOME" ] || XDG_DATA_HOME="$HOME/.local/share"
: "${XDG_DATA_HOME:="$HOME/.local/share"}"
if [ -z "$PLAYIT_LIB2" ]; then
for path in\
'./'\
"$XDG_DATA_HOME/play.it/"\
"$XDG_DATA_HOME/play.it/play.it-2/lib/"\
'/usr/local/share/games/play.it/'\
'/usr/local/share/play.it/'\
'/usr/share/games/play.it/'\
'/usr/share/play.it/'
"$PWD"\
"$(dirname "$0")/play.it-2/lib"\
"$XDG_DATA_HOME/play.it"\
'/usr/local/share/games/play.it'\
'/usr/local/share/play.it'\
'/usr/share/games/play.it'\
'/usr/share/play.it'
do
if [ -z "$PLAYIT_LIB2" ] && [ -e "$path/libplayit2.sh" ]; then
if [ -e "$path/libplayit2.sh" ]; then
PLAYIT_LIB2="$path/libplayit2.sh"
break
fi
done
if [ -z "$PLAYIT_LIB2" ]; then
printf '\n\033[1;31mError:\033[0m\n'
printf 'libplayit2.sh not found.\n'
exit 1
fi
fi
if [ -z "$PLAYIT_LIB2" ]; then
printf '\n\033[1;31mError:\033[0m\n'
printf 'libplayit2.sh not found.\n'
exit 1
fi
# shellcheck source=play.it-2/lib/libplayit2.sh
. "$PLAYIT_LIB2"
......@@ -66,7 +66,15 @@ case "${LANG%_*}" in
esac
# shellcheck disable=SC2059
printf "$string" "$FILE_NAME"
SCRIPT="$(grep --dereference-recursive --files-with-matches "ARCHIVE_.\\+='$FILE_NAME'" "$XDG_DATA_HOME/play.it/play.it-2/" '/usr/local/share/games/play.it/' '/usr/local/share/play.it/' '/usr/share/games/play.it/' '/usr/share/play.it/' 2>/dev/null | head --lines=1)"
SCRIPT="$(find\
"$(dirname "$0")/play.it-2/games"\
"$XDG_DATA_HOME/play.it"\
'/usr/local/share/games/play.it'\
'/usr/local/share/play.it'\
'/usr/share/games/play.it'\
'/usr/share/play.it'\
! -path '*/prefixes/*' -type f -name '*.sh' -exec\
grep --regexp="ARCHIVE_.\\+='$FILE_NAME'" --files-with-matches '{}' + 2>/dev/null | head --lines=1)"
# Locate script by file MD5 checksum
if [ -z "$SCRIPT" ]; then
......@@ -83,7 +91,15 @@ if [ -z "$SCRIPT" ]; then
printf "$string" "$FILE_NAME"
check_deps 'md5sum'
FILE_MD5="$(md5sum "$INPUT_FILE" | cut --delimiter=' ' --fields=1)"
SCRIPT="$(grep --dereference-recursive --files-with-matches "$FILE_MD5" "$XDG_DATA_HOME/play.it/play.it-2/" '/usr/local/share/games/play.it/' '/usr/local/share/play.it/' '/usr/share/games/play.it/' '/usr/share/play.it/' 2>/dev/null | head --lines=1)"
SCRIPT="$(find\
"$(dirname "$0")/play.it-2/games"\
"$XDG_DATA_HOME/play.it"\
'/usr/local/share/games/play.it'\
'/usr/local/share/play.it'\
'/usr/share/games/play.it'\
'/usr/share/play.it'\
! -path '*/prefixes/*' -type f -name '*.sh' -exec\
grep --regexp="$FILE_MD5" --files-with-matches '{}' + 2>/dev/null | head --lines=1)"
SCRIPT_OPTIONS='--checksum=none'
fi
......
......@@ -6,6 +6,8 @@
* main script: Fix wrong usage of 'return' instead of 'exit'
* main script: Update search paths for library and game scripts
2.10.3
* write_bin - init_prefix_files: Do not ignore symbolic links in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment