Moving toward first working release.

This commit is contained in:
Storm Dragon 2020-12-09 08:24:34 -05:00
parent 9098eed102
commit 025883df17

View File

@ -23,7 +23,7 @@ set -e # Don't want to destroy stuff if this goes majorly wrong.
help() {
echo -e "Usage:\n"
echo "With no arguments, open the game launcher."
echo "With no arguments, build with default parameters."
for i in "${!command[@]}" ; do
echo "-${i}: ${command[${i}]}"
done | sort
@ -35,7 +35,7 @@ declare -A command=(
[h]="This help screen."
[n]="Image name, default is stormux-pi<3|4>-<yyyy-mm-dd>.img"
[s]="image size in GB, default is 4."
[v]="Version of the Raspberry Pi for which you are building. (3|4)"
[v]="Version of the Raspberry Pi for which you are building. (3|4 default)"
)
# Convert the keys of the associative array to a format usable by getopts
@ -104,6 +104,10 @@ for i in parted wget ; do
done
# Url for the image to be downloaded.
url[3]="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz"
url[4]="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz"
fallocate -l $imageSize "$imageName"
loopdev="$(losetup --find --show "${imageName}")"
parted --script ${loopdev} mklabel msdos mkpart primary fat32 0% 100M mkpart primary ext4 100M 100%
@ -112,14 +116,14 @@ 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
wget "${url[$imageVersion]}" -O- | bsdtar -xpf - -C /mnt
arch-chroot /mnt << "EOF"
# set up pacman
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu --needed --noconfirm base base-devel bash-completion git
# Grant sudo privileges to the wheel group
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers.d/wheel
pacman -Syu --needed --noconfirm base base-devel bash-completion cronie espeak-ng git
# Grant sudo privileges to the stormux user for package installation.
echo 'stormux ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/wheel
# Set the distribution name.
echo 'Stormux \r (\l)' > /etc/issue
echo >> /etc/issue
@ -134,6 +138,11 @@ cd ~
rm -rf yay
yay -S fenrir-git magic-wormhole
exit
# Configure sudo for group wheel, remove nopasswd for the stormux user
sed '/stormux/d' /etc/sudoers.d/wheel
sed 's/^# %wheel ALL=(ALL) ALL$/%wheel ALL=(ALL) ALL/' /etc/sudoers.d/wheel
# Enable services
systemctl enable cronie.service fenrirscreenreader.service
EOF
umount -R /mnt
partx -d ${loopdev}