xrsh-buildroot/buildroot-v86/board/v86/rootfs_overlay/root/bin/ziprun

25 lines
521 B
Text
Raw Normal View History

2024-11-20 15:40:17 +01:00
#!/bin/sh
set -e # halt on error
file="$1"
dir="$(basename "$file")"
2025-06-24 12:49:55 +02:00
echo "$file" | grep -q http && {
filename="$(basename "$file")"
wget "$file" -o /tmp/$$.zip
file=/tmp/$$.zip
}
2024-11-20 15:40:17 +01:00
logger "$0: extracting $file"
2025-06-20 17:16:55 +02:00
test -d "/root/$dir" && rm -rf "/root/$dir"
2024-11-20 15:40:17 +01:00
mkdir -p "/root/$dir"
cd "/root/$dir"
unzip "$file"
2025-01-09 12:14:26 +01:00
cd "/root/$dir" # trigger auto-env (.env file)
2024-11-20 15:40:17 +01:00
2024-12-13 14:31:33 +01:00
test -f .env && test "$(cat ~/.config/autoenv/package)" = 1 && {
logger "$0: detected $(pwd)/.env [autoenv]"
logger "$0: running $(pwd)/.env"
2024-12-13 14:31:33 +01:00
sh .env
2024-11-20 15:40:17 +01:00
}