Compare commits

..

No commits in common. "7fc4f775ac9f5005419367afe97f68c0d38988fa" and "b0b25ba7ff4f4c1110e6b23f3f781e2ca1d552c7" have entirely different histories.

2 changed files with 10 additions and 14 deletions

View File

@ -27,7 +27,7 @@ getlibs ()
readelf -d "$1" |
grep NEEDED |
awk '{print $5}' |
sed s/\\[// | sed s/\\]// > "$tmplist"
sed s/\\[/\ / | sed s/\\]/\ / > "$tmplist"
# While there are more dependencies
while [ "$(cat "$tmplist")" ]; do
@ -51,7 +51,7 @@ getlibs ()
readelf -d "$f" |
grep NEEDED |
awk '{print $5}' |
sed s/\\[// | sed s/\\]// >> "$tmpfile"
sed s/\\[/\ / | sed s/\\]/\ / >> "$tmpfile"
fi
done
sort -u "$tmpfile" > "$tmplist"
@ -81,7 +81,7 @@ if ! [ -e "$WORKDIR"/id ]; then
die 'id file not present'
fi
if [ "$(ls -1 "$WORKDIR"/bin)" ]; then
if ls -1 "$WORKDIR"/bin; then
for f in "$WORKDIR"/bin/*; do
if ! [ -x "$f" ]; then
die "$f is not executable"
@ -100,7 +100,7 @@ touch "$WORKDIR"/env
# TODO: add usage and error checking
DIRNAME="$WORKDIR"/"$(head -1 "$WORKDIR"/id | awk '{print $1}')"
echo "Fetching dependencies..."
echo "Fetching binary dependencies..."
if [ -s "$WORKDIR"/deps ]; then
while read -r d; do
( IFS=:
@ -111,7 +111,7 @@ if [ -s "$WORKDIR"/deps ]; then
done < "$tmplist"
fi
echo "Fetching libraries and stripping binaries..."
echo "Fetching dependencies and stripping binaries..."
# TODO: get al binary dependencies from deps file
# Get all dependencies and strip them
for b in "$WORKDIR"/bin/*; do
@ -151,10 +151,10 @@ numsize="$(echo "$size" | wc -c)"
normsize="$((size - (strsize - numsize) + 1))"
sed s/BYTES/"$normsize"/ tpp > tpr
cat tpr "$DIRNAME".tar.lz4 > "$DIRNAME".tin
cat tpr "$DIRNAME".tar.lz4 > "$DIRNAME".ti
echo "Cleaning up..."
rm -f tpr tpp
chmod +x "$DIRNAME".tin
chmod +x "$DIRNAME".ti
rm -rf "$DIRNAME" "$DIRNAME".tar*

View File

@ -1,5 +1,6 @@
#!/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
@ -13,16 +14,10 @@ if ! [ -d "$destdir" ]; then
fi
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"
echo "SUM" > "$destdir"/ID/checksum
fi
binname="$(basename "$0")"
if echo "$binname" | grep -q \.tin$; then
binname="$(echo "$binname" | sed s/\.tin//)"
fi
ORIGIN="$destdir"/ID
LD_LIBRARY_PATH="$ORIGIN/lib"
PATH="$ORIGIN/bin":$PATH
@ -32,4 +27,5 @@ export PATH
# export LD_DEBUG='libs'
exec "$destdir"/ID/bin/"$binname" "$@"
# TODO: use $0 instead
exec "$destdir"/ID/bin/"$(basename "$1")"