Initial commit of new build system.
This commit is contained in:
commit
2d738da0c8
40
build/build-stormux.sh
Executable file
40
build/build-stormux.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e # Don't want to destroy stuff if this goes majorly wrong.
|
||||||
|
# Args: <image_name> [size]
|
||||||
|
size="4G"
|
||||||
|
if [ $# -eq 0 ] ; then
|
||||||
|
echo "Usage: $0 <image_name> [size]" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -e "$1" ] ; then
|
||||||
|
echo "$1 exists, please remove or move it for this script to continue." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $# -eq 2 ] ; then
|
||||||
|
size="$2"
|
||||||
|
fi
|
||||||
|
if [ "$(whoami)" != "root" ] ; then
|
||||||
|
echo "Error: This script must be run as root." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fallocate -l $size "$1"
|
||||||
|
loopdev="$(losetup --find --show "$1")"
|
||||||
|
parted --script ${loopdev} mklabel msdos mkpart primary fat32 0% 100M mkpart primary ext4 100M 100%
|
||||||
|
mkfs.vfat -F32 ${loopdev}p1
|
||||||
|
mkfs.ext4 -F ${loopdev}p2
|
||||||
|
mount ${loopdev}p2 /mnt
|
||||||
|
mkdir /mnt/boot
|
||||||
|
mount ${loopdev}p1 /mnt/boot
|
||||||
|
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz -O- | bsdtar -xpf - -C /mnt
|
||||||
|
arch-chroot /mnt << "EOF"
|
||||||
|
pacman-key --init
|
||||||
|
pacman-key --populate archlinuxarm
|
||||||
|
pacman -Syu --needed --noconfirm vim bash-completion espeakup base base-devel
|
||||||
|
mkdir -p /etc/systemd/system/sound.target.wants
|
||||||
|
ln -s /usr/lib/systemd/system/espeakup.service /etc/systemd/system/sound.target.wants/
|
||||||
|
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers.d/wheel
|
||||||
|
EOF
|
||||||
|
umount -R /mnt
|
||||||
|
partx -d ${loopdev}
|
||||||
|
losetup --detach ${loopdev}
|
Loading…
Reference in New Issue
Block a user