58 lines
1.4 KiB
Bash
Executable File
58 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Setup Alpine build environment
|
|
# Installs dependencies and prepares build environment
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "🔧 Setting up Alpine build environment..."
|
|
echo ""
|
|
|
|
# Detect OS
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
echo "🍎 macOS detected - Docker will be used"
|
|
echo " Make sure Docker Desktop is installed and running"
|
|
exit 0
|
|
elif [ -f /etc/alpine-release ]; then
|
|
echo "🏔️ Alpine Linux detected - installing native tools..."
|
|
|
|
# Install build dependencies
|
|
apk add --no-cache \
|
|
bash \
|
|
git \
|
|
alpine-sdk \
|
|
abuild \
|
|
alpine-conf \
|
|
syslinux \
|
|
xorriso \
|
|
squashfs-tools \
|
|
grub \
|
|
grub-efi \
|
|
mtools \
|
|
dosfstools \
|
|
e2fsprogs \
|
|
rsync \
|
|
curl \
|
|
wget \
|
|
ca-certificates || {
|
|
echo "❌ Failed to install dependencies"
|
|
exit 1
|
|
}
|
|
|
|
# Setup abuild keys
|
|
if [ ! -f ~/.abuild/abuild.conf ]; then
|
|
echo "🔑 Generating abuild keys..."
|
|
abuild-keygen -a -n
|
|
fi
|
|
|
|
echo "✅ Alpine build environment ready!"
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
echo "🐧 Linux detected (not Alpine) - Docker will be used"
|
|
echo " Install Docker: https://docs.docker.com/get-docker/"
|
|
exit 0
|
|
else
|
|
echo "❌ Unsupported OS: $OSTYPE"
|
|
exit 1
|
|
fi
|