2020-05-01 16:19:33 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
# This script load zfs kernel module for any archiso.
|
|
|
|
|
# github.com/eoli3n
|
2020-05-01 16:26:19 +02:00
|
|
|
# Thanks to CalimeroTeknik on #archlinux-fr
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
print () {
|
|
|
|
|
echo -e "\n\033[1m> $1\033[0m\n"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "Test if archiso is running"
|
|
|
|
|
|
|
|
|
|
grep archiso /proc/cmdline
|
|
|
|
|
|
|
|
|
|
print "Set mirrorlist to current archiso date"
|
|
|
|
|
|
|
|
|
|
iso_date=$(date +%Y/%m/%d -d "$(LANG=C pacman -Qi linux |sed -n 's/^Install Date\s*: //p')")
|
2020-05-01 16:32:09 +02:00
|
|
|
echo "Server=https://archive.archlinux.org/repos/$iso_date/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
print "Add archzfs repo"
|
|
|
|
|
|
|
|
|
|
cat >> /etc/pacman.conf <<"EOF"
|
|
|
|
|
[archzfs]
|
|
|
|
|
Server = http://archzfs.com/archzfs/x86_64
|
|
|
|
|
Server = http://mirror.sum7.eu/archlinux/archzfs/archzfs/x86_64
|
|
|
|
|
Server = https://mirror.biocrafting.net/archlinux/archzfs/archzfs/x86_64
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
print "Sign archzfs"
|
|
|
|
|
|
|
|
|
|
pacman-key --recv-keys F75D9D76
|
|
|
|
|
pacman-key --lsign-key F75D9D76
|
|
|
|
|
|
|
|
|
|
print "Update lists and upgrade"
|
|
|
|
|
|
2020-05-01 16:34:58 +02:00
|
|
|
pacman -Syyu --noconfirm
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
print "Increase cowspace to half of RAM"
|
|
|
|
|
|
2020-05-01 16:45:19 +02:00
|
|
|
ram=$(free -b | grep 'Mem' | awk '{print $2}')
|
2020-05-01 16:19:33 +02:00
|
|
|
ram_half=$(echo "$ram / 2" | bc)
|
2020-05-01 16:45:19 +02:00
|
|
|
ram_half_h=$(numfmt --to=si $ram_half)
|
|
|
|
|
mount -o remount,size=$ram_half_h /run/archiso/cowspace
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
print "Install current kernel headers"
|
|
|
|
|
|
2020-05-01 16:25:32 +02:00
|
|
|
pacman -S --noconfirm linux-headers
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
print "Install zfs-dkms"
|
|
|
|
|
|
2020-05-01 16:25:32 +02:00
|
|
|
pacman -S --noconfirm zfs-dkms
|
2020-05-01 16:19:33 +02:00
|
|
|
|
|
|
|
|
print "Load zfs kernel module"
|
|
|
|
|
|
|
|
|
|
modprobe zfs
|