You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
680 B
31 lines
680 B
#!/bin/sh -e
|
|
|
|
# TODO: verify checksum before extracting
|
|
# TODO: extract self without resolving to $0 because it doesn't resolve links
|
|
|
|
if [ -z "$XDG_CACHE_HOME" ]; then
|
|
destdir=/tmp/tarinstall
|
|
else
|
|
destdir="$XDG_CACHE_HOME"/tarinstall
|
|
fi
|
|
|
|
if ! [ -d "$destdir" ]; then
|
|
mkdir -p "$destdir"
|
|
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
|
|
exec "$destdir"/ID/bin/"$(basename "$1")"
|
|
|