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