artix

by agausmann
3 deployments · 3 still active · last rev. 28 days ago

Migrates an official Arch Linux image to Artix Linux.

Compatible with: Arch Linux
						#!/bin/bash

# Move Arch mirrorlist to alternate path:
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-arch

# Add artix mirrorlist:
cat > /etc/pacman.d/mirrorlist <<EOF
# Worldwide mirrors
Server = https://mirror.clarkson.edu/artix-linux/repos/\$repo/os/\$arch
Server = https://ftp.sh.cvut.cz/artix-linux/\$repo/os/\$arch
Server = https://ftp.cc.uoc.gr/mirrors/linux/artixlinux/\$repo/os/\$arch
Server = https://artix.wheaton.edu/repos/\$repo/os/\$arch
Server = http://mirror.strits.dk/artix-linux/repos/\$repo/os/\$arch
Server = https://mirrors.dotsrc.org/artix-linux/repos/\$repo/os/\$arch
Server = http://mirror1.artixlinux.org/repos/\$repo/os/\$arch
EOF

# Update /etc/pacman.conf:
sed -i '

# Update references to Arch mirror list:
s$/etc/pacman.d/mirrorlist$/etc/pacman.d/mirrorlist-arch$

# Add Artix repositories before Arch:
/\[testing\]/i\
[system]\
Include = /etc/pacman.d/mirrorlist\
[world]\
Include = /etc/pacman.d/mirrorlist\
[galaxy]\
Include = /etc/pacman.d/mirrorlist

# Disable Arch core repository:
/\[core\]/,+1s/^/#/

# (Temporarily) Disable signature checking to install artix-keyring:
/^SigLevel/c\SigLevel = Never

' /etc/pacman.conf

# Update caches:
pacman -Scc --noconfirm
pacman -Syy --noconfirm

# Update keyring:
pacman -S --noconfirm artix-keyring
pacman-key --populate artix
pacman-key --recv-key 78C9C713EAD7BEC69087447332E21894258C6105
pacman-key --lsign-key 78C9C713EAD7BEC69087447332E21894258C6105

# Re-enable package signature checks:
sed -i '/^SigLevel/c\SigLevel = Required DatabaseOptional' /etc/pacman.conf

# Download packages before systemd gets removed (in case of networking loss):
pacman -Suw --noconfirm base base-devel runit-system grub linux-lts linux-lts-headers systemd-dummy libsystemd-dummy runit mkinitcpio opensysusers pacman artix-mirrorlist archlinux-mirrorlist

# Remove systemd:
pacman -Rdd --noconfirm systemd libsystemd systemd-sysvcompat

# Install downloaded packages
pacman -Su --noconfirm base base-devel runit-system grub linux-lts linux-lts-headers systemd-dummy libsystemd-dummy runit mkinitcpio opensysusers pacman artix-mirrorlist archlinux-mirrorlist

# Handle pacnew/pacsave
mv /etc/pacman.d/mirrorlist-arch.pacnew /etc/pacman.d/mirrorlist-arch
mv /etc/pacman.conf.pacnew /etc/pacman.conf
rm /boot/grub/grub.cfg.pacnew
rm /etc/default/grub.pacnew
rm /etc/pacman.d/mirrorlist.pacsave

# Re-enable services with runit
ln -s /etc/runit/sv/{agetty-ttyS0,dhcpcd,sshd} /etc/runit/runsvdir/default/

# Update boot images and bootloader config
mkinitcpio -P
update-grub

# Reboot
umount -a
mount -f / -o remount,ro
echo s >| /proc/sysrq-trigger
echo u >| /proc/sysrq-trigger
echo b >| /proc/sysrq-trigger