Jump to content

Script/RPi-ArchInstall

From YawgNetWiki

Format MicroSD

[edit]

Change /dev/sdb to your target disk. Uncomment image sections as needed.

mkfs.vfat /dev/sdb1
mkfs.ext4 /dev/sdb2
mount /dev/sdb2 root/
mount /dev/sdb1 boot/

# Raspberry Pi 4 or 3 Aarch64 (no closed source ARMv7 packages)
# wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
# bsdtar -xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root
# Extra line for Pi4
# sed -i 's/mmcblk0/mmcblk1/g' root/etc/fstab

# Raspberry Pi 4 - ARMv7
# wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz
# bsdtar -xpf ArchLinuxARM-rpi-4-latest.tar.gz -C root

# Raspberry Pi 3 and 2 - ARMv7
# wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
# bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root

# Raspberry Pi 1 and 0 - ARMv6
# wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
# bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root

sync
mv root/boot/* boot/
read -p "Config boot/config.txt and umount"

First Boot

[edit]

Consider posting this into a script under the root/ folder for root to run after first boot:

#!/bin/bash 
clear && echo "Connect to Wifi, name it wlan0-home"
wifi-menu
netctl enable wlan0-home
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
echo '$hostname' > /etc/hostname
hostnamectl set-hostname $hostname
sed -i 's/#Color/Color/' /etc/pacman.conf
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu #Packages
clear && echo "Uncomment wheel group line"
nano /etc/sudoers
useradd -m -G wheel -s /bin/bash $user
echo "user password"
passwd $user
echo "change root password"
passwd
userdel alarm

Packages and Tweaks

[edit]

Aarch64

[edit]

RPi4

[edit]

Before unmounting the partitions, update /etc/fstab for the different SD block device compared to the Raspberry Pi 3:

   sed -i 's/mmcblk0/mmcblk1/g' root/etc/fstab

Prefer i3 or XFCE, both seem to work best on SLIM

   pacman -Syu sudo git base-devel go xf86-video-fbturbo-git xf86-video-fbdev slim xorg openssh blueman i3 dmenu
   pacman -Syu sudo git base-devel go xf86-video-fbturbo-git xf86-video-fbdev slim xorg openssh blueman xfce4 xfce4-goodies

Add the rest:

read -p "enable autologin and default user"
nano /etc/slim.conf 
systemctl enable slim 
systemctl enable sshd
systemctl enable bluetooth
echo "git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
echo 'exec i3' > ~/.xinitrc
echo 'exec blueman-applet &
exec firefox' >> ~/.config/i3/config 
" > /home/$user/yay.sh && chown $user /home/$user/yay.sh && chmod +x /home/$user/yay.sh 
echo "[Policy]
AutoEnable=true" >> /etc/bluetooth/main.conf 

RPi3

[edit]

Same as Pi4 but use this for the user setup script instead for the Bluetooth modules

echo "git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S pi-bluetooth
# might be necessary on rpi2 image - hciattach-rpi3
echo 'exec startlxde' > ~/.xinitrc

sudo echo 'btc_mode=1
btc_params8=0x4e20
btc_params1=0x7530' >> /usr/lib/firmware/updates/brcm/brcmfmac43430-sdio.txt

sudo echo 'btc_mode=1
btc_params8=0x4e20
btc_params1=0x7530' >> /usr/lib/firmware/updates/brcm/brcmfmac43455-sdio.txt" > /home/$user/yay.sh && chown $user /home/$user/yay.sh && chmod +x /home/$user/yay.sh 
echo "[Policy]
AutoEnable=true" >> /etc/bluetooth/main.conf 

In Use Images

[edit]

RPi4 "YawgDisplay"

#!/bin/bash 
clear && echo "Connect to Wifi, name it wlan0-home"
wifi-menu
netctl enable wlan0-home
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
echo 'yawgdisplay' > /etc/hostname
hostnamectl set-hostname yawgdisplay
sed -i 's/#Color/Color/' /etc/pacman.conf
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu sudo git base-devel go xf86-video-fbturbo-git xf86-video-fbdev slim xorg i3 dmenu synergy openssh nextcloud-client firefox blueman gnome-keyring
clear && echo "Uncomment wheel group line"
nano /etc/sudoers
useradd -m -G wheel -s /bin/bash yawg
echo "user password"
passwd yawg
echo "change root password"
passwd
userdel alarm
read -p "enable autologin and default user"
nano /etc/slim.conf 
systemctl enable slim 
systemctl enable sshd
systemctl enable bluetooth
echo "git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
echo 'exec i3' > ~/.xinitrc
echo 'exec blueman-applet &
exec firefox' >> ~/.config/i3/config 
" > /home/yawg/yay.sh && chown yawg /home/yawg/yay.sh && chmod +x /home/yawg/yay.sh 
echo "[Policy]
AutoEnable=true" >> /etc/bluetooth/main.conf