Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converting vanilla Arch to Artix openrc or runit - WIP for runit
:
echo Starting operation FUCKTHESKULLOFSYSTEMD
[[ $1 == openrc ]] && init=openrc
[[ $1 == runit ]] && init=runit
[[ $init ]] || { echo "Usage: $0 <openrc|runit>" ; exit 1; }
echo "================="
echo " Init: $init "
echo "================="
rm -vf /var/lib/pacman/db.lck
# A full systemd update is needed, because libsystemd -> systemd-libs
pacman -Syu --noconfirm
pacman -S --needed --noconfirm wget
cd /etc
mv -vf pacman.conf pacman.conf.arch
wget https://gitea.artixlinux.org/packagesP/pacman/raw/branch/master/trunk/pacman.conf -O /etc/pacman.conf
mv -vf pacman.d/mirrorlist pacman.d/mirrorlist-arch
wget https://gitea.artixlinux.org/packagesA/artix-mirrorlist/raw/branch/master/trunk/mirrorlist -O pacman.d/mirrorlist
cp -vf pacman.d/mirrorlist pacman.d/mirrorlist.artix
sed -i 's/Required DatabaseOptional/Never/' pacman.conf
pacman -Syy --noconfirm
echo "Answer <yes> to the next question to make sure all packages come from Artix repos"
read
pacman -Scc
pacman -S --noconfirm artix-keyring
pacman-key --populate artix
pacman-key --lsign-key 95AEC5D0C1E294FC9F82B253573A673A53C01BC2
systemctl list-units --state=running | grep -v systemd | awk '{print $1}' | grep service > /root/daemon.list
echo "Your systemd running units are saved in /root/daemon.list."
echo "Do not proceed if you've seen errors above - press CTRL-C to abort or ENTER to continue"
read
pacman -Sw --noconfirm base base-devel openrc-system grub linux-lts linux-lts-headers elogind-openrc openrc netifrc grub mkinitcpio
pacman -Rdd --noconfirm systemd systemd-libs systemd-sysvcompat pacman-mirrorlist
cp -vf pacman.d/mirrorlist.artix pacman.d/mirrorlist
[[ $init == openrc ]] && initpkg="openrc openrc-system"
[[ $init == runit ]] && initpkg="runit runit-rc" # konimex pls check
pacman -S --noconfirm base base-devel grub linux-lts linux-lts-headers elogind-openrc netifrc grub mkinitcpio archlinux-mirrorlist net-tools rsync $initpkg
pacman -S --noconfirm --needed at-$init xinetd-$init cronie-$init haveged-$init hdparm-$init openssh-$init syslog-ng-$init
[[ $init == openrc ]] && { rc-update add haveged boot; rc-update add udev sysinit; for daemon in atd cronie sshd syslog-ng; do rc-update add $daemon; done }
[[ $init == runit ]] && { # konimex pls check }
echo "Activating standard network interface naming (i.e. eth0)."
echo "If you prefer the persistent naming, remove the last line ('net.ifnames=0') from /etc/default/grub"
echo 'GRUB_CMDLINE_LINUX="net.ifnames=0"' >>/etc/default/grub
read
[[ $init == openrc ]] && pacman -S --needed --noconfirm netifrc
echo "============================"
echo "Write down you IP and route."
echo "============================"
ifconfig
route
echo "=========================================================="
echo " Press ENTER to configure static networking. "
echo "No editing is needed if you use dhcp or a network manager."
echo "=========================================================="
read
[[ $init == openrc ]] && { nano /etc/conf.d/net; ln -s /etc/init.d/net.lo /etc/init.d/net.eth0; rc-update add net.eth0 boot; }
[[ $init == runit ]] && { # konimex pls check }
for user in systemd-journal systemd-journal-gateway systemd-timesync systemd-network systemd-bus-proxy systemd-journal-remote systemd-journal-upload; do userdel $user; done
sed -i 's/= Never/= Required DatabaseOptional/' /etc/pacman.conf
sed -i 's/#rc_parallel="NO"/rc_parallel="YES"/' /etc/rc.conf
mkinitcpio -P
grub-mkconfig -o /boot/grub/grub.cfg
echo "==========================================="
echo "= If you haven't seen any errors ="
echo "= press ENTER to reboot ="
echo "= Otherwise, switch console and fix them. ="
echo "==========================================="
read
sync
mount -f / -o remount,ro
echo s >| /proc/sysrq-trigger
echo u >| /proc/sysrq-trigger
echo b >| /proc/sysrq-trigger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.