mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
36 lines
871 B
Bash
Executable File
36 lines
871 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
set -ea
|
|
shopt -s expand_aliases
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
ARCH=$(uname -m)
|
|
fi
|
|
|
|
if [ "$ARCH" = "arm64" ]; then
|
|
ARCH="aarch64"
|
|
fi
|
|
|
|
USE_TTY=
|
|
if tty -s; then
|
|
USE_TTY="-it"
|
|
fi
|
|
|
|
cd ..
|
|
FEATURES="$(echo $ENVIRONMENT | sed 's/-/,/g')"
|
|
RUSTFLAGS=""
|
|
|
|
if [[ "${ENVIRONMENT}" =~ (^|-)console($|-) ]]; then
|
|
RUSTFLAGS="--cfg tokio_unstable"
|
|
fi
|
|
|
|
source ./core/builder-alias.sh
|
|
|
|
echo "FEATURES=\"$FEATURES\""
|
|
echo "RUSTFLAGS=\"$RUSTFLAGS\""
|
|
rust-musl-builder sh -c "cd core && cargo build --release --no-default-features --features cli-container,$FEATURES --locked --bin containerbox --target=$ARCH-unknown-linux-musl"
|
|
if [ "$(ls -nd core/target/$ARCH-unknown-linux-musl/release/containerbox | awk '{ print $3 }')" != "$UID" ]; then
|
|
rust-musl-builder sh -c "cd core && chown -R $UID:$UID target && chown -R $UID:$UID /root/.cargo"
|
|
fi |