# OS Setup

## Swap file

On Btrfs:

```bash
btrfs subvolume create /.swap
truncate -s 0 /.swap/swapfile
chattr +C /.swap/swapfile
fallocate -l 2G /.swap/swapfile
chmod 600 /.swap/swapfile
mkswap /.swap/swapfile
echo "/.swap/swapfile none swap rw,nofail 0 0" >> /etc/fstab
swapon -a
```

On ext4:

```bash
truncate -s 0 /swapfile
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
echo "/swapfile none swap rw,nofail 0 0" >> /etc/fstab
swapon -a
```

## Chroot to Linux root

```
cd /mnt/<root>
mount -o bind /dev dev
mount -o bind /proc proc
mount -o bind /sys sys
mount -o bind /sys/firmware/efi/efivars sys/firmware/efi/efivars
mount -o bind /run run
```

## Void Linux

- ISO: https://voidlinux.org/download/
- Use x86\_64 Live image glibc

### Basic packages

```
xbps-install xtools fish-shell helix
chsh -s /usr/bin/fish root
chsh -s /usr/bin/fish hxd
ip addr
```

Now SSH to host:

```
ssh hxd@192.168.0.x
sudo -i
```

### Custom repository and mascot

- Repository URL: [https://voidlinux.jpastuszek.net/](https://voidlinux.jpastuszek.net/)
- Fingerprint: `63:d7:85:df:db:75:a3:3e:e8:96:9f:78:49:ee:43:ff`

```
echo "repository=https://voidlinux.jpastuszek.net" > /etc/xbps.d/jpastuszek.conf
xi -S mascot mascot-delegate-xbps-package mascot-delegate-runit-service
```

Get `sudo` working without password so you can run `mascot-converge` with `sudo`:

```
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/wheel
```

Converge with mascot:

```
www/base-access | ssh hxd@192.168.0.x sudo mascot-converge
www/base-hw | ssh hxd@192.168.0.x sudo mascot-converge
www/rc | ssh hxd@192.168.0.x sudo mascot-converge
www/xbps | ssh hxd@192.168.0.x sudo mascot-converge
www/syslog-dmesg | ssh hxd@192.168.0.x sudo mascot-converge
```

Finalize with:

```
xbps-reconfigure -fa
reboot
```