Last active
February 4, 2025 17:56
-
-
Save Quackdoc/27f841d6e92b14ae9e1f47ca7240b258 to your computer and use it in GitHub Desktop.
simple script to start a serpent chroot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mnt="/tmp/serpent" | |
mkdir -p /tmp/serpent-tmp | |
mkdir -p /tmp/serpent/tmp | |
mkdir -p /tmp/serpent/dev | |
mkdir -p /tmp/serpent/proc | |
mkdir -p /tmp/serpent/sys | |
sudo mount -o remount,rw,suid /tmp | |
### Bootstrap | |
curl -LO https://github.com/serpent-os/tools/releases/download/nightly-20250131-010401/moss.tar.gz | |
tar xf moss.tar.gz | |
sudo ./moss -D serpent/ repo add volatile https://packages.serpentos.com/volatile/x86_64/stone.index | |
sudo ./moss -D serpent/ install bash cosmic-comp zsh sudo shadow moss vim | |
### chroot stuff, double mount was an attempt to workaround update issues, | |
### Things in general seemed to work better with it | |
sudo mount -t tmpfs tmpfs serpent-tmp | |
sudo mount -o bind serpent serpent-tmp | |
sudo mount -o bind /dev /tmp/serpent-tmp/dev/ | |
sudo mount -t proc proc /tmp/serpent-tmp/proc/ | |
sudo mount -t sysfs sysfs /tmp/serpent-tmp/sys/ | |
sudo mount -t devpts devpts /tmp/serpent-tmp/dev/pts/ | |
sudo mount -o bind /run/user/1000 /tmp/serpent-tmp/tmp | |
sudo chroot serpent/ /bin/bash -c "echo 'nameserver 1.1.1.1' > /etc/resolv.conf" | |
sudo chroot serpent/ /bin/bash -c "/usr/sbin/useradd -m -G wheel USERNAME" | |
sudo chroot serpent/ /bin/bash -c "/usr/sbin/groupadd -g 1000 user" | |
sudo chroot serpent/ /bin/bash -c "passwd USERNAME" | |
sudo chroot serpent/ | |
### Use nspawn instead if you can, being a container based solution, | |
### this will mean updates and whatnot work. Comment out mounting stuff. | |
#sudo systemd-nspawn --directory serpent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment