- payload now extracts in the right location - payload checks if the file is already extracted - etc.master
parent
35d955683e
commit
17ab178cdd
@ -1,2 +1 @@ |
||||
**/pcmi/** |
||||
**/badwolf/** |
||||
tests/** |
||||
|
@ -1,19 +1,27 @@ |
||||
#!/bin/sh -e |
||||
|
||||
# TODO: verify checksum before extracting |
||||
# SUM |
||||
# TODO: extract self without resolving to $0 because it doesn't resolve links |
||||
tail -c +"$(expr BYTES + 1)" $0 | lz4 -dc | tar -x |
||||
# TODO: remove hardcoded directory |
||||
# TODO: use a different extraction path |
||||
cd ID |
||||
|
||||
export ORIGIN="$(pwd)" |
||||
export LD_LIBRARY_PATH="$ORIGIN/lib" |
||||
export PATH="$ORIGIN/bin":$PATH |
||||
if [ -z "$XDG_CACHE_HOME" ]; then |
||||
destdir=/tmp |
||||
else |
||||
destdir="$XDG_CACHE_HOME" |
||||
fi |
||||
|
||||
if ! [ "$(head -n 1 "$destdir"/ID/checksum 2>/dev/null)" = 'SUM' ]; then |
||||
tail -c +BYTES "$0" | lz4 -dc | tar -x -C "$destdir" |
||||
echo "SUM" > "$destdir"/ID/checksum |
||||
fi |
||||
|
||||
ORIGIN="$destdir"/ID |
||||
LD_LIBRARY_PATH="$ORIGIN/lib" |
||||
PATH="$ORIGIN/bin":$PATH |
||||
export ORIGIN |
||||
export LD_LIBRARY_PATH |
||||
export PATH |
||||
|
||||
# export LD_DEBUG='libs' |
||||
|
||||
# TODO: use $0 instead |
||||
# FIXME: uses the system's basename |
||||
exec bin/"$(basename "$1")" |
||||
exec "$destdir"/ID/bin/"$(basename "$1")" |
||||
|
Loading…
Reference in new issue