2025-06-02 18:00:32 +03:00
|
|
|
#!/bin/sh
|
2026-03-27 13:13:52 +03:00
|
|
|
errors=""
|
|
|
|
|
[ -z "$aeropkg_home" ] && errors="${errors}aeropkg_home must be set to build\n"
|
|
|
|
|
[ -z "$aeropkg_base" ] && errors="${errors}aeropkg_base must be set to build\n"
|
2025-06-04 20:33:53 +03:00
|
|
|
|
2026-03-27 13:13:52 +03:00
|
|
|
if [ -n "$errors" ]; then
|
|
|
|
|
printf "Error:\n$errors" >&2
|
2025-11-18 19:46:36 +03:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-03-27 13:13:52 +03:00
|
|
|
INSTALL_PATH="$aeropkg_home"
|
|
|
|
|
BASE_PATH="$aeropkg_base"
|
2025-08-25 00:34:04 +03:00
|
|
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
2025-06-04 20:33:53 +03:00
|
|
|
|
|
|
|
|
|
2026-03-27 13:13:52 +03:00
|
|
|
cargo build --release
|
|
|
|
|
mkdir -p "$SCRIPT_DIR/target/release/bin"
|
|
|
|
|
cp -f "$SCRIPT_DIR/target/release/pkg" "$SCRIPT_DIR/target/release/bin"
|
|
|
|
|
|
|
|
|
|
echo "Installing to '$INSTALL_PATH'..."
|
|
|
|
|
rsync -a --delete "$SCRIPT_DIR/assets/" "$SCRIPT_DIR/target/release/bin" "$INSTALL_PATH/"
|
2025-08-25 00:34:04 +03:00
|
|
|
|
2026-03-27 13:13:52 +03:00
|
|
|
BIN_PATH="$INSTALL_PATH/bin/pkg"
|
|
|
|
|
if [ -f "$BIN_PATH" ]; then
|
|
|
|
|
patchelf --set-interpreter /pkg/gnu/glibc/lib/ld-linux-x86-64.so.2 "$BIN_PATH"
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
echo "Error: Failed to apply patchelf to '$BIN_PATH'."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2025-08-25 00:34:04 +03:00
|
|
|
else
|
2026-03-27 13:13:52 +03:00
|
|
|
echo "Error: Executable '$BIN_PATH' not found after installation."
|
|
|
|
|
exit 1
|
2025-08-25 00:34:04 +03:00
|
|
|
fi
|
|
|
|
|
|
2026-03-27 13:13:52 +03:00
|
|
|
echo "Project successfully installed to '$INSTALL_PATH'"
|
|
|
|
|
echo "Base directory: '$BASE_PATH'"
|