wip, more installs
This commit is contained in:
@@ -87,25 +87,46 @@ else
|
||||
warn "Creating minimal live environment with busybox..."
|
||||
|
||||
# Fallback: use static busybox for a minimal live shell
|
||||
BUSYBOX_INSTALLED=false
|
||||
|
||||
if command -v busybox >/dev/null 2>&1; then
|
||||
cp "$(which busybox)" "${ROOTFS}/bin/busybox"
|
||||
# Create essential symlinks
|
||||
for cmd in sh ash ls cat cp mv rm mkdir mount umount grep sed awk vi; do
|
||||
ln -sf busybox "${ROOTFS}/bin/$cmd"
|
||||
done
|
||||
else
|
||||
# Download static busybox
|
||||
BUSYBOX_INSTALLED=true
|
||||
elif [ -f /etc/arch-release ] && command -v pacman >/dev/null 2>&1; then
|
||||
# On Arch, install busybox from pacman if not present
|
||||
info "Installing busybox via pacman..."
|
||||
pacman -S --noconfirm busybox >/dev/null 2>&1 && \
|
||||
cp "$(which busybox)" "${ROOTFS}/bin/busybox" && \
|
||||
BUSYBOX_INSTALLED=true
|
||||
fi
|
||||
|
||||
if [ "$BUSYBOX_INSTALLED" = false ]; then
|
||||
# Download static busybox — try multiple sources with timeout
|
||||
info "Downloading busybox..."
|
||||
curl -fLo "${ROOTFS}/bin/busybox" \
|
||||
"https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox"
|
||||
chmod +x "${ROOTFS}/bin/busybox"
|
||||
for cmd in sh ls cat cp mv rm mkdir mount umount; do
|
||||
ln -sf busybox "${ROOTFS}/bin/$cmd"
|
||||
for url in \
|
||||
"https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox" \
|
||||
"https://github.com/docker-library/busybox/raw/dist-amd64/stable/glibc/busybox.tar.xz"; do
|
||||
if curl --connect-timeout 15 -fLo "${ROOTFS}/bin/busybox" "$url" 2>/dev/null; then
|
||||
BUSYBOX_INSTALLED=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Copy essential libs from host
|
||||
for lib in ld-linux-x86-64.so.2 libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0; do
|
||||
if [ "$BUSYBOX_INSTALLED" = true ]; then
|
||||
chmod +x "${ROOTFS}/bin/busybox"
|
||||
for cmd in sh ash ls cat cp mv rm mkdir mount umount grep sed awk vi \
|
||||
find xargs tar gzip chmod chown ln echo printf sleep; do
|
||||
ln -sf busybox "${ROOTFS}/bin/$cmd"
|
||||
done
|
||||
ok "busybox installed"
|
||||
else
|
||||
die "Cannot obtain busybox — install it: sudo pacman -S busybox"
|
||||
fi
|
||||
|
||||
# Copy essential libs from host (needed for non-static binaries like dpack)
|
||||
for lib in ld-linux-x86-64.so.2 libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0 \
|
||||
libgcc_s.so.1 librt.so.1; do
|
||||
if [ -f "/usr/lib/$lib" ]; then
|
||||
cp "/usr/lib/$lib" "${ROOTFS}/usr/lib/"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user