|
|
@ -1,6 +1,5 @@ |
|
|
|
#!/bin/sh -e |
|
|
|
#!/bin/sh -e |
|
|
|
|
|
|
|
|
|
|
|
# TODO: verify checksum before extracting |
|
|
|
|
|
|
|
# TODO: extract self without resolving to $0 because it doesn't resolve links |
|
|
|
# TODO: extract self without resolving to $0 because it doesn't resolve links |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$XDG_CACHE_HOME" ]; then |
|
|
|
if [ -z "$XDG_CACHE_HOME" ]; then |
|
|
@ -14,10 +13,16 @@ if ! [ -d "$destdir" ]; then |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if ! [ "$(head -n 1 "$destdir"/ID/checksum 2>/dev/null)" = 'SUM' ]; then |
|
|
|
if ! [ "$(head -n 1 "$destdir"/ID/checksum 2>/dev/null)" = 'SUM' ]; then |
|
|
|
|
|
|
|
rm -rf "$destdir"/ID |
|
|
|
tail -c +BYTES "$0" | lz4 -dc | tar -x -C "$destdir" |
|
|
|
tail -c +BYTES "$0" | lz4 -dc | tar -x -C "$destdir" |
|
|
|
echo "SUM" > "$destdir"/ID/checksum |
|
|
|
echo "SUM" > "$destdir"/ID/checksum |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
binname="$(basename "$0")" |
|
|
|
|
|
|
|
if echo "$binname" | grep -q \.tin$; then |
|
|
|
|
|
|
|
binname="$(echo "$binname" | sed s/\.tin//)" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
ORIGIN="$destdir"/ID |
|
|
|
ORIGIN="$destdir"/ID |
|
|
|
LD_LIBRARY_PATH="$ORIGIN/lib" |
|
|
|
LD_LIBRARY_PATH="$ORIGIN/lib" |
|
|
|
PATH="$ORIGIN/bin":$PATH |
|
|
|
PATH="$ORIGIN/bin":$PATH |
|
|
@ -27,5 +32,4 @@ export PATH |
|
|
|
|
|
|
|
|
|
|
|
# export LD_DEBUG='libs' |
|
|
|
# export LD_DEBUG='libs' |
|
|
|
|
|
|
|
|
|
|
|
# TODO: use $0 instead |
|
|
|
exec "$destdir"/ID/bin/"$binname" "$@" |
|
|
|
exec "$destdir"/ID/bin/"$(basename "$1")" |
|
|
|
|
|
|
|