diff --git a/config files/apt/etc/apt/apt.conf.d/99parallel-fetch b/config files/apt/etc/apt/apt.conf.d/99parallel-fetch new file mode 100644 index 0000000..2b5383b --- /dev/null +++ b/config files/apt/etc/apt/apt.conf.d/99parallel-fetch @@ -0,0 +1,2 @@ +APT::Acquire::Queue-Mode "access"; +APT::Acquire::Retries 3; diff --git a/config files/debian/etc/apt/preferences.d/debian-release-pinning b/config files/debian/etc/apt/preferences.d/debian-release-pinning new file mode 100644 index 0000000..2f4fbf1 --- /dev/null +++ b/config files/debian/etc/apt/preferences.d/debian-release-pinning @@ -0,0 +1,11 @@ +Package: * +Pin: release a=stable +Pin-Priority: 990 + +Package: * +Pin: release a=testing +Pin-Priority: 490 + +Package: * +Pin: release a=unstable +Pin-Priority: -1 diff --git a/config files/debian/etc/apt/preferences.d/firefox-pinning b/config files/debian/etc/apt/preferences.d/firefox-pinning new file mode 100644 index 0000000..5d7c977 --- /dev/null +++ b/config files/debian/etc/apt/preferences.d/firefox-pinning @@ -0,0 +1,3 @@ +Package: firefox +Pin: release a=unstable +Pin-Priority: 990 diff --git a/examples/archlinux/enable-hibernation-from-swapfile.sh b/examples/archlinux/enable-hibernation-from-swapfile.sh new file mode 100644 index 0000000..0cb2f21 --- /dev/null +++ b/examples/archlinux/enable-hibernation-from-swapfile.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# enable hibernation from a swapfile on btrfs + +# source: +# - https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate + +sudo mkdir /swap + +# disable copy-on-write and compression on the directory +sudo chattr -R +C /swap +sudo btrfs property set /swap compression none + +# create the swapfile +sudo fallocate -l 32GiB /swap/swapfile +sudo chmod -R 600 /swap +sudo mkswap --label swap /swap/swapfile +sudo swapon /swap/swapfile + +# configure swappiness +sudo nano /etc/sysctl.d/swappiness +sudo sysctl --load=/etc/sysctl.d/swappiness + +# identify the swap device +# value is to be used for the resume=UUID= kernel parameter +sudo findmnt -no UUID -T /swap/swapfile + +# identify the file offset +# value is to be used for the resume_offset= kernel parameter +curl --location --output /tmp/btrfs_map_physical.c https://raw.githubusercontent.com/osandov/osandov-linux/master/scripts/btrfs_map_physical.c +gcc -O2 -o /tmp/btrfs_map_physical /tmp/btrfs_map_physical.c +chmod a+x /tmp/btrfs_map_physical +physical_offset=$(sudo /tmp/btrfs_map_physical /swap/swapfile | awk '$1==0 {print $NF}') # last column of the line starting with 0 +resume_offset=$(( ${physical_offset} / $(getconf PAGESIZE) )) + +# configure the bootloader +# GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=... resume=UUID=bac7930a-924d-4e9d-83eb-ad6ce5a8100a resume_offset=1865170" +sudo nano /etc/default/grub +sudo grub-mkconfig -o /boot/grub/grub.cfg + +# configure the mkinitcpio +# not needed if using the systemd hook +# add resume after filesystems: HOOKS=(base ... filesystems resume fsck) +sudo nano /etc/mkinitcpio.conf +mkinitcpio -p linux + +# reboot + +# check with `systemctl hibernate` diff --git a/examples/gentoo/install.virtualbox.sh b/examples/gentoo/install.virtualbox.sh new file mode 100755 index 0000000..887b2ef --- /dev/null +++ b/examples/gentoo/install.virtualbox.sh @@ -0,0 +1,173 @@ +#!/usr/bin/env sh + +# sources +# - https://wiki.gentoo.org/wiki/Handbook:AMD64 +# - https://wiki.gentoo.org/wiki/Localization/Guide + +# start with gentoo live, with UEFI + +# /etc/init.d/sshd start +# passwd $complicated_password + +sgdisk --zap-all /dev/sda +sgdisk --clear /dev/sda + +sgdisk --new 1:2048:+128M /dev/sda +sgdisk --typecode 1:ef00 /dev/sda +sgdisk --change-name 1:EFI /dev/sda +mkfs.vfat -F 32 -n EFI /dev/sda1 + +sgdisk --new 2:+0M: /dev/sda +sgdisk --change-name 2:ROOT /dev/sda +mkfs.ext4 -F -L System /dev/sda2 + +mkdir -p /mnt/gentoo +mount /dev/sda2 /mnt/gentoo +mkdir -p /mnt/gentoo/boot +chattr +i /mnt/gentoo/boot +mount /dev/sda1 /mnt/gentoo/boot + +hwclock --systohc +ntpd -q -g + +cd /mnt/gentoo + +wget https://ftp.snt.utwente.nl/pub/os/linux/gentoo/releases/amd64/autobuilds/current-stage3-amd64-hardened/stage3-amd64-hardened-20210623T214504Z.tar.xz +tar -xpf stage3-amd64-*.tar.xz +rm -f stage3-amd64-*.tar.xz + +wget https://ftp.snt.utwente.nl/pub/os/linux/gentoo/snapshots/portage-latest.tar.xz +tar -xf portage-latest.tar.xz -C /mnt/gentoo/usr +rm -f portage-latest.tar.xz + +mount --types proc /proc /mnt/gentoo/proc +mount --rbind /sys /mnt/gentoo/sys +mount --make-rslave /mnt/gentoo/sys +mount --rbind /dev /mnt/gentoo/dev +mount --make-rslave /mnt/gentoo/dev + +cp /etc/resolv.conf /mnt/gentoo/etc +chroot /mnt/gentoo /bin/bash +source /etc/profile +export PS1="(chroot) ${PS1}" +ping -c 3 google.com + +fallocate -l 1G /swapfile # or sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576 +chmod 600 /swapfile +mkswap /swapfile +swapon /swapfile + +mkdir -p /etc/portage/package.{accept_keywords,license,use} + +JOBS="$(nproc)" +LOAD_AVERAGE="$(python -c "print($(nproc)*0.9)")" +cat >> /etc/portage/make.conf < /etc/timezone +emerge --config sys-libs/timezone-data + +echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen +locale-gen +eselect locale set "en_US.utf8" +env-update && source /etc/profile && export PS1="(chroot) ${PS1}" + +cat > /etc/fstab < + +LABEL=EFI /boot vfat noauto,noatime 1 2 +LABEL=System / ext4 discard,noatime 0 1 + +/swapfile swap swap defaults 0 0 +#tmpfs /run tmpfs rw,nodev,nosuid 0 0 +EOF + +echo 'hostname="gentoo"' > /etc/conf.d/hostname + +echo "sys-kernel/linux-firmware linux-fw-redistributable no-source-code" > /etc/portage/package.license/kernel +emerge \ + --quiet --verbose \ + sys-kernel/gentoo-sources sys-kernel/genkernel +eselect kernel set 1 +genkernel all + +emerge \ + --quiet --verbose \ + --noreplace \ + net-misc/netifrc +echo 'config_enp0s3="dhcp"' > /etc/conf.d/net +sed -i.bak \ + -e 's/^127.0.0.1.*/127.0.0.1\tlocalhost gentoo/' \ + -e 's/^::1.*/::1\t\tlocalhost gentoo/' \ + /etc/hosts +cd /etc/init.d +ln -s net.lo net.enp0s3 +rc-update add net.enp0s3 default +cd - + +sed -i.bak 's/^enforce=everyone$/enforce=none/' /etc/security/passwdqc.conf +emerge \ + --quiet --verbose \ + app-admin/sudo +echo '%wheel ALL=(ALL) ALL' | tee /etc/sudoers.d/wheel +useradd -m -G users,wheel,audio -s /bin/bash mek +passwd mek +passwd -l root + +emerge \ + --quiet --verbose \ + app-admin/sysklogd +rc-update add sysklogd default + +emerge \ + --quiet --verbose \ + sys-process/cronie +rc-update add cronie default + +emerge \ + --quiet --verbose \ + net-misc/dhcpcd +rc-update add dhcpcd default + +rc-update add sshd default + +echo 'sys-process/bpytop ~amd64' | tee /etc/portage/package.accept_keywords/bpytop +emerge \ + --quiet --verbose \ + bpytop \ + nfs-utils \ + samba \ + tmux + +emerge \ + --quiet --verbose \ + sys-boot/grub:2 +grub-install --target=x86_64-efi --efi-directory=/boot +grub-mkconfig -o /boot/grub/grub.cfg + +exit + +cd +umount -lR /mnt/gentoo +reboot diff --git a/examples/gentoo/post-install.virtualbox.sh b/examples/gentoo/post-install.virtualbox.sh new file mode 100755 index 0000000..234088a --- /dev/null +++ b/examples/gentoo/post-install.virtualbox.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env sh + +eselect profile set "default/linux/amd64/17.1/desktop/plasma" +emerge --sync +emerge \ + --quiet --verbose \ + --update --deep --with-bdeps=y \ + --changed-use --newuse \ + @world + + +cat | tee /etc/portage/package.use/kde < /home/mek/.xinitrc <> /etc/pam.d/sddm-greeter +sed -i.backup 's/^DISPLAYMANAGER=.*$/DISPLAYMANAGER="sddm"/' /etc/conf.d/display-manager +rc-update add display-manager default + +echo | tee /etc/portage/package.use/firefox-bin <