TUI forum client in racket for unix.lgbt
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.
 
 
 

29 lines
492 B

#!/bin/bash
if [ $# -lt 3 ]; then
echo "usage: ./mkhaskalimg.sh <dir> <cmd> <out>"
fi
dir="$1"
cmd="$2"
out="$3"
(cd "$dir" && tar czf ../haskalimg.tar.gz *)
header=$(cat <<EOF
#!/bin/bash
extdir="/tmp/haskalimg-\$(whoami)-\$(head -c8 /dev/urandom | xxd -p)"
mkdir "\$extdir"
tail -n +11 "\$0" | tar xz -C "\$extdir"
function finish {
rm -rf "\$extdir"
}
trap finish EXIT
\$extdir/$2
exit
EOF
)
cat <(echo "$header") haskalimg.tar.gz > "$out"
rm haskalimg.tar.gz
chmod +x "$out"