androot/rootfsbuilder/archlinux-x86_64.sh
JeremyStarTM 3f0f0e0113 Update code
CHANGES
- [androot.sh] Improve code quality
- [androot.sh] Modify DOWNLOADSERVER* variables
- [patch.sh] Implement rootfs patching
- [prepare.sh] Squashed bugs
- [rootfsbuilder/archlinux-x86_64.sh] Remove "copy pacman config" flag causing some issues
- [systeminstall.sh] Implement rootfs configuration and update script

BUGS
- [systeminstall.sh|patch.sh] Scripts only work on the same architecture as the host
2023-11-10 15:08:35 +01:00

36 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
shopt -s inherit_errexit
if [ ! "${UID}" == "0" ]; then
echo ":: Error: root user required"
exit 1
fi
DISTRIBUTION=archlinux
ARCH=x86_64
echo ":: Generating rootfs for ${DISTRIBUTION}-${ARCH}"
if [ -f "./${DISTRIBUTION}-${ARCH}.tar.gz" ]; then
echo ":: Removing ${DISTRIBUTION}-${ARCH}.tar.gz"
rm -rf "./${DISTRIBUTION}-${ARCH}.tar.gz"
fi
if [ -f "./${DISTRIBUTION}-${ARCH}.tar" ]; then
echo ":: Removing ${DISTRIBUTION}-${ARCH}.tar"
rm -rf "./${DISTRIBUTION}-${ARCH}.tar"
fi
if [ -d "./${DISTRIBUTION}-${ARCH}" ]; then
echo ":: Removing ${DISTRIBUTION}-${ARCH}"
rm -rf "./${DISTRIBUTION}-${ARCH}"
fi
mkdir -p "./${DISTRIBUTION}-${ARCH}"
cd "./${DISTRIBUTION}-${ARCH}"
echo ":: Installing system"
pacstrap -c -G -K -M . base archlinux-keyring
echo ":: Unmounting (safety measure)"
bash -c "umount ./{dev/pts,dev/shm,dev,sys,proc,run};exit 0"
echo ":: Archiving rootfs"
tar --acls -cpf "../${DISTRIBUTION}-${ARCH}.tar" ./*
cd ..
rm -rf "./${DISTRIBUTION}-${ARCH}"
echo ":: Compressing rootfs"
gzip --best ${DISTRIBUTION}-${ARCH}.tar
rm -rf "./${DISTRIBUTION}-${ARCH}.tar"
echo ":: Generated rootfs for ${DISTRIBUTION}-${ARCH}"