2023-12-17 07:58:52 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
2023-12-26 07:22:50 +08:00
|
|
|
build_base_dir="build/linux"
|
2023-12-28 03:45:55 +08:00
|
|
|
out_dir="build/package/linux"
|
2023-12-25 05:03:11 +08:00
|
|
|
script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd )
|
2023-12-17 07:58:52 +08:00
|
|
|
|
|
|
|
[[ "$1" = '' ]] && {
|
|
|
|
echo "[X] missing build folder";
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
2023-12-26 07:23:23 +08:00
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
|
|
echo "Please run as root" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-12-17 07:58:52 +08:00
|
|
|
[[ -d "$script_dir/$build_base_dir/$1" ]] || {
|
|
|
|
echo "[X] build folder wasn't found";
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
apt update || exit 1
|
|
|
|
apt install tar -y || exit 1
|
|
|
|
|
|
|
|
mkdir -p "$script_dir/$out_dir/$1"
|
|
|
|
|
|
|
|
archive_file="$script_dir/$out_dir/$1/emu-linux-$1.tar.gz"
|
|
|
|
[[ -f "$archive_file" ]] && rm -f "$archive_file"
|
|
|
|
tar -C "$script_dir/$build_base_dir" -c -j -vf "$archive_file" "$1"
|