changed extension and better sed commands

master
Alessandro Mauri 4 years ago
parent b0b25ba7ff
commit 62d02a1202
  1. 14
      posix/maketi

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

Loading…
Cancel
Save