├── vagrant ├── .gitignore ├── download_iso.sh ├── README.md └── Vagrantfile ├── ansible ├── hosts ├── roles │ ├── containers │ │ ├── templates │ │ │ ├── subgid.j2 │ │ │ └── subuid.j2 │ │ ├── files │ │ │ ├── registries.conf │ │ │ └── storage.conf │ │ └── tasks │ │ │ └── main.yml │ ├── zfs │ │ ├── files │ │ │ ├── zscrub │ │ │ └── zrepl.yml │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── btrfs │ │ ├── initramfs │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ ├── files │ │ │ │ ├── mkinitcpio.conf │ │ │ │ └── linux-lts.preset │ │ │ └── tasks │ │ │ │ └── main.yml │ │ ├── grub │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ └── tasks │ │ │ │ └── main.yml │ │ ├── snapper │ │ │ ├── files │ │ │ │ ├── snapper │ │ │ │ └── root │ │ │ ├── tasks │ │ │ │ └── main.yml │ │ │ └── handlers │ │ │ │ └── main.yml │ │ └── packages │ │ │ └── tasks │ │ │ └── main.yml │ ├── guest │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── zram │ │ ├── files │ │ │ └── zram-generator.conf │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── cronie │ │ ├── tasks │ │ │ └── main.yml │ │ └── handlers │ │ │ └── main.yml │ ├── printers │ │ ├── tasks │ │ │ └── main.yml │ │ └── handlers │ │ │ └── main.yml │ ├── pacman │ │ ├── files │ │ │ └── reflector.conf │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── virtualization │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── com │ │ └── tasks │ │ │ └── main.yml │ ├── aur │ │ └── tasks │ │ │ └── main.yml │ ├── recovery │ │ └── tasks │ │ │ └── main.yml │ ├── ansible │ │ └── tasks │ │ │ └── main.yml │ ├── flatpak │ │ └── tasks │ │ │ └── main.yml │ ├── base │ │ └── tasks │ │ │ └── main.yml │ └── desktop │ │ └── tasks │ │ └── main.yml ├── ansible.cfg ├── contrib │ └── syntax-check.sh ├── README.md ├── install-btrfs.yml └── install-zfs.yml ├── .gitmodules ├── doc ├── README.md └── help │ ├── README.md │ ├── 000_template.md │ └── 001_boot_not_working_after_install.md ├── TIPS ├── scripts ├── zfs │ ├── recover │ │ ├── 02-umount.sh │ │ ├── README.md │ │ └── 01-mount.sh │ └── install │ │ ├── TODO │ │ ├── install.dist.conf │ │ ├── README.md │ │ ├── 01-configure.sh │ │ └── 02-install.sh ├── btrfs │ ├── README.md │ ├── 01-configure.sh │ └── 02-install.sh └── README.md ├── .pre-commit-config.yaml ├── README.md ├── CHANGELOG.md └── LICENSE /vagrant/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /ansible/hosts: -------------------------------------------------------------------------------- 1 | localhost ansible_connection=local ansible_user=user 2 | -------------------------------------------------------------------------------- /ansible/roles/containers/templates/subgid.j2: -------------------------------------------------------------------------------- 1 | {{user}}:100000:65536 2 | -------------------------------------------------------------------------------- /ansible/roles/containers/templates/subuid.j2: -------------------------------------------------------------------------------- 1 | {{user}}:100000:65536 2 | -------------------------------------------------------------------------------- /ansible/roles/zfs/files/zscrub: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | zpool scrub zroot 4 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/initramfs/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: generates initramfs 4 | shell: mkinitcpio -P 5 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/grub/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: update grub 4 | shell: grub-mkconfig -o /boot/grub/grub.cfg 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ansible/plugins/modules/aur"] 2 | path = ansible/plugins/modules/aur 3 | url = https://github.com/kewlfft/ansible-aur.git 4 | -------------------------------------------------------------------------------- /ansible/roles/guest/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart sshd 3 | systemd: 4 | name: sshd 5 | state: restarted 6 | enabled: yes 7 | -------------------------------------------------------------------------------- /ansible/roles/zram/files/zram-generator.conf: -------------------------------------------------------------------------------- 1 | [zram0] 2 | zram-size = ram / 2 3 | compression-algorithm = zstd 4 | swap-priority = 100 5 | fs-type = swap 6 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | As you see right now, there is not much. The [main readme](../README.md) file contains all without beeing bloated. 4 | 5 | -------------------------------------------------------------------------------- /ansible/roles/cronie/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install cronie package 3 | pacman: 4 | name: cronie 5 | state: present 6 | notify: enable cronie 7 | -------------------------------------------------------------------------------- /ansible/roles/printers/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: install cups 4 | pacman: 5 | name: 6 | - cups 7 | - hplip 8 | notify: enable cups 9 | -------------------------------------------------------------------------------- /ansible/roles/pacman/files/reflector.conf: -------------------------------------------------------------------------------- 1 | --country France 2 | --country Germany 3 | --latest 6 4 | --protocol https 5 | --sort rate 6 | --save /etc/pacman.d/mirrorlist 7 | -------------------------------------------------------------------------------- /ansible/roles/zfs/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart zrepl 3 | systemd: 4 | name: zrepl 5 | state: restarted 6 | daemon_reload: yes 7 | enabled: yes 8 | -------------------------------------------------------------------------------- /doc/help/README.md: -------------------------------------------------------------------------------- 1 | # Help section 2 | 3 | ## Solved issues 4 | 5 | * [Boot not working after install](001_boot_not_working_after_install.md) 6 | 7 | ## Open issues 8 | 9 | -------------------------------------------------------------------------------- /ansible/roles/cronie/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: enable cronie 3 | systemd: 4 | name: cronie 5 | state: started 6 | daemon_reload: yes 7 | enabled: yes 8 | -------------------------------------------------------------------------------- /ansible/roles/printers/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: enable cups 3 | systemd: 4 | name: cups 5 | state: restarted 6 | daemon_reload: yes 7 | enabled: yes 8 | -------------------------------------------------------------------------------- /doc/help/000_template.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | ## Issue 4 | 5 | <Descrition> 6 | 7 | ## Solution 8 | 9 | <Solution> 10 | 11 | ## Links 12 | 13 | * <optional links> 14 | 15 | -------------------------------------------------------------------------------- /ansible/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./hosts 3 | display_skipped_hosts = False 4 | host_key_checking = False 5 | library = ./plugins/modules 6 | interpreter_python = auto_silent 7 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/snapper/files/snapper: -------------------------------------------------------------------------------- 1 | ## Path: System/Snapper 2 | 3 | ## Type: string 4 | ## Default: "" 5 | # List of snapper configurations. 6 | SNAPPER_CONFIGS="root" 7 | -------------------------------------------------------------------------------- /ansible/roles/virtualization/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart libvirt 3 | systemd: 4 | name: libvirtd 5 | state: restarted 6 | daemon_reload: yes 7 | enabled: yes 8 | -------------------------------------------------------------------------------- /ansible/roles/zram/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart zram-generator 3 | systemd: 4 | name: systemd-zram-setup@zram0.service 5 | state: restarted 6 | daemon_reload: yes 7 | enabled: yes 8 | -------------------------------------------------------------------------------- /ansible/contrib/syntax-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Workaround to detect aur submodule library with pre-commit 3 | 4 | CURRENT_DIR=$(dirname "$0") 5 | cd "$CURRENT_DIR"/.. || exit 1 6 | ansible-playbook --syntax-check install-zfs.yml 7 | -------------------------------------------------------------------------------- /ansible/roles/com/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Add user to uucp group 3 | user: 4 | name: '{{ user }}' 5 | groups: docker 6 | append: yes 7 | 8 | - name: Install picocom 9 | pacman: 10 | name: picocom 11 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/initramfs/files/mkinitcpio.conf: -------------------------------------------------------------------------------- 1 | MODULES=(intel_agp i915) 2 | BINARIES=(/usr/bin/btrfs) 3 | FILES=() 4 | HOOKS=(base systemd autodetect modconf block sd-vconsole sd-encrypt sd-lvm2 filesystems keyboard resume fsck) 5 | COMPRESSION="lz4" 6 | -------------------------------------------------------------------------------- /ansible/roles/pacman/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: enable reflector 3 | systemd: 4 | name: '{{ item }}' 5 | daemon_reload: yes 6 | enabled: yes 7 | state: started 8 | loop: 9 | - reflector.service 10 | - reflector.timer 11 | -------------------------------------------------------------------------------- /ansible/roles/zram/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install zram-generator 3 | pacman: 4 | name: zram-generator 5 | 6 | - name: configure zram generator 7 | copy: 8 | src: zram-generator.conf 9 | dest: /etc/systemd/ 10 | notify: restart zram-generator 11 | -------------------------------------------------------------------------------- /TIPS: -------------------------------------------------------------------------------- 1 | # External snapshot with virsh (RAM only) 2 | sudo virsh snapshot-create-as --domain archlinux zfs-module --memspec file=/mnt/cle/snapshots/mem-state1.qcow2,snapshot=external --atomic 3 | 4 | # To restore, shutdown VM 5 | sudo virsh restore /mnt/cle/snapshots/mem-state1.qcow2 6 | -------------------------------------------------------------------------------- /ansible/README.md: -------------------------------------------------------------------------------- 1 | ### Run ansible 2 | 3 | 1. Install ansible with pacman package 4 | 2. Run 5 | ``` 6 | git clone --recursive https://github.com/eoli3n/arch-config 7 | cd arch-config/ansible 8 | ansible-playbook install-{zfs,btrfs}.yml -K 9 | ``` 10 | 3. Remove ansible pacman package 11 | -------------------------------------------------------------------------------- /scripts/zfs/recover/02-umount.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | print () { 4 | echo -e "\n\033[1m> $1\033[0m\n" 5 | } 6 | 7 | print "Umount /boot" 8 | umount /mnt/boot 9 | umount /mnt/efi 10 | 11 | print "Export zpool" 12 | zpool export zroot 13 | 14 | # Finish 15 | echo -e "\e[32mAll OK" 16 | -------------------------------------------------------------------------------- /ansible/roles/aur/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: add sudo conf for aur 3 | tags: always 4 | lineinfile: 5 | path: /etc/sudoers 6 | line: '{{user}} ALL=(ALL) NOPASSWD: /usr/bin/pacman' 7 | 8 | - name: install AUR helper 9 | become: no 10 | aur: 11 | name: trizen 12 | use: makepkg 13 | skip_installed: true 14 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/initramfs/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: configure mkinitcpio 4 | copy: 5 | src: mkinitcpio.conf 6 | dest: /etc/ 7 | notify: generates initramfs 8 | 9 | - name: configure mkinitcpio preset linux 10 | copy: 11 | src: linux-lts.preset 12 | dest: /etc/mkinitcpio.d/ 13 | notify: generates initramfs 14 | -------------------------------------------------------------------------------- /ansible/roles/guest/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install openssh 3 | pacman: 4 | name: openssh 5 | state: present 6 | 7 | - name: configure SSHD 8 | lineinfile: 9 | path: /etc/ssh/sshd_config 10 | regexp: '^#PermitRootLogin' 11 | line: 'PermitRootLogin yes' 12 | notify: restart sshd 13 | 14 | - meta: flush_handlers 15 | -------------------------------------------------------------------------------- /scripts/zfs/install/TODO: -------------------------------------------------------------------------------- 1 | - solve locale grub : https://forums.archlinux.fr/viewtopic.php?t=13830 2 | - periodic trim with timer when host is down ? https://unix.stackexchange.com/a/352596 3 | - test resume in GRUB_CMDLINE_LINUX 4 | - reflector systemd timer 5 | - see Wayne's World 6 | - dynamic disk in 01-mount.sh recover script 7 | 8 | ### zfsbootmenu 9 | - pacman hook to "generate-zbm" at each zfs-dkms upgrade 10 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/packages/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install compsize 3 | pacman: 4 | name: compsize 5 | state: present 6 | 7 | - name: create /efi /boot bind mount 8 | lineinfile: 9 | path: /etc/fstab 10 | regexp: '/efi.*' 11 | line: '/efi /boot none rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro,bind 0 0' 12 | state: present 13 | -------------------------------------------------------------------------------- /scripts/btrfs/README.md: -------------------------------------------------------------------------------- 1 | ### Partition table 2 | 3 | - sda1 4 | /boot 5 | FAT used as esp 6 | - sda2 7 | swap 8 | reencrypted at each boot 9 | - sda3 10 | / 11 | BTRFS over LUKS 12 | 13 | ### Install 14 | 15 | Boot latest archiso. 16 | 17 | ``` 18 | loadkeys fr 19 | pacman -Sy git 20 | git clone https://github.com/eoli3n/arch-config 21 | cd arch-config/scripts/install 22 | ./01-configure.sh 23 | ./02-install.sh 24 | ``` 25 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | ### Scripts to install on different rootfs 2 | 3 | For each: 4 | 5 | ``01-configure.sh`` will 6 | - Create partition scheme 7 | - Format everything 8 | - Mount partitions 9 | 10 | ``02-install.sh`` will 11 | - Configure mirrors 12 | - Install Arch Linux and kernel 13 | - Generate initramfs 14 | - Configure hostname, locales, keymap, network 15 | - Install and configure bootloader 16 | - Generate users and passwords 17 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/initramfs/files/linux-lts.preset: -------------------------------------------------------------------------------- 1 | # mkinitcpio preset file for the 'linux' package 2 | 3 | ALL_config="/etc/mkinitcpio.conf" 4 | ALL_kver="/boot/vmlinuz-linux-lts" 5 | 6 | PRESETS=('default') 7 | 8 | #default_config="/etc/mkinitcpio.conf" 9 | default_image="/boot/initramfs-linux.img" 10 | #default_options="" 11 | 12 | #fallback_config="/etc/mkinitcpio.conf" 13 | #fallback_image="/boot/initramfs-linux-fallback.img" 14 | #fallback_options="-S autodetect" 15 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/grub/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: create locale grub dir 4 | file: 5 | path: /boot/grub/locale 6 | state: directory 7 | 8 | - name: copy fr locale grub 9 | copy: 10 | src: /usr/share/locale/fr/LC_MESSAGES/grub.mo 11 | dest: /boot/grub/locale/fr.gmo 12 | 13 | - name: configure grub 14 | lineinfile: 15 | path: /etc/default/grub 16 | regexp: 'GRUB_CMDLINE_LINUX=.*' 17 | line: 'GRUB_CMDLINE_LINUX="{{cmdline}}"' 18 | state: present 19 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/snapper/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install snapper 3 | pacman: 4 | name: 5 | - snapper 6 | - snap-pac 7 | - grub-btrfs 8 | state: present 9 | notify: update grub 10 | 11 | - name: configure snapper 12 | copy: 13 | src: root 14 | dest: /etc/snapper/configs/ 15 | notify: 16 | - enable grub-btrfs 17 | - enable timeline 18 | - enable cleaner 19 | 20 | - name: activate snapper configuration 21 | copy: 22 | src: snapper 23 | dest: /etc/conf.d 24 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/snapper/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: update grub 3 | shell: grub-mkconfig -o /boot/grub/grub.cfg 4 | 5 | - name: enable grub-btrfs 6 | systemd: 7 | name: grub-btrfs.path 8 | state: restarted 9 | enabled: yes 10 | 11 | - name: enable timeline 12 | systemd: 13 | name: snapper-timeline.timer 14 | state: restarted 15 | daemon_reload: yes 16 | enabled: yes 17 | 18 | - name: enable cleaner 19 | systemd: 20 | name: snapper-cleanup.timer 21 | state: restarted 22 | daemon_reload: yes 23 | enabled: yes 24 | -------------------------------------------------------------------------------- /ansible/roles/virtualization/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install virt packages 3 | pacman: 4 | name: 5 | - qemu-base 6 | - libvirt 7 | - virt-manager 8 | - ebtables 9 | - dnsmasq 10 | - ovmf 11 | - vagrant 12 | notify: restart libvirt 13 | 14 | - name: add user to libvirt group 15 | user: 16 | name: '{{user}}' 17 | groups: libvirt 18 | append: yes 19 | 20 | - name: enable nested virtualization 21 | copy: 22 | dest: /etc/modprobe.d/kvm.conf 23 | content: | 24 | options kvm_intel nested=1 25 | -------------------------------------------------------------------------------- /vagrant/download_iso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | repo="https://mir.archlinux.fr/iso/latest/" 4 | dest_file="/tmp/archlinux.iso" 5 | 6 | if [[ "$1" == start ]] 7 | then 8 | iso="${repo}$(curl -s ${repo} | grep -Eo 'archlinux-[0-9]{4}\.[0-9]{2}\.[0-9]{2}-x86_64\.iso' | head -n1)" 9 | if [[ ! -f "$dest_file" ]] 10 | then 11 | echo "-> Download latest archlinux iso" 12 | wget "$iso" --quiet -O "$dest_file" 13 | fi 14 | elif [[ "$1" == "stop" ]] 15 | then 16 | echo "-> Delete archlinux iso" 17 | rm "$dest_file" 18 | else 19 | echo "Please use $0 [start|stop]" 20 | fi 21 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.0.1 4 | hooks: 5 | - id: check-yaml 6 | - id: trailing-whitespace 7 | args: [--markdown-linebreak-ext=md] 8 | - repo: https://github.com/shellcheck-py/shellcheck-py 9 | rev: v0.7.2.1 10 | hooks: 11 | - id: shellcheck 12 | - repo: local 13 | hooks: 14 | - id: ansible-syntax-check 15 | name: Ansible syntax check 16 | entry: "ansible/contrib/syntax-check.sh" 17 | pass_filenames: no 18 | types_or: [yaml, jinja] 19 | language: script 20 | -------------------------------------------------------------------------------- /vagrant/README.md: -------------------------------------------------------------------------------- 1 | # Using vagrant 2 | 3 | ## Run 4 | 5 | It will automatically download latest archlinux iso in /tmp and use it. 6 | 7 | ```bash 8 | # Run 9 | $ vagrant plugin install vagrant-libvirt 10 | $ vagrant up archlinux 11 | ``` 12 | 13 | ## Remove 14 | 15 | ``destroy`` subcommand will automatically remove the iso file in /tmp 16 | 17 | nvram file is not properly removed, you need to remove it manually before destroying. 18 | https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1371 19 | ```bash 20 | $ sudo rm /var/lib/libvirt/qemu/nvram/archlinux-vagrant.fd 21 | $ vagrant destroy archlinux 22 | ``` 23 | -------------------------------------------------------------------------------- /doc/help/001_boot_not_working_after_install.md: -------------------------------------------------------------------------------- 1 | # Boot not working after install 2 | 3 | ## Issue 4 | 5 | It can happen that an older entry in your efibootmenu is preventing zfsbootmenu to work. 6 | 7 | ## Solution 8 | 9 | Use `efibootmgr` to remove all unneeded boot entries 10 | 11 | ```bash 12 | #list existing entries 13 | efibootmgr 14 | 15 | #delete number until all unneeded are removed 16 | efibootmgr --delete-bootnum --bootnum <xxxx> 17 | ``` 18 | 19 | Rerun the installation and all should be fine. 20 | 21 | ## Links 22 | 23 | * [Issue/5 - Boot not working after install](https://github.com/eoli3n/arch-config/issues/5) - 20220814 24 | 25 | -------------------------------------------------------------------------------- /ansible/roles/zfs/files/zrepl.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - name: system 3 | type: snap 4 | filesystems: { 5 | "zroot/ROOT<": true 6 | } 7 | snapshotting: 8 | type: periodic 9 | prefix: zrepl_system_ 10 | interval: 10m 11 | pruning: 12 | keep: 13 | - type: grid 14 | grid: 1x1h(keep=all) | 24x1h | 30x1d | 6x30d 15 | regex: "^zrepl_system_" 16 | 17 | - name: home 18 | type: snap 19 | filesystems: { 20 | "zroot/data/home/user<": true, 21 | "zroot/data/home/user/downloads": false 22 | } 23 | snapshotting: 24 | type: periodic 25 | prefix: zrepl_home_ 26 | interval: 10m 27 | pruning: 28 | keep: 29 | - type: grid 30 | grid: 1x1h(keep=all) | 24x1h | 7x1d 31 | regex: "^zrepl_home_" 32 | -------------------------------------------------------------------------------- /scripts/zfs/install/install.dist.conf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #### 3 | # Distributed (default) installation configuration file 4 | #### 5 | # @since 2022-08-20 6 | # @author stev leibelt <artodeto@bazzline.net 7 | #### 8 | 9 | #<string: 0 | 1> 10 | configure_dns="0" 11 | #<string: 0 | 1> 12 | configure_network="1" 13 | #<string: hostname | ... > 14 | hostname="globbervieh" 15 | #<string: 0 | 1> 16 | install_configuration_sourced="1" 17 | #<string: linux | linux-lts> 18 | kernel="linux" 19 | #<string: de-latin1 | fr | ... > 20 | keymap="de-latin1" 21 | #<string: de_DE | en_US | ... > 22 | locale="en_US" 23 | #<string: Europe/Berlin | ... > 24 | timezone="Europe/Berlin" 25 | #<string: artodeto | ... > 26 | user="user" 27 | #<string: zpool | rtank | ... > 28 | zpoolname="zpool" 29 | -------------------------------------------------------------------------------- /ansible/roles/recovery/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### 3 | # https://bugs.archlinux.org/task/66407 4 | ### 5 | 6 | - name: create efi netboot dir 7 | file: 8 | path: /efi/EFI/netboot 9 | state: directory 10 | 11 | - name: install ipxe-netboot 12 | block: 13 | - aur: 14 | name: ipxe-netboot 15 | skip_installed: true 16 | become: no 17 | - copy: 18 | src: /usr/share/ipxe-netboot/ipxe.efi 19 | dest: /efi/EFI/netboot/ 20 | rescue: 21 | - get_url: 22 | url: https://www.archlinux.org/static/netboot/ipxe.176077d7fccb.efi 23 | dest: /efi/EFI/netboot/ipxe.efi 24 | 25 | - name: install netboot.xyz 26 | get_url: 27 | url: https://boot.netboot.xyz/ipxe/netboot.xyz.efi 28 | dest: /efi/EFI/netboot/netboot.xyz.efi 29 | -------------------------------------------------------------------------------- /scripts/zfs/recover/README.md: -------------------------------------------------------------------------------- 1 | # ArchIso 2 | 3 | ## Connect to wifi 4 | 5 | ```bash 6 | #start programm 7 | iwctl 8 | 9 | #list available devices 10 | device list 11 | 12 | #fetch available networks 13 | station <string: device> scan 14 | 15 | #display found networks 16 | station <string: device> get-networks 17 | 18 | #connect 19 | station <string: device> connect <string: ssid> 20 | ``` 21 | 22 | ## Fix broken installation 23 | 24 | This can fix if zfs module can't be loaded during boot. 25 | 26 | Best of luck! 27 | 28 | * Boot [archiso with zfs](https://archzfs.leibelt.de/) 29 | * `git clone https://github.com/stevleibelt/arch-linux-configuration` 30 | * `bash arch-linux-configuration/scripts/zfs/recover/01-mount.sh` 31 | * `arch-chroot /mnt` 32 | * `yay -S zfs-dkms` 33 | * `mkinitcpio -P` 34 | 35 | -------------------------------------------------------------------------------- /ansible/roles/ansible/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: create pipx install dir 3 | file: 4 | path: /opt/pipx 5 | state: directory 6 | 7 | - name: configure pipx bin dir 8 | lineinfile: 9 | path: /etc/environment 10 | create: yes 11 | regexp: '{{ item.regexp }}' 12 | line: '{{ item.line }}' 13 | loop: 14 | - regexp: '^PIPX_BIN_DIR=' 15 | line: 'PIPX_BIN_DIR=/usr/local/bin' 16 | - regexp: '^PIPX_HOME=' 17 | line: 'PIPX_HOME=/opt/pipx' 18 | 19 | - name: install ansible 20 | community.general.pipx: 21 | name: ansible 22 | install_deps: yes 23 | state: install 24 | system_site_packages: yes 25 | 26 | - name: install ansible 27 | community.general.pipx: 28 | name: ansible 29 | state: inject 30 | inject_packages: 31 | - pywinrm 32 | - requests-credssp 33 | - dnspython 34 | - pyvmomi 35 | -------------------------------------------------------------------------------- /scripts/zfs/recover/01-mount.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | print () { 6 | echo -e "\n\033[1m> $1\033[0m\n" 7 | } 8 | 9 | # Set DISK 10 | select ENTRY in $(ls /dev/disk/by-id/); 11 | do 12 | DISK="/dev/disk/by-id/$ENTRY" 13 | echo "Mounting $ENTRY." 14 | break 15 | done 16 | 17 | print "Load ZFS module" 18 | modprobe zfs 19 | 20 | print "Reimport zpool" 21 | if zpool status zroot &>/dev/null 22 | then 23 | zpool export zroot 24 | fi 25 | zpool import -d /dev/disk/by-id -R /mnt zroot -N -f 26 | 27 | print "Load ZFS keys" 28 | zfs load-key -L prompt zroot 29 | 30 | print "Mount ROOT dataset" 31 | select ENTRY in $(zfs list | awk '/ROOT\// {print $1}') 32 | do 33 | echo "Mount $ENTRY as slash dataset." 34 | zfs mount "$ENTRY" 35 | break 36 | done 37 | 38 | print "Mount other datasets" 39 | zfs mount -a 40 | 41 | print "Mount EFI part" 42 | EFI="$DISK-part1" 43 | mount "$EFI" /mnt/efi 44 | 45 | # Finish 46 | echo -e "\e[32mAll OK" 47 | -------------------------------------------------------------------------------- /ansible/install-btrfs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | 5 | vars: 6 | user: user 7 | shell: /usr/bin/fish 8 | cmdline: "" 9 | 10 | pre_tasks: 11 | 12 | # Fix full /tmp when installing lots of AUR 13 | - name: temp increase /tmp size 14 | tags: always 15 | shell: mount -o remount,size=5G,noatime /tmp 16 | 17 | - name: include guest role 18 | tags: guest 19 | include_role: 20 | name: guest 21 | when: ansible_virtualization_role == "guest" 22 | 23 | roles: 24 | - { role: pacman, tags: pacman } 25 | - { role: aur, tags: aur } 26 | - { role: btrfs/packages, tags: btrfs } 27 | - { role: btrfs/snapper, tags: snapper } 28 | - { role: base, tags: base } 29 | - { role: desktop, tags: desktop } 30 | - { role: virtualization, tags: virtualization } 31 | - { role: containers, tags: containers } 32 | - { role: recovery, tags: recovery } 33 | - { role: btrfs/grub, tags: boot } 34 | - { role: btrfs/initramfs, tags: boot } 35 | -------------------------------------------------------------------------------- /ansible/roles/containers/files/registries.conf: -------------------------------------------------------------------------------- 1 | # This is a system-wide configuration file used to 2 | # keep track of registries for various container backends. 3 | # It adheres to TOML format and does not support recursive 4 | # lists of registries. 5 | 6 | # The default location for this configuration file is /etc/containers/registries.conf. 7 | 8 | # The only valid categories are: 'registries.search', 'registries.insecure', 9 | # and 'registries.block'. 10 | 11 | [registries.search] 12 | registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org'] 13 | 14 | # If you need to access insecure registries, add the registry's fully-qualified name. 15 | # An insecure registry is one that does not have a valid SSL certificate or only does HTTP. 16 | [registries.insecure] 17 | registries = [] 18 | 19 | 20 | # If you need to block pull access from a registry, uncomment the section below 21 | # and add the registries fully-qualified name. 22 | # 23 | # Docker only 24 | [registries.block] 25 | registries = [] 26 | -------------------------------------------------------------------------------- /ansible/install-zfs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | 5 | vars: 6 | user: user 7 | shell: /usr/bin/fish 8 | cmdline: "" 9 | 10 | pre_tasks: 11 | 12 | # Fix full /tmp when installing lots of AUR 13 | - name: temp increase /tmp size 14 | tags: always 15 | shell: mount -o remount,size=5G,noatime /tmp 16 | 17 | - name: include guest role 18 | tags: guest 19 | include_role: 20 | name: guest 21 | when: ansible_virtualization_role == "guest" 22 | 23 | roles: 24 | - { role: pacman, tags: pacman } 25 | - { role: aur, tags: aur } 26 | - { role: base, tags: base } 27 | - { role: desktop, tags: desktop } 28 | - { role: flatpak, tags: flatpak } 29 | - { role: cronie, tags: cronie } 30 | - { role: virtualization, tags: virtualization } 31 | - { role: ansible, tags: ansible } 32 | - { role: containers, tags: containers } 33 | - { role: recovery, tags: recovery } 34 | - { role: zfs, tags: zfs } 35 | - { role: zram, tags: zram } 36 | - { role: printers, tags: printers } 37 | - { role: com, tags: com } 38 | -------------------------------------------------------------------------------- /ansible/roles/zfs/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: configure zfs auto snapshot 3 | shell: | 4 | zfs set com.sun:auto-snapshot=false zroot 5 | zfs set com.sun:auto-snapshot=false zroot/data 6 | zfs set com.sun:auto-snapshot=false zroot/ROOT 7 | zfs set com.sun:auto-snapshot=false zroot/data 8 | zfs set com.sun:auto-snapshot=true zroot/data/home 9 | zfs set com.sun:auto-snapshot=true zroot/ROOT/archlinux 10 | zfs set com.sun:auto-snapshot:frequent=false zroot/data/home 11 | zfs set com.sun:auto-snapshot:monthly=false zroot/data/home 12 | zfs set com.sun:auto-snapshot:hourly=false zroot/data/home 13 | zfs set com.sun:auto-snapshot:weekly=false zroot/data/home 14 | zfs set com.sun:auto-snapshot:daily=true zroot/data/home 15 | zfs set com.sun:auto-snapshot=true zroot/data/home 16 | zfs set com.sun:auto-snapshot:frequent=false zroot/ROOT/archlinux 17 | zfs set com.sun:auto-snapshot:monthly=false zroot/ROOT/archlinux 18 | zfs set com.sun:auto-snapshot:hourly=false zroot/ROOT/archlinux 19 | zfs set com.sun:auto-snapshot:weekly=false zroot/ROOT/archlinux 20 | zfs set com.sun:auto-snapshot:daily=true zroot/ROOT/archlinux 21 | zfs set com.sun:auto-snapshot=true zroot/ROOT/archlinux 22 | 23 | - name: setup daily zfs scrub 24 | copy: 25 | src: zscrub 26 | dest: /etc/cron.weekly/ 27 | mode: 0755 28 | -------------------------------------------------------------------------------- /ansible/roles/pacman/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: configure pacman 3 | block: 4 | - lineinfile: 5 | path: /etc/pacman.conf 6 | regexp: '#Color' 7 | line: 'Color' 8 | - lineinfile: 9 | path: /etc/pacman.conf 10 | regexp: '#UseSyslog' 11 | line: 'UseSyslog' 12 | - lineinfile: 13 | path: /etc/pacman.conf 14 | regexp: '#CheckSpace' 15 | line: 'CheckSpace' 16 | - lineinfile: 17 | path: /etc/pacman.conf 18 | regexp: '#VerbosePkgLists' 19 | line: 'VerbosePkgLists' 20 | - lineinfile: 21 | path: /etc/pacman.conf 22 | regexp: '#ILoveCandy' 23 | line: 'ILoveCandy' 24 | insertafter: '# Misc options' 25 | - blockinfile: 26 | path: /etc/pacman.conf 27 | block: | 28 | [multilib] 29 | Include = /etc/pacman.d/mirrorlist 30 | 31 | - name: Update lists and upgrade 32 | pacman: 33 | update_cache: yes 34 | upgrade: yes 35 | 36 | - name: Configure reflector 37 | copy: 38 | src: reflector.conf 39 | dest: /etc/xdg/reflector/ 40 | notify: enable reflector 41 | 42 | - name: Install pacman hooks 43 | pacman: 44 | name: 45 | - kernel-modules-hook # keep kernel modules dir after an upgrade 46 | 47 | - name: Enable kernel modules cleanup 48 | systemd: 49 | name: linux-modules-cleanup 50 | enabled: yes 51 | -------------------------------------------------------------------------------- /scripts/zfs/install/README.md: -------------------------------------------------------------------------------- 1 | ### How to Use 2 | 3 | Boot latest archiso 4 | 5 | ```bash 6 | $ loadkeys fr 7 | 8 | # Init ZFS module and install git 9 | $ curl -s https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init | bash 10 | 11 | # Get install scripts 12 | $ git clone https://github.com/eoli3n/arch-config 13 | $ cd arch-config/scripts/zfs/install 14 | $ ./01-configure.sh 15 | $ ./02-install.sh 16 | ``` 17 | 18 | ### DualBoot Support 19 | 20 | After installing Void Linux with [void-config](https://github.com/eoli3n/void-config/tree/master/scripts/install), run ``01-configure.sh`` and select ``dualboot`` in the menu. 21 | 22 | ### EFI install 23 | 24 | - sda1 25 | /efi 26 | FAT used as esp 27 | - sda2 28 | ZFS pool 29 | 30 | ``01-configure.sh`` will 31 | - Create partition scheme 32 | - Format everything 33 | - Mount partitions 34 | 35 | ``02-install.sh`` will 36 | - Configure mirrors 37 | - Install Arch Linux and kernel 38 | - Generate initramfs 39 | - Configure hostname, locales, keymap, network 40 | - Install and configure bootloader 41 | - Generate users and passwords 42 | 43 | ### Debug 44 | 45 | ```bash 46 | $ ./01-configure.sh debug 47 | $ ./02-install.sh debug 48 | $ pacman -S pastebinit 49 | $ pastebinit -b sprunge.us configure.log 50 | $ pastebinit -b sprunge.us install.log 51 | ``` 52 | 53 | ##### Check EFI content 54 | ```bash 55 | $ pacman -S dracut 56 | $ lsinitrd /efi/EFI/ZBM/* 57 | ``` 58 | -------------------------------------------------------------------------------- /ansible/roles/btrfs/snapper/files/root: -------------------------------------------------------------------------------- 1 | # subvolume to snapshot 2 | SUBVOLUME="/" 3 | 4 | # filesystem type 5 | FSTYPE="btrfs" 6 | 7 | 8 | # btrfs qgroup for space aware cleanup algorithms 9 | QGROUP="" 10 | 11 | 12 | # fraction of the filesystems space the snapshots may use 13 | SPACE_LIMIT="0.5" 14 | 15 | # fraction of the filesystems space that should be free 16 | FREE_LIMIT="0.2" 17 | 18 | 19 | # users and groups allowed to work with config 20 | ALLOW_USERS="" 21 | ALLOW_GROUPS="" 22 | 23 | # sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots 24 | # directory 25 | SYNC_ACL="no" 26 | 27 | 28 | # start comparing pre- and post-snapshot in background after creating 29 | # post-snapshot 30 | BACKGROUND_COMPARISON="yes" 31 | 32 | 33 | # run daily number cleanup 34 | NUMBER_CLEANUP="yes" 35 | 36 | # limit for number cleanup 37 | NUMBER_MIN_AGE="0" 38 | NUMBER_LIMIT="1" 39 | NUMBER_LIMIT_IMPORTANT="1" 40 | 41 | 42 | # create hourly snapshots 43 | TIMELINE_CREATE="yes" 44 | 45 | # cleanup hourly snapshots after some time 46 | TIMELINE_CLEANUP="yes" 47 | 48 | # limits for timeline cleanup 49 | TIMELINE_MIN_AGE="0" 50 | TIMELINE_LIMIT_HOURLY="0" 51 | TIMELINE_LIMIT_DAILY="7" 52 | TIMELINE_LIMIT_WEEKLY="0" 53 | TIMELINE_LIMIT_MONTHLY="0" 54 | TIMELINE_LIMIT_YEARLY="0" 55 | 56 | 57 | # cleanup empty pre-post-pairs 58 | EMPTY_PRE_POST_CLEANUP="yes" 59 | 60 | # limits for empty pre-post-pair cleanup 61 | EMPTY_PRE_POST_MIN_AGE="1800" 62 | -------------------------------------------------------------------------------- /ansible/roles/flatpak/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install flatpak 3 | pacman: 4 | name: flatpak 5 | 6 | - name: Add the flathub flatpak repo 7 | community.general.flatpak_remote: 8 | name: "{{ item.name }}" 9 | state: present 10 | flatpakrepo_url: "{{ item.repo }}" 11 | loop: 12 | - { name: 'flathub', repo: 'https://dl.flathub.org/repo/flathub.flatpakrepo' } 13 | - { name: 'flathub-beta', repo: 'https://flathub.org/beta-repo/flathub-beta.flatpakrepo' } 14 | 15 | - name: Install flatpak packages 16 | community.general.flatpak: 17 | name: '{{ item }}' 18 | state: present 19 | remote: flathub 20 | loop: 21 | - com.spotify.Client 22 | - com.vscodium.codium 23 | - com.mojang.Minecraft 24 | - com.github.Anuken.Mindustry 25 | - us.zoom.Zoom 26 | - fi.skyjake.Lagrange # gemini browser 27 | - net.xmind.XMind # mind mapping 28 | #- com.microsoft.Teams 29 | 30 | - name: Install flatpak beta packages 31 | community.general.flatpak: 32 | name: '{{ item }}' 33 | state: present 34 | remote: flathub-beta 35 | loop: 36 | - org.freecadweb.FreeCAD 37 | 38 | #- name: Override Teams perms 39 | # shell: | 40 | # flatpak override com.microsoft.Teams \ 41 | # --filesystem=~/desktop:ro \ 42 | # --filesystem=~/img:ro \ 43 | # --filesystem=~/downloads:ro \ 44 | # --filesystem=~/share:ro 45 | 46 | - name: zoom screen sharing 47 | shell : | 48 | flatpak override --env=XDG_CURRENT_DESKTOP=GNOME us.zoom.Zoom 49 | -------------------------------------------------------------------------------- /vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | 3 | config.trigger.before :up, :provision do |trigger| 4 | trigger.run = {inline: "./download_iso.sh start"} 5 | end 6 | 7 | config.trigger.after :destroy do |trigger| 8 | trigger.run = {inline: "./download_iso.sh stop"} 9 | end 10 | 11 | config.vm.define :archlinux do |archlinux| 12 | archlinux.vm.hostname = "archlinux" 13 | archlinux.vm.provider :libvirt do |libvirt| 14 | libvirt.cpu_mode = 'host-passthrough' 15 | libvirt.memory = '8192' 16 | libvirt.cpus = '4' 17 | libvirt.graphics_type = 'spice' 18 | # Create a disk 19 | libvirt.storage :file, 20 | size: '20G', 21 | bus: 'scsi' 22 | 23 | # Set fr keyboard for vnc connection 24 | libvirt.keymap = 'fr' 25 | libvirt.boot 'cdrom' 26 | libvirt.storage :file, :device => :cdrom, :path => '/tmp/archlinux.iso', :bus => 'sata' 27 | # Set UEFI boot, comment for legacy 28 | ### On Arch Linux with OVMF package, use 29 | libvirt.loader = '/usr/share/edk2-ovmf/x64/OVMF_CODE.fd' 30 | libvirt.nvram = '/usr/share/edk2-ovmf/x64/OVMF_VARS_archlinux.fd' 31 | ### On Void Linux, use qemu edk2 firmwares 32 | # For secure boot, use "secure" firmware and force Q35 chipset 33 | #libvirt.machine_type = 'q35' 34 | #libvirt.loader = '/usr/share/qemu/edk2-x86_64-secure-code.fd' 35 | #libvirt.loader = '/usr/share/qemu/edk2-x86_64-code.fd' 36 | #libvirt.nvram = '/var/lib/libvirt/qemu/nvram/archlinux-vagrant.fd' 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /ansible/roles/containers/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install containers packages 3 | pacman: 4 | name: 5 | - docker # high level container runtime 6 | - docker-compose # multi-container docker apps 7 | - podman # docker alternative without dockerd 8 | - kubectl # kubernetes api cli client 9 | - kubectx # switch clusters/namespaces 10 | - kustomize # yaml templator 11 | - minikube # virtualized local kubernetes cluster 12 | - k9s # UI to interact with Kubernetes clusters 13 | - helm # kubernetes package manager 14 | - packer # golden images creator 15 | - terraform # infrastructure as code 16 | - podman-compose # docker-compose for podman 17 | # https://github.com/kubernetes-sigs/krew 18 | 19 | - name: install containers aur packages 20 | become: no 21 | aur: 22 | skip_installed: true 23 | name: 24 | - kompose-bin # docker-compose to manifest convertor 25 | - k3s-bin # Lightweight Kubernetes in a signle binary 26 | - stern # tail multiple pods on Kubernetes 27 | - kubespy # observe Kubernetes resources in real time 28 | 29 | - name: copy subuid files for podman rootless 30 | template: 31 | src: subuid.j2 32 | dest: /etc/subuid 33 | 34 | - name: copy subgid files for podman rootless 35 | template: 36 | src: subgid.j2 37 | dest: /etc/subgid 38 | 39 | - name: configure podman registries 40 | copy: 41 | src: registries.conf 42 | dest: /etc/containers/ 43 | 44 | - name: configure podman storage 45 | copy: 46 | src: storage.conf 47 | dest: /etc/containers/ 48 | 49 | - name: Add user to docker group 50 | user: 51 | name: '{{ user }}' 52 | groups: docker 53 | append: yes 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arch linux configuration 2 | 3 | This repository contains, free as in freedom, scripts to configure your archiso environment. 4 | 5 | The current change log can be found [here](CHANGELOG.md). 6 | 7 | See my [archzfs](https://archzfs.leibelt.de) page if you want to know more. 8 | 9 | This is a hard fork from [eoli3n/archiso-zfs](https://github.com/eoli3n/arch-config). For the history, [eoli3n](https://github.com/eoli3n/arch-config/pull/4) asked me kindly to do a hard fork, so I did. 10 | 11 | ## How to use 12 | 13 | Boot your archiso, either an iso with [build in OpenZFS support](https://archzfs.leibelt.de/#archiso-with-openzfs-support) or by [adding OpenZFS support on runtime](https://archzfs.leibelt.de/#archiso-openzfs-setup). 14 | 15 | ``` 16 | git clone --recursive https://github.com/stevleibelt/arch-linux-configuration 17 | #if you want to setup upstream too 18 | #git remote add upstream https://github.com/eoli3n/arch-config 19 | #git fetch upstream 20 | 21 | #bo: zfs installer section 22 | cd scripts/zfs/install 23 | bash 01-configure.sh 24 | bash 02-configure.sh 25 | #eo: zfs installer section 26 | 27 | #bo: zfs recover section 28 | bash 01-mount.sh 29 | #do what you need to do 30 | bash 02-umount.sh 31 | #eo: zfs recover section 32 | ``` 33 | 34 | ## Features 35 | 36 | ### ZFS root features 37 | 38 | * Native encryption aes-256-gcm 39 | * Zstd compression on all datasets 40 | * Boot Environments managed with [zfsbootmenu](https://zfsbootmenu.org/) 41 | * /boot included in ZFS 42 | * No swap 43 | * [Netboot recovery](https://eoli3n.github.io/archlinux/2020/04/25/recovery.html) 44 | 45 | ### BTRFS root features 46 | 47 | * LUKS encryption aes-xts-plain64 48 | * Zstd compression on all subvolumes 49 | * Bootable BTRFS snapshot managed with [snapper](https://github.com/openSUSE/snapper) and [grub-btrfs](https://github.com/Antynea/grub-btrfs) 50 | * Encrypted swap 51 | * Separated VFAT /boot 52 | * [Netboot recovery](https://eoli3n.github.io/archlinux/2020/04/25/recovery.html) 53 | 54 | ## Links 55 | 56 | * [eoli3n/archiso-zfs](https://github.com/eoli3n/archiso-zfs) - 20220820 57 | 58 | -------------------------------------------------------------------------------- /scripts/btrfs/01-configure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | print () { 6 | echo -e "\n\033[1m> $1\033[0m\n" 7 | } 8 | 9 | # Tests 10 | ls /sys/firmware/efi/efivars > /dev/null && \ 11 | ping archlinux.org -c 1 > /dev/null && \ 12 | timedatectl set-ntp true > /dev/null && \ 13 | print "Tests ok" 14 | 15 | # Set DISK 16 | select ENTRY in $(ls /dev/disk/by-id/); 17 | do 18 | DISK="/dev/disk/by-id/$ENTRY" 19 | echo "Installing on $ENTRY." 20 | break 21 | done 22 | 23 | read -p "> Do you want to wipe all datas on $ENTRY ?" -n 1 -r 24 | echo # move to a new line 25 | if [[ $REPLY =~ ^[Yy]$ ]] 26 | then 27 | # Clear disk 28 | wipefs -af $DISK 29 | sgdisk -Zo $DISK 30 | fi 31 | 32 | # EFI part 33 | print "Creating EFI part" 34 | sgdisk -n1:1M:+512M -t1:EF00 $DISK 35 | EFI=$DISK-part1 36 | 37 | # SWAP part 38 | print "Creating encrypted SWAP part" 39 | sgdisk -n2:0:+8G -t2:8308 $DISK 40 | SWAP=$DISK-part2 41 | 42 | # LUKS part 43 | print "Creating LUKS part" 44 | sgdisk -n3:0:0 -t3:8309 $DISK 45 | LUKS=$DISK-part3 46 | 47 | # Inform kernel 48 | partprobe $DISK 49 | 50 | # Format boot part 51 | sleep 1 52 | print "Format EFI part" 53 | mkfs.vfat $EFI 54 | 55 | # Create plain encrypted SWAP 56 | print "Create encrypted SWAP" 57 | cryptsetup open --type plain $SWAP swap 58 | ESWAP=/dev/mapper/swap 59 | mkswap $ESWAP 60 | swapon $ESWAP 61 | 62 | # Create LUKS 63 | print "Create LUKS" 64 | # https://savannah.gnu.org/bugs/?55093 65 | cryptsetup -v --type luks1 --cipher aes-xts-plain64 --key-size 256 --hash sha256 --iter-time 2000 --use-urandom --verify-passphrase luksFormat $LUKS 66 | cryptsetup luksOpen $LUKS universe 67 | BTRFS=/dev/mapper/universe 68 | 69 | # Format BTRFS part 70 | print "Format BTRFS" 71 | mkfs.btrfs -L "Sun" $BTRFS 72 | 73 | # Create BTRFS subvolumes 74 | print "Create subvolumes" 75 | mount -t btrfs -o autodefrag,noatime $BTRFS /mnt 76 | btrfs subvolume create /mnt/@ 77 | btrfs subvolume create /mnt/@home 78 | btrfs subvolume create /mnt/@snapshots 79 | 80 | # Exclude some path from / subvolume 81 | # https://en.opensuse.org/SDB:BTRFS#Default_Subvolumes 82 | btrfs subvolume create /mnt/var 83 | btrfs subvolume create /mnt/tmp 84 | btrfs subvolume create /mnt/root 85 | btrfs subvolume create /mnt/opt 86 | btrfs subvolume create /mnt/srv 87 | 88 | # Mount filesystems 89 | # https://docs.google.com/spreadsheets/d/1x9-3OQF4ev1fOCrYuYWt1QmxYRmPilw_nLik5H_2_qA/edit#gid=0 90 | umount /mnt 91 | print "Mount parts" 92 | mount -o autodefrag,noatime,subvol=@,compress=zstd:1 $BTRFS /mnt 93 | mkdir /mnt/home 94 | mount -o autodefrag,noatime,subvol=@home,compress=zstd:1 $BTRFS /mnt/home 95 | mkdir /mnt/.snapshots 96 | mount -o autodefrag,noatime,subvol=@snapshots,compress=zstd:1 $BTRFS /mnt/.snapshots 97 | mkdir /mnt/boot 98 | mount $EFI /mnt/boot 99 | 100 | # Finish 101 | echo -e "\e[32mAll OK" 102 | -------------------------------------------------------------------------------- /ansible/roles/base/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install aur packages 3 | become: no 4 | aur: 5 | skip_installed: true 6 | name: 7 | - ttf-impallari-cabin-font # cv font 8 | - ttf-ms-fonts # microsoft fonts 9 | - glow # render markdown cli 10 | - zfs-auto-snapshot-git 11 | 12 | - name: install base packages 13 | pacman: 14 | name: 15 | # Main 16 | - ttf-jetbrains-mono # main font 17 | - noto-fonts # unicode font 18 | - noto-fonts-emoji # emojis 19 | # Shell 20 | - fish # powerful shell 21 | - starship # cross-shell prompt 22 | - git # 23 | - exa # powerful ls 24 | - bc # maths 25 | - jq # json processor 26 | - most # colorized pager 27 | - bat # colorized cat 28 | - neovim # futur of vim 29 | - tree # 30 | - vi # 31 | - man # 32 | - screen # terminal multiplexer 33 | - asciinema # term recorder 34 | - expect # automation tool 35 | - arch-audit # list vulnerabilities 36 | # System 37 | - htop # system monitor 38 | - net-tools # netstat 39 | - reflector # mirror sorter 40 | - fwupd # dell firmware updater 41 | - nmap # port scanner 42 | - tcpdump # packet analyzer 43 | - whois # query registry 44 | - stress # stress test tool 45 | # Disk 46 | - iotop # disk "top" 47 | - ncdu # disk usage analyzer 48 | # Network 49 | - nethogs # net "top" 50 | - openssh # 51 | - sshpass # allow ansible -k 52 | - keychain # ssh-agent wrapper 53 | - wget # downloader 54 | - bind-tools # dns tools 55 | - openbsd-netcat # network utility 56 | - speedtest-cli # 57 | # Utils 58 | - cronie # Scheduler 59 | - at # Scheduler 60 | - borgbackup # backup utility 61 | - borgmatic # backup utility automation 62 | - pwgen # random password generator 63 | - lsd # improved ls command 64 | - rsync # sync tool 65 | - rclone # sync tool 66 | - syncthing # sync tool 67 | - vdirsyncer # sync tool 68 | - khal # cli calendar manager 69 | - khard # cli contacts manager 70 | - words # dictionnaries 71 | - fzf # fuzzy finder 72 | - neofetch # 73 | - unzip # uncompress zip 74 | - cifs-utils # 75 | - shellcheck # sh linter 76 | - oath-toolkit # otp tool 77 | - python-pip # python3 package manager 78 | - dmidecode # dump dmi table content 79 | - python-pre-commit # pre-commit hook manager 80 | - zim # wiki app 81 | - mailutils # mail client 82 | - python-pipx # pip package manager 83 | state: present 84 | 85 | - name: Configure root 86 | user: 87 | name: root 88 | shell: '{{shell}}' 89 | 90 | - name: Configure user 91 | user: 92 | name: '{{user}}' 93 | shell: '{{shell}}' 94 | 95 | - name: set timezone 96 | shell: timedatectl set-timezone Europe/Paris 97 | 98 | - name: set ntp 99 | shell: timedatectl set-ntp true 100 | -------------------------------------------------------------------------------- /scripts/btrfs/02-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | print () { 6 | echo -e "\n\033[1m> $1\033[0m\n" 7 | } 8 | 9 | # Sort mirrors 10 | print "Sort mirrors" 11 | pacman -Sy reflector --noconfirm 12 | reflector --country France --country Germany --latest 6 --protocol https --sort rate --save /etc/pacman.d/mirrorlist 13 | 14 | # Install 15 | print "Install Arch Linux" 16 | pacstrap /mnt base base-devel linux linux-firmware intel-ucode btrfs-progs grub efibootmgr grub-btrfs vim git ansible snapper connman wpa_supplicant 17 | 18 | # Generate fstab 19 | print "Generate fstab" 20 | genfstab /mnt >> /mnt/etc/fstab 21 | 22 | # Generate crypttab 23 | print "Generate crypttab" 24 | cat > /mnt/etc/crypttab <<EOF 25 | # Mount swap re-encrypting it with a fresh key each reboot 26 | swap /dev/sda2 /dev/urandom swap,cipher=aes-xts-plain64,size=256 27 | EOF 28 | cat > /mnt/etc/crypttab.initramfs <<EOF 29 | universe /dev/sda3 none discard 30 | EOF 31 | 32 | # Set hostname 33 | echo "Please enter hostname :" 34 | read hostname 35 | echo $hostname > /mnt/etc/hostname 36 | 37 | # Configure /etc/hosts 38 | print "Configure hosts file" 39 | cat > /mnt/etc/hosts <<EOF 40 | #<ip-address> <hostname.domain.org> <hostname> 41 | 127.0.0.1 localhost $hostname 42 | ::1 localhost $hostname 43 | EOF 44 | 45 | # Prepare locales and keymap 46 | print "Prepare locales and keymap" 47 | echo "KEYMAP=fr" > /mnt/etc/vconsole.conf 48 | sed -i 's/#\(fr_FR.UTF-8\)/\1/' /mnt/etc/locale.gen 49 | echo 'LANG="fr_FR.UTF-8"' > /mnt/etc/locale.conf 50 | 51 | # Prepare initramfs 52 | print "Prepare initramfs" 53 | cat > /mnt/etc/mkinitcpio.conf <<"EOF" 54 | MODULES=(i915 intel_agp) 55 | BINARIES=(/usr/bin/btrfs) 56 | FILES=() 57 | HOOKS=(base systemd autodetect modconf block keyboard sd-vconsole sd-encrypt fsck filesystems) 58 | COMPRESSION="lz4" 59 | EOF 60 | 61 | # Chroot and configure 62 | print "Chroot and configure system" 63 | 64 | arch-chroot /mnt /bin/bash -xe <<"EOF" 65 | 66 | # Sync clock 67 | hwclock --systohc 68 | 69 | # Set date 70 | timedatectl set-ntp true 71 | timedatectl set-timezone Europe/Paris 72 | 73 | # Generate locale 74 | locale-gen 75 | source /etc/locale.conf 76 | 77 | # Generate Initramfs 78 | mkinitcpio -p linux 79 | 80 | # Prepare grub2 81 | #sed -i 's/#\(GRUB_ENABLE_CRYPTODISK=y\)/\1/' /etc/default/grub 82 | 83 | # Install grub2 84 | grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB 85 | 86 | # Configure EFI and grub2 87 | mkdir -p /boot/EFI/boot 88 | cp /boot/EFI/GRUB/grubx64.efi /boot/EFI/boot/bootx64.efi 89 | grub-mkconfig -o /boot/grub/grub.cfg 90 | 91 | # Create user 92 | useradd -m user 93 | 94 | EOF 95 | 96 | # Set root passwd 97 | print "Set root password" 98 | arch-chroot /mnt /bin/passwd 99 | 100 | # Set user passwd 101 | print "Set user password" 102 | arch-chroot /mnt /bin/passwd user 103 | 104 | # Configure sudo 105 | cat > /mnt/etc/sudoers <<"EOF" 106 | root ALL=(ALL) ALL 107 | user ALL=(ALL) ALL 108 | Defaults rootpw 109 | EOF 110 | 111 | # Configure network 112 | print "Configure network" 113 | cat > /mnt/etc/systemd/network/enoX.network <<"EOF" 114 | [Match] 115 | Name=en* 116 | 117 | [Network] 118 | DHCP=ipv4 119 | IPForward=yes 120 | 121 | [DHCP] 122 | UseDNS=no 123 | RouteMetric=10 124 | EOF 125 | cat > /mnt/etc/systemd/network/wlX.network <<"EOF" 126 | [Match] 127 | Name=wl* 128 | 129 | [Network] 130 | DHCP=ipv4 131 | IPForward=yes 132 | 133 | [DHCP] 134 | UseDNS=no 135 | RouteMetric=20 136 | EOF 137 | systemctl enable systemd-networkd --root=/mnt 138 | systemctl disable systemd-networkd-wait-online --root=/mnt 139 | 140 | cat > /mnt/etc/connman/main.conf <<"EOF" 141 | [General] 142 | PreferredTechnologies=ethernet,wifi 143 | NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-,docker,veth,eth,wlan,vnet 144 | AllowHostnameUpdates = false 145 | AllowDomainnameUpdates = false 146 | SingleConnectedTechnology = true 147 | EOF 148 | systemctl enable connman --root=/mnt 149 | 150 | # Configure DNS 151 | rm /mnt/etc/resolv.conf 152 | arch-chroot /mnt ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf 153 | systemctl enable systemd-resolved --root=/mnt 154 | 155 | # Configure TRIM 156 | systemctl enable fstrim.timer --root=/mnt 157 | 158 | # Umount all parts 159 | umount -R /mnt 160 | 161 | # Finish 162 | echo -e "\e[32mAll OK" 163 | -------------------------------------------------------------------------------- /ansible/roles/desktop/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install desktop packages 3 | pacman: 4 | name: 5 | - sway 6 | - swaybg 7 | - xorg-server-xwayland 8 | - waybar 9 | - mako # notification daemon 10 | - kanshi # autorandr for wayland 11 | - grim # screenshots 12 | - slurp # region selector 13 | - wl-clipboard # clipboard manager 14 | - brightnessctl # brightness manager 15 | - wofi # rofi for wayland 16 | - swayidle 17 | - swaylock # lock screen for sway 18 | - xdg-user-dirs 19 | - xdg-desktop-portal-wlr 20 | - xdg-desktop-portal-gtk 21 | state: present 22 | 23 | - name: install video packages 24 | pacman: 25 | name: 26 | - mesa 27 | - mesa-demos 28 | - lib32-virtualgl 29 | - vulkan-intel 30 | - lib32-vulkan-intel 31 | - intel-media-driver 32 | - libva-utils 33 | state: present 34 | 35 | - name: install audio packages 36 | pacman: 37 | name: 38 | - pipewire 39 | - pipewire-pulse 40 | - pipewire-alsa 41 | - wireplumber 42 | - pavucontrol 43 | - pamixer 44 | - alsa-utils 45 | state: present 46 | 47 | - name: install applications packages 48 | pacman: 49 | name: 50 | - imv # img visualizer 51 | - wezterm # terminal emulator 52 | - evince # pdf viewer 53 | - evolution # mail client 54 | - gnome-keyring # evolution gnome keyring 55 | - seahorse # keyring manager 56 | - firefox 57 | - firefox-i18n-fr 58 | - flatpak # package manager 59 | - gimp # img editor 60 | - kolourpaint # img editor 61 | - shotwell # photo manager 62 | - libreoffice-still-fr # libreoffice suite fr 63 | - lollypop # music player 64 | - lxappearance # theme manager 65 | - mpv # video player 66 | - nemo # file manager 67 | - tumbler # thumbnailer 68 | - openvpn # vpn client 69 | - openconnect # globalprotect vpn client 70 | - playerctl # music player cli controller 71 | - rdesktop # remote desktop client 72 | - remmina # remote desktop client 73 | - freerdp # remmina dep for rdp 74 | - steam # games manager 75 | - senpai # irc client for soju 76 | - transmission-gtk # torrent downloader 77 | - texlive-bin # latex 78 | - texlive-core # latex 79 | - texlive-latexextra # latex 80 | - texlive-fontsextra # latex 81 | - variety # random backgrounds 82 | - papirus-icon-theme # icon theme 83 | - gnome-themes-extra # gtk themes 84 | #- x2goclient 85 | - gopass # password manager 86 | - okular # pdf editor, no image overlay 87 | - xournalpp # pdf editor, no form 88 | state: present 89 | 90 | - name: add missing gpg keys for aur 91 | become: no 92 | shell: gpg --recv '{{item}}' 93 | loop: 94 | - F4B432D5D67990E3 # wob 95 | 96 | changed_when: false 97 | 98 | - name: install aur packages 99 | become: no 100 | aur: 101 | skip_installed: true 102 | name: 103 | - adapta-gtk-theme #https://github.com/Alexays/Waybar/issues/515 104 | - equilux-theme 105 | - wdisplays-git # arandr for wayland 106 | - wf-recorder-git # screen recorder for wayland 107 | - grimshot # grim+slurp wrapper 108 | - waypipe # wayland ssh -X 109 | - wob # bars for wayland 110 | - connman-gtk # connman gtk gui 111 | #- gnome-ssh-askpass2 # ssh askpass gui 112 | - google-chrome 113 | - adb-sync-git # android dir sync 114 | - downgrade # package downgrader 115 | - lf # cli file manager 116 | - molotov # french tv wrapper 117 | - otf-font-awesome 118 | #- ttf-impallari-cabin-font # xelatex cv 119 | - pastel # color viewer 120 | - swappy # screenshot editor 121 | - rbenv-latest # ruby env manager 122 | - iwgtk # gui for iwd 123 | #- phockup # picture sorting tool 124 | 125 | - name: test swaylock-fancy 126 | stat: 127 | path: /bin/swaylock-fancy 128 | register: swaylock 129 | 130 | - name: clone swaylock-fancy 131 | git: 132 | repo: https://github.com/eoli3n/swaylock-fancy 133 | dest: /tmp/swaylock-fancy 134 | when: not swaylock.stat.exists 135 | 136 | - name: install swaylock-fancy 137 | shell: make install 138 | args: 139 | chdir: /tmp/swaylock-fancy 140 | when: not swaylock.stat.exists 141 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/). 7 | 8 | ## [Open] 9 | 10 | ### To Add 11 | 12 | * Add parts missed here but used [here](https://gist.github.com/Soulsuke/6a7d1f09f7fef968a2f32e0ff32a5c4c) 13 | * Add [encrypted swap partition](https://github.com/stevleibelt/arch-linux-configuration/issues) to support suspend-to-disk 14 | * Add automatic installation of fitting [xorg drivers](https://wiki.archlinux.org/title/Xorg#Installation) 15 | * Add [pacman hook](https://wiki.archlinux.org/title/Dynamic_Kernel_Module_Support#Initial_ramdisk) when zfs-dkms is installed 16 | * Add usage of `localectl set-{keymap|locale|x11-keymap}` as figured out [here](https://github.com/sddm/sddm/issues/202) 17 | 18 | ### zfsbootmenu 19 | 20 | * Dynamic disk in 01-mount.sh recover script 21 | * Periodic trim with timer when host is down ? https://unix.stackexchange.com/a/352596 22 | * Reflector systemd timer 23 | * ZFS 24 | * Zfs hibernate without swap ? 25 | * Smart test timer ? 26 | * Periodic zfs-scrub 27 | * Pacman hook to "generate-zbm" at each zfs-dkms upgrade 28 | * DNS 29 | * Fix DNS per interface ? as https://github.com/jonathanio/update-systemd-resolved#preventing-leakage-to-corporate-networks 30 | * SERVICES 31 | * Hardware acceleration packages 32 | * Disable ipv6 33 | * IMPROVMENTS 34 | * Move max aur package to community equivalents 35 | * TESTS 36 | * Zfs trim + zfs autoscrub systemd timer 37 | * Reflector at startup 38 | * Test resume in GRUB_CMDLINE_LINUX 39 | 40 | ### To Change 41 | 42 | * Move `install.conf` creation out of 02-installation.sh and put it in 01-configuration.sh 43 | * Create a `install.dist.conf` that is used in 02-installation.sh if `install.conf` is not available 44 | * Solve locale grub : https://forums.archlinux.fr/viewtopic.php?t=13830 45 | 46 | ## [Unreleased] 47 | 48 | ### Added 49 | 50 | ### Changed 51 | 52 | ## [2.0.1](https://github.com/stevleibelt/arch-linux-configuration/tree/2.0.1) - released at 20230608 53 | 54 | ### Changed 55 | 56 | * Fixed [issue/3](https://github.com/stevleibelt/arch-linux-configuration/issues/3) 57 | 58 | ## [2.0.0](https://github.com/stevleibelt/arch-linux-configuration/tree/2.0.0) - released at 20230608 59 | 60 | ### Added 61 | 62 | * Added option to create an unencrypted `zroot` 63 | * [ZFS Install](scripts/zfs/install) 64 | * Added support for `install.dist.conf` 65 | * Started [help](doc/help) section 66 | * Added selection of `archzfs-dkms` or `archzfs-linux[-lts]` should be installed 67 | 68 | ### Changed 69 | 70 | * Fixed [issue/2](https://github.com/stevleibelt/arch-linux-configuration/issues/2) 71 | * Fixed issue with $zpoolname in the `mkinitcpio.conf` generation 72 | * Fixed issue when configuring dns 73 | * Fixed issue when configuring network by using NetworkManager 74 | * Fixed issue when removing existing user 75 | * Changed where the configuration is done 76 | * Configuration is now done in `01-configure.sh` 77 | * You can execute `02-install.sh` without any previously done configuration, `install.dist.conf` is then used 78 | 79 | ## [1.1.0](https://github.com/stevleibelt/arch-linux-configuration/tree/1.1.0) - released at 20230101 80 | 81 | ### Changed 82 | 83 | * Merged with [latest](https://github.com/eoli3n/arch-config/commit/fe88200e17a26a6734eb954e96f2a9b6cf4efe71) code from [upstream](https://github.com/eoli3n/arch-config) 84 | 85 | ## [1.0.0](https://github.com/stevleibelt/arch-linux-configuration/tree/1.0.0) - released at 20220820 86 | 87 | ### Added 88 | 89 | * Added [LICENCE](LICENCE) 90 | * [ZFS Install](scripts/zfs/install) 91 | * Added asking for zpool name 92 | * Added asking for keymap 93 | * Added asking for locale 94 | * Added asking for timezone 95 | * Added asking to configure networking 96 | * Added asking to configure dns 97 | * Added asking for kernel (`linux` or `linux-lts`) 98 | * Added usage of install.conf file to ease up multiple runs of the script (yep, perfect if you have to develop this script) 99 | * Added support for networkmanager configuration 100 | * Added prefix of >>:: << on each `print`-output 101 | * Added automatic detection of ucode package file (currently only amd and intel are supported) 102 | * This [CHANGELOG](CHANGELOG.md) 103 | 104 | ### Changed 105 | 106 | * Updated [README.md](README.nd) 107 | * [ZFS Install](scripts/zfs/install) 108 | * Added switch to either install amd or intel ucode 109 | * Added check to only configure intel gpu modules when intel gpu is on the system 110 | * Moved installation of `iwd` and `wpa_supplicant` into section "configure networking" 111 | 112 | -------------------------------------------------------------------------------- /ansible/roles/containers/files/storage.conf: -------------------------------------------------------------------------------- 1 | # This file is is the configuration file for all tools 2 | # that use the containers/storage library. 3 | # See man 5 containers-storage.conf for more information 4 | # The "container storage" table contains all of the server options. 5 | [storage] 6 | 7 | # Default Storage Driver 8 | driver = "zfs" 9 | 10 | # Temporary storage location 11 | runroot = "/var/run/containers/storage" 12 | 13 | # Primary Read/Write location of container storage 14 | graphroot = "/var/lib/containers/storage" 15 | 16 | [storage.options] 17 | # Storage options to be passed to underlying storage drivers 18 | 19 | # AdditionalImageStores is used to pass paths to additional Read/Only image stores 20 | # Must be comma separated list. 21 | additionalimagestores = [ 22 | ] 23 | 24 | # Size is used to set a maximum size of the container image. Only supported by 25 | # certain container storage drivers. 26 | size = "" 27 | 28 | # Path to an helper program to use for mounting the file system instead of mounting it 29 | # directly. 30 | mount_program = "/usr/bin/fuse-overlayfs" 31 | 32 | # OverrideKernelCheck tells the driver to ignore kernel checks based on kernel version 33 | override_kernel_check = "true" 34 | 35 | # mountopt specifies comma separated list of extra mount options 36 | mountopt = "nodev" 37 | 38 | # Remap-UIDs/GIDs is the mapping from UIDs/GIDs as they should appear inside of 39 | # a container, to UIDs/GIDs as they should appear outside of the container, and 40 | # the length of the range of UIDs/GIDs. Additional mapped sets can be listed 41 | # and will be heeded by libraries, but there are limits to the number of 42 | # mappings which the kernel will allow when you later attempt to run a 43 | # container. 44 | # 45 | # remap-uids = 0:1668442479:65536 46 | # remap-gids = 0:1668442479:65536 47 | 48 | # Remap-User/Group is a name which can be used to look up one or more UID/GID 49 | # ranges in the /etc/subuid or /etc/subgid file. Mappings are set up starting 50 | # with an in-container ID of 0 and the a host-level ID taken from the lowest 51 | # range that matches the specified name, and using the length of that range. 52 | # Additional ranges are then assigned, using the ranges which specify the 53 | # lowest host-level IDs first, to the lowest not-yet-mapped container-level ID, 54 | # until all of the entries have been used for maps. 55 | # 56 | # remap-user = "storage" 57 | # remap-group = "storage" 58 | 59 | [storage.options.thinpool] 60 | # Storage Options for thinpool 61 | 62 | # autoextend_percent determines the amount by which pool needs to be 63 | # grown. This is specified in terms of % of pool size. So a value of 20 means 64 | # that when threshold is hit, pool will be grown by 20% of existing 65 | # pool size. 66 | # autoextend_percent = "20" 67 | 68 | # autoextend_threshold determines the pool extension threshold in terms 69 | # of percentage of pool size. For example, if threshold is 60, that means when 70 | # pool is 60% full, threshold has been hit. 71 | # autoextend_threshold = "80" 72 | 73 | # basesize specifies the size to use when creating the base device, which 74 | # limits the size of images and containers. 75 | # basesize = "10G" 76 | 77 | # blocksize specifies a custom blocksize to use for the thin pool. 78 | # blocksize="64k" 79 | 80 | # directlvm_device specifies a custom block storage device to use for the 81 | # thin pool. Required if you setup devicemapper. 82 | # directlvm_device = "" 83 | 84 | # directlvm_device_force wipes device even if device already has a filesystem. 85 | # directlvm_device_force = "True" 86 | 87 | # fs specifies the filesystem type to use for the base device. 88 | # fs="xfs" 89 | 90 | # log_level sets the log level of devicemapper. 91 | # 0: LogLevelSuppress 0 (Default) 92 | # 2: LogLevelFatal 93 | # 3: LogLevelErr 94 | # 4: LogLevelWarn 95 | # 5: LogLevelNotice 96 | # 6: LogLevelInfo 97 | # 7: LogLevelDebug 98 | # log_level = "7" 99 | 100 | # min_free_space specifies the min free space percent in a thin pool require for 101 | # new device creation to succeed. Valid values are from 0% - 99%. 102 | # Value 0% disables 103 | # min_free_space = "10%" 104 | 105 | # mkfsarg specifies extra mkfs arguments to be used when creating the base. 106 | # device. 107 | # mkfsarg = "" 108 | 109 | # use_deferred_removal marks devicemapper block device for deferred removal. 110 | # If the thinpool is in use when the driver attempts to remove it, the driver 111 | # tells the kernel to remove it as soon as possible. Note this does not free 112 | # up the disk space, use deferred deletion to fully remove the thinpool. 113 | # use_deferred_removal = "True" 114 | 115 | # use_deferred_deletion marks thinpool device for deferred deletion. 116 | # If the device is busy when the driver attempts to delete it, the driver 117 | # will attempt to delete device every 30 seconds until successful. 118 | # If the program using the driver exits, the driver will continue attempting 119 | # to cleanup the next time the driver is used. Deferred deletion permanently 120 | # deletes the device and all data stored in device will be lost. 121 | # use_deferred_deletion = "True" 122 | 123 | # xfs_nospace_max_retries specifies the maximum number of retries XFS should 124 | # attempt to complete IO when ENOSPC (no space) error is returned by 125 | # underlying storage device. 126 | # xfs_nospace_max_retries = "0" 127 | 128 | # If specified, use OSTree to deduplicate files with the overlay backend 129 | ostree_repo = "" 130 | 131 | # Set to skip a PRIVATE bind mount on the storage home directory. Only supported by 132 | # certain container storage drivers 133 | skip_mount_home = "false" 134 | -------------------------------------------------------------------------------- /scripts/zfs/install/01-configure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #### 3 | # Simple script prepare system for zfs installation 4 | #### 5 | # @since 2022-08-22 6 | # @author: 7 | # eoli3n <https://eoli3n.eu.org/about/> 8 | # stev leibelt <artodeto@bazzline.net> 9 | #### 10 | 11 | set -e 12 | 13 | exec &> >(tee "configure.log") 14 | 15 | function print () 16 | { 17 | echo -e "\n\033[1m> ${1}\033[0m\n" 18 | } 19 | 20 | function ask () 21 | { 22 | read -p "> ${1} " -r 23 | echo 24 | } 25 | 26 | function menu () 27 | { 28 | PS3="> Choose a number: " 29 | select i in "${@}" 30 | do 31 | echo "${i}" 32 | break 33 | done 34 | } 35 | 36 | function tests () 37 | { 38 | print ":: Testing environment" 39 | ls /sys/firmware/efi/efivars > /dev/null && \ 40 | ping archlinux.org -c 1 > /dev/null && \ 41 | timedatectl set-ntp true > /dev/null && \ 42 | modprobe zfs && \ 43 | print " Tests ok" 44 | } 45 | 46 | function select_disk () 47 | { 48 | # Set DISK 49 | select ENTRY in $(ls /dev/disk/by-id/); 50 | do 51 | DISK="/dev/disk/by-id/${ENTRY}" 52 | echo "${DISK}" > /tmp/disk 53 | echo ":: Installing on ${ENTRY}." 54 | break 55 | done 56 | } 57 | 58 | function wipe () 59 | { 60 | ask ":: Do you want to wipe all datas on >>${ENTRY}<<? (Y|n)" 61 | if [[ ${REPLY} =~ ^[Nn]$ ]] 62 | then 63 | echo " No wipe" 64 | else 65 | echo " Start wiping" 66 | dd if=/dev/zero of="${DISK}" bs=512 count=1 67 | wipefs -af "${DISK}" 68 | sgdisk -Zo "${DISK}" 69 | fi 70 | } 71 | 72 | function partition () 73 | { 74 | print ":: Partition" 75 | # EFI part 76 | print " Creating EFI part" 77 | sgdisk -n1:1M:+512M -t1:EF00 "${DISK}" 78 | EFI="${DISK}-part1" 79 | 80 | # ZFS part 81 | print " Creating ZFS part" 82 | sgdisk -n3:0:0 -t3:bf01 "${DISK}" 83 | 84 | # Inform kernel 85 | partprobe "${DISK}" 86 | 87 | # Format efi part 88 | sleep 1 89 | print " Format EFI part" 90 | mkfs.vfat "${EFI}" 91 | } 92 | 93 | function zfs_passphrase () 94 | { 95 | ask ":: Do you want to encrypt >>${DISK}<<? (Y|n)" 96 | if [[ ${REPLY} =~ ^[Nn]$ ]]; 97 | then 98 | if [[ -f /etc/zfs/zroot.key ]]; 99 | then 100 | rm /etc/zfs/zroot.key 101 | fi 102 | else 103 | # Generate key 104 | print ":: Set ZFS passphrase" 105 | read -r -p "> ZFS passphrase: " -s pass 106 | echo "" 107 | print " Please confirm your passphrase" 108 | read -r -p "> ZFS passphrase: " -s pass2 109 | echo "" 110 | 111 | if [[ "${pass}" == "${pass2}" ]]; 112 | then 113 | echo "${pass}" > /etc/zfs/zroot.key 114 | chmod 000 /etc/zfs/zroot.key 115 | else 116 | echo " Passwords differ." 117 | 118 | zfs_passphrase 119 | fi 120 | fi 121 | } 122 | 123 | function create_pool () 124 | { 125 | # ZFS part 126 | ZFS="${DISK}-part3" 127 | 128 | # Create ZFS pool 129 | if [[ -f /etc/zfs/zroot.key ]]; 130 | then 131 | print "Create encrypted ZFS pool" 132 | zpool create -f -o ashift=12 \ 133 | -o autotrim=on \ 134 | -O acltype=posixacl \ 135 | -O compression=zstd \ 136 | -O relatime=on \ 137 | -O xattr=sa \ 138 | -O dnodesize=legacy \ 139 | -O encryption=aes-256-gcm \ 140 | -O keyformat=passphrase \ 141 | -O keylocation=file:///etc/zfs/zroot.key \ 142 | -O normalization=formD \ 143 | -O mountpoint=none \ 144 | -O canmount=off \ 145 | -O devices=off \ 146 | -R /mnt \ 147 | zroot "${ZFS}" 148 | else 149 | print "Create ZFS pool" 150 | zpool create -f -o ashift=12 \ 151 | -o autotrim=on \ 152 | -O acltype=posixacl \ 153 | -O compression=zstd \ 154 | -O relatime=on \ 155 | -O xattr=sa \ 156 | -O dnodesize=legacy \ 157 | -O normalization=formD \ 158 | -O mountpoint=none \ 159 | -O canmount=off \ 160 | -O devices=off \ 161 | -R /mnt \ 162 | zroot "${ZFS}" 163 | fi 164 | } 165 | 166 | function create_root_dataset () 167 | { 168 | # Slash dataset 169 | print ":: Create root dataset" 170 | zfs create -o mountpoint=none zroot/ROOT 171 | 172 | # Set cmdline 173 | zfs set org.zfsbootmenu:commandline="ro quiet" zroot/ROOT 174 | } 175 | 176 | function create_system_dataset () 177 | { 178 | local DATASET="${1:-archzfs}" 179 | 180 | print "Create slash dataset (data)" 181 | zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/"${DATASET}" 182 | 183 | # Generate zfs hostid 184 | print "Generate hostid" 185 | zgenhostid 186 | 187 | # Set bootfs 188 | print "Set ZFS bootfs" 189 | zpool set bootfs="zroot/ROOT/${DATASET}" zroot 190 | 191 | # Manually mount slash dataset 192 | zfs mount zroot/ROOT/"${DATASET}" 193 | } 194 | 195 | function create_home_dataset () 196 | { 197 | print ":: Create home dataset" 198 | zfs create -o mountpoint=/ -o canmount=off zroot/data 199 | zfs create zroot/data/home 200 | } 201 | 202 | function export_pool () 203 | { 204 | print ":: Export zpool" 205 | zpool export zroot 206 | } 207 | 208 | function import_pool () 209 | { 210 | print ":: Import zpool" 211 | zpool import -d /dev/disk/by-id -R /mnt zroot -N -f 212 | zfs load-key zroot 213 | } 214 | 215 | function mount_system () 216 | { 217 | local DATASET="${1:-archzfs}" 218 | 219 | print ":: Mount slash dataset" 220 | zfs mount zroot/ROOT/"${DATASET}" 221 | zfs mount -a 222 | 223 | # Mount EFI part 224 | print ":: Mount EFI part" 225 | EFI="${DISK}-part1" 226 | mkdir -p /mnt/efi 227 | mount "${EFI}" /mnt/efi 228 | } 229 | 230 | function copy_zpool_cache () 231 | { 232 | # Copy ZFS cache 233 | print ":: Generate and copy zfs cache" 234 | mkdir -p /mnt/etc/zfs 235 | zpool set cachefile=/etc/zfs/zpool.cache zroot 236 | } 237 | 238 | function _main () 239 | { 240 | local PATH_TO_THIS_SCRIPT=$(cd `dirname ${0}` && pwd) 241 | tests 242 | 243 | print ":: Is this the first install or a second install to dualboot?" 244 | install_reply=$(menu first dualboot) 245 | 246 | select_disk 247 | zfs_passphrase 248 | 249 | # If first install 250 | if [[ ${install_reply} == "first" ]] 251 | then 252 | # Wipe the disk 253 | wipe 254 | # Create partition table 255 | partition 256 | # Create ZFS pool 257 | create_pool 258 | # Create root dataset 259 | create_root_dataset 260 | fi 261 | 262 | ask ":: Name of the slash dataset? (default is >>archzfs<<)" 263 | name_reply="${REPLY:-archzfs}" 264 | echo "${name_reply}" > /tmp/root_dataset 265 | 266 | if [[ ${install_reply} == "dualboot" ]] 267 | then 268 | import_pool 269 | fi 270 | 271 | create_system_dataset "${name_reply}" 272 | 273 | if [[ ${install_reply} == "first" ]] 274 | then 275 | create_home_dataset 276 | fi 277 | 278 | export_pool 279 | import_pool 280 | mount_system "${name_reply}" 281 | copy_zpool_cache 282 | 283 | #bo: configuration section 284 | # By sourcing an existing file before asking the question, we can easily extend the questions/variables 285 | # or use pre configured install.conf files but configure all missing variables 286 | 287 | install_conf="${PATH_TO_THIS_SCRIPT}/install.conf" 288 | 289 | if [[ -f ${install_conf} ]]; 290 | then 291 | echo ":: Sourcing >>${install_conf}<<." 292 | echo " You where only asked questions for not existing configuration values." 293 | echo " If you want to configure things in total, please remove >>${install_conf}<<." 294 | 295 | . ${install_conf} 296 | fi 297 | 298 | ##c 299 | if [[ -z ${configure_dns+x} ]]; 300 | then 301 | ask "Configure DNS? (y|N)" 302 | 303 | if [[ ${REPLY} =~ ^[Yy]$ ]]; 304 | then 305 | echo "configure_dns=1" >> ${install_conf} 306 | fi 307 | fi 308 | 309 | if [[ -z ${configure_network+x} ]]; 310 | then 311 | ask "Configure networking? (y|N)" 312 | if [[ ${REPLY} =~ ^[Yy]$ ]]; 313 | then 314 | echo "Which network-provider?" 315 | ask "0) iwd + wpa_supplicant 1) networkmanager" 316 | 317 | echo "configure_network=\"${REPLY}\"" >> ${install_conf} 318 | fi 319 | fi 320 | 321 | ##h 322 | if [[ -z ${hostname+x} ]]; 323 | then 324 | read -r -p 'Please enter hostname : ' hostname 325 | echo "${hostname}" > /mnt/etc/hostname 326 | 327 | echo "hostname=\"${hostname}\"" >> ${install_conf} 328 | fi 329 | 330 | ##k 331 | if [[ -z ${kernel+x} ]]; 332 | then 333 | echo ":: Which kernel?" 334 | ask "0) linux-lts 1) linux (default)?" 335 | 336 | if [[ ${REPLY:-1} -eq 1 ]]; 337 | then 338 | kernel="linux" 339 | else 340 | kernel="linux-lts" 341 | fi 342 | 343 | echo "kernel=\"${kernel}\"" >> ${install_conf} 344 | fi 345 | 346 | if [[ -z ${keymap+x} ]]; 347 | then 348 | print ":: Prepare locales and keymap" 349 | echo "Which keymap do you want to use?" 350 | ask "0) fr 1) de-latin1 (default) 2) input your own" 351 | 352 | case ${REPLY:-1} in 353 | 0) 354 | keymap="fr" 355 | ;; 356 | 1) 357 | keymap="de-latin1" 358 | ;; 359 | 2) 360 | ask "Please insert your keymap" 361 | keymap="${REPLY}" 362 | ;; 363 | *) 364 | keymap="fr" 365 | ;; 366 | esac 367 | echo "keymap=\"${keymap}\"" >> ${install_conf} 368 | fi 369 | 370 | ##l 371 | if [[ -z ${locale+x} ]]; 372 | then 373 | echo "Which locales to use?" 374 | ask "0) fr_FR 1) de_DE (default) 2) input your own" 375 | 376 | case ${REPLY:-1} in 377 | 0) 378 | locale="fr_FR" 379 | ;; 380 | 1) 381 | locale="de_DE" 382 | ;; 383 | 2) 384 | ask "Please insert your keymap" 385 | locale="${REPLY}" 386 | ;; 387 | *) 388 | locale="fr_FR" 389 | ;; 390 | esac 391 | 392 | echo "locale=\"${locale}\"" >> ${install_conf} 393 | fi 394 | 395 | ##t 396 | if [[ -z ${timezone+x} ]]; 397 | then 398 | echo "What is your timezone?" 399 | ask "0) Europe/Paris 1) Europe/Berlin (default) 2) input your own" 400 | 401 | case ${REPLY:-1} in 402 | 0) 403 | timezone="Europe/Paris" 404 | ;; 405 | 1) 406 | timezone="Europe/Berlin" 407 | ;; 408 | 2) 409 | ask "Please insert your keymap" 410 | timezone="${REPLY}" 411 | ;; 412 | *) 413 | timezone="Europe/Paris" 414 | ;; 415 | esac 416 | 417 | echo "timezone=\"${timezone}\"" >> ${install_conf} 418 | fi 419 | 420 | ##u 421 | if [[ -z ${user+x} ]]; 422 | then 423 | ask "Please input your username" 424 | user="${REPLY}" 425 | 426 | echo "user=\"${user}\"" >> ${install_conf} 427 | fi 428 | 429 | ##z 430 | if [[ -z ${zpoolname+x} ]]; 431 | then 432 | ask "Please input zpool name. Default is >>zroot<<." 433 | zpoolname="${REPLY:-zroot}" 434 | 435 | echo "zpoolname=\"${zpoolname}\"" >> ${install_conf} 436 | fi 437 | #eo: configuration section 438 | 439 | #bo: dkms or no dkms 440 | if [[ -z ${zfskernelmode+x} ]]; 441 | then 442 | echo "Which zfs do you want to install?" 443 | if [[ ${kernel} == "linux" ]]; 444 | then 445 | ask "0) archzfs-dkms (default) 1) archzfs-linux" 446 | 447 | case ${REPLY:-0} in 448 | 1) zfskernelmode="archzfs-linux" 449 | ;; 450 | *) zfskernelmode="archzfs-dkms" 451 | ;; 452 | esac 453 | else 454 | ask "0) archzfs-dkms (default) 1) archzfs-linux-lts" 455 | 456 | case ${REPLY:-0} in 457 | 1) zfskernelmode="archzfs-linux-lts" 458 | ;; 459 | *) zfskernelmode="archzfs-dkms" 460 | ;; 461 | esac 462 | fi 463 | 464 | echo "zfskernelmode=\"${zfskernelmode}\"" >> ${install_conf} 465 | fi 466 | #eo: dkms or no dkms 467 | 468 | # Finish 469 | echo -e "\e[32mAll OK" 470 | } 471 | 472 | _main ${@} 473 | -------------------------------------------------------------------------------- /scripts/zfs/install/02-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #### 3 | # Simple script to automate the steps from 4 | # https://wiki.archlinux.org/index.php/ZFS#Installation 5 | #### 6 | # @since 2022-08-22 7 | # @author: 8 | # eoli3n <https://eoli3n.eu.org/about/> 9 | # stev leibelt <artodeto@bazzline.net> 10 | #### 11 | 12 | set -e 13 | 14 | exec &> >(tee "install.log") 15 | 16 | # Debug 17 | if [[ "${1}" == "debug" ]] 18 | then 19 | set -x 20 | debug=1 21 | fi 22 | 23 | function ask () 24 | { 25 | read -p "> ${1} " -r 26 | echo 27 | } 28 | 29 | function print () 30 | { 31 | echo -e "\n\033[1m> ${1}\033[0m\n" 32 | if [[ -n "${debug}" ]] 33 | then 34 | read -rp "press enter to continue" 35 | fi 36 | } 37 | 38 | function _main () 39 | { 40 | local PATH_TO_THIS_SCRIPT=$(cd `dirname ${0}` && pwd) 41 | 42 | local PATH_TO_THE_LOCAL_INSTALL_CONF="${PATH_TO_THIS_SCRIPT}/install.conf" 43 | local PATH_TO_THE_DIST_INSTALL_CONF="${PATH_TO_THIS_SCRIPT}/install.dist.conf" 44 | 45 | echo ":: bo sourcing configuration files " 46 | if [[ -f "${PATH_TO_THE_DIST_INSTALL_CONF}" ]]; 47 | then 48 | echo " Sourcing >>install.dist.conf<<." 49 | . "${PATH_TO_THE_DIST_INSTALL_CONF}" 50 | fi 51 | 52 | if [[ -f "${PATH_TO_THE_LOCAL_INSTALL_CONF}" ]]; 53 | then 54 | echo " Sourcing >>install.conf<<." 55 | . "${PATH_TO_THE_LOCAL_INSTALL_CONF}" 56 | fi 57 | #bo: sourcing install configuration files 58 | 59 | if [[ -z ${install_configuration_sourced+x} ]]; 60 | then 61 | echo ":: No configuration file sourced." 62 | echo " This is super bad, neither >>install.dist.conf<< nor >>install.conf<< exists." 63 | echo " Please run >>01-configure.sh<<." 64 | 65 | exit 1 66 | fi 67 | echo ":: eo sourcing configuration files " 68 | 69 | echo ":: bo installing base packages" 70 | # Root dataset 71 | root_dataset=$(cat /tmp/root_dataset) 72 | 73 | # Sort mirrors 74 | print ":: Sort mirrors" 75 | systemctl start reflector 76 | 77 | # Install 78 | if grep -i -q amd < /proc/cpuinfo; 79 | then 80 | microcode_package='amd-ucode' 81 | else 82 | microcode_package='intel-ucode' 83 | fi 84 | 85 | print ":: Install Arch Linux" 86 | pacstrap /mnt \ 87 | base \ 88 | base-devel \ 89 | bash-completion \ 90 | ${kernel} \ 91 | ${kernel}-headers \ 92 | linux-firmware \ 93 | ${microcode_package} \ 94 | efibootmgr \ 95 | vim \ 96 | git \ 97 | ansible 98 | echo ":: eo installing base packages" 99 | 100 | echo ":: bo creating etc files" 101 | # Generate fstab excluding ZFS entries 102 | print ":: Generate fstab excluding ZFS entries" 103 | genfstab -U /mnt | grep -v "${zpoolname}" | tr -s '\n' | sed 's/\/mnt//' > /mnt/etc/fstab 104 | 105 | # Set hostname 106 | # Configure /etc/hosts 107 | print ":: Configure hosts file" 108 | cat > /mnt/etc/hosts <<EOF 109 | #<ip-address> <hostname.domain.org> <hostname> 110 | 127.0.0.1 localhost ${hostname} 111 | ::1 localhost ${hostname} 112 | EOF 113 | 114 | # Prepare keymap 115 | echo "KEYMAP=${keymap}" > /mnt/etc/vconsole.conf 116 | 117 | # Prepare locales 118 | sed -i 's/#\('"${locale}"'.UTF-8\)/\1/' /mnt/etc/locale.gen 119 | echo 'LANG="'"${locale}"'.UTF-8"' > /mnt/etc/locale.conf 120 | echo ":: eo creating etc files" 121 | 122 | echo ":: bo initramfs" 123 | # Prepare initramfs 124 | print ":: Prepare initramfs" 125 | if lspci | grep -i 'VGA' | grep -q -i intel 126 | then 127 | modules="i915 intel_agp" 128 | else 129 | modules="" 130 | fi 131 | cat > /mnt/etc/mkinitcpio.conf <<EOF 132 | MODULES=(${modules}) 133 | BINARIES=() 134 | FILES=(/etc/zfs/${zpoolname}.key) 135 | HOOKS=(base udev autodetect modconf block keyboard keymap zfs filesystems) 136 | COMPRESSION="zstd" 137 | EOF 138 | 139 | if [[ ${kernel} = "linux-lts" ]]; 140 | then 141 | cat > /mnt/etc/mkinitcpio.d/linux-lts.preset <<"EOF" 142 | ALL_config="/etc/mkinitcpio.conf" 143 | ALL_kver="/boot/vmlinuz-linux-lts" 144 | PRESETS=('default') 145 | default_image="/boot/initramfs-linux-lts.img" 146 | EOF 147 | else 148 | cat > /mnt/etc/mkinitcpio.d/linux.preset <<"EOF" 149 | ALL_config="/etc/mkinitcpio.conf" 150 | ALL_kver="/boot/vmlinuz-linux" 151 | PRESETS=('default') 152 | default_image="/boot/initramfs-linux.img" 153 | EOF 154 | fi 155 | echo ":: eo initramfs" 156 | 157 | echo ":: bo copy zfs files" 158 | print ":: Copy ZFS files" 159 | cp /etc/hostid /mnt/etc/hostid 160 | cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache 161 | cp /etc/zfs/${zpoolname}.key /mnt/etc/zfs 162 | 163 | ### Configure username 164 | if [[ -d /mnt/home/${user} ]]; 165 | then 166 | ask ":: User exists, delete it? (y|N)" 167 | 168 | if [[ ${REPLY} =~ ^[Yy]$ ]]; 169 | then 170 | arch-chroot /mnt /bin/bash -xe "userdel $user" 171 | rm -fr /mnt/home/$user 172 | fi 173 | fi 174 | echo ":: eo copy zfs files" 175 | 176 | echo ":: bo timedate configuration" 177 | timedatectl set-ntp true 178 | echo ":: eo timedate configuration" 179 | 180 | echo ":: bo chroot configuration" 181 | cat > /mnt/setup.sh <<EOF 182 | 183 | ### Reinit keyring 184 | # As keyring is initialized at boot, and copied to the install dir with pacstrap, and ntp is running 185 | # Time changed after keyring initialization, it leads to malfunction 186 | # Keyring needs to be reinitialised properly to be able to sign archzfs key. 187 | rm -Rf /etc/pacman.d/gnupg 188 | pacman-key --init 189 | pacman-key --populate archlinux 190 | pacman-key --recv-keys F75D9D76 191 | pacman-key --lsign-key F75D9D76 192 | pacman -S archlinux-keyring --noconfirm 193 | # https://wiki.archlinux.org/title/Unofficial_user_repositories#archzfs 194 | 195 | #### Check if an archzfs entries exists alreads in /etc/pacman.conf 196 | # We only want to add it once 197 | if ! grep -q 'archzfs' < /etc/pacman.conf; 198 | then 199 | cat >> /etc/pacman.conf <<"EOSF" 200 | [archzfs] 201 | # Origin Server - France 202 | Server = http://archzfs.com/archzfs/x86_64 203 | # Mirror - Germany 204 | Server = http://mirror.sum7.eu/archlinux/archzfs/archzfs/x86_64 205 | # Mirror - Germany 206 | Server = https://mirror.biocrafting.net/archlinux/archzfs/archzfs/x86_64 207 | # Mirror - India 208 | Server = https://mirror.in.themindsmaze.com/archzfs/archzfs/x86_64 209 | # Mirror - US 210 | Server = https://zxcvfdsa.com/archzfs/archzfs/x86_64 211 | EOSF 212 | fi 213 | pacman -Syu --noconfirm ${zfskernelmode} 214 | 215 | # Set date 216 | ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime 217 | 218 | # Sync clock 219 | hwclock --systohc 220 | 221 | # Generate locale 222 | locale-gen 223 | source /etc/locale.conf 224 | 225 | # Set keyboard layout 226 | echo "KEYMAP=${keymap}" > /etc/vconsole.conf 227 | 228 | # Generate Initramfs 229 | mkinitcpio -P 230 | 231 | # Install ZFSBootMenu and deps 232 | git clone --depth=1 https://github.com/zbm-dev/zfsbootmenu/ /tmp/zfsbootmenu 233 | pacman -S cpanminus kexec-tools fzf util-linux --noconfirm 234 | cd /tmp/zfsbootmenu 235 | make 236 | make install 237 | cpanm --notest --installdeps . 238 | 239 | # Create swap 240 | zfs create -V 8GB -b \$(getconf PAGESIZE) -o compression=zle -o logbias=throughput -o sync=always -primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false zroot/swap 241 | mkswap -f /dev/zvol/zroot/swap 242 | swapon /dev/zvol/zroot/swap 243 | echo '/dev/zvol/zroot/swap none swap discard 0 0' > /etc/fstab 244 | 245 | # Create user 246 | zfs create zroot/data/home/${user} 247 | useradd -m ${user} -G wheel 248 | chown -R ${user}:${user} /home/${user} 249 | 250 | EOF 251 | arch-chroot /mnt /bin/bash /setup.sh 252 | 253 | if [[ ${?} -eq 0 ]]; 254 | then 255 | rm /mnt/setup.sh 256 | fi 257 | echo ":: eo chroot configuration" 258 | 259 | echo ":: bo user configuration" 260 | # Set root passwd 261 | print ":: Set root password" 262 | arch-chroot /mnt /bin/passwd 263 | 264 | # Set user passwd 265 | print ":: Set user password" 266 | arch-chroot /mnt /bin/passwd "${user}" 267 | 268 | # Configure sudo 269 | print ":: Configure sudo" 270 | cat > /mnt/etc/sudoers <<EOF 271 | root ALL=(ALL) ALL 272 | ${user} ALL=(ALL) ALL 273 | Defaults rootpw 274 | EOF 275 | echo ":: eo user configuration" 276 | 277 | # Configure network 278 | if [[ ${configure_network} -eq 1 ]]; 279 | then 280 | pacstrap /mnt \ 281 | networkmanager 282 | 283 | systemctl enable NetworkManager.service --root=/mnt 284 | elif [[ ${configure_network} -eq 0 ]]; 285 | then 286 | pacstrap /mnt \ 287 | iwd \ 288 | wpa_supplicant 289 | 290 | cat > /mnt/etc/systemd/network/enoX.network <<"EOF" 291 | [Match] 292 | Name=en* 293 | 294 | [Network] 295 | DHCP=ipv4 296 | IPForward=yes 297 | 298 | [DHCP] 299 | UseDNS=no 300 | RouteMetric=10 301 | EOF 302 | 303 | cat > /mnt/etc/systemd/network/wlX.network <<"EOF" 304 | [Match] 305 | Name=wl* 306 | 307 | [Network] 308 | DHCP=ipv4 309 | IPForward=yes 310 | 311 | [DHCP] 312 | UseDNS=no 313 | RouteMetric=20 314 | EOF 315 | systemctl enable systemd-networkd --root=/mnt 316 | systemctl disable systemd-networkd-wait-online --root=/mnt 317 | 318 | mkdir /mnt/etc/iwd 319 | cat > /mnt/etc/iwd/main.conf <<"EOF" 320 | [General] 321 | UseDefaultInterface=true 322 | EnableNetworkConfiguration=true 323 | EOF 324 | systemctl enable iwd --root=/mnt 325 | else 326 | echo ":: No network configured!" 327 | echo " You have to do it manually or you wont have any network that easily on your new installed arch linux." 328 | fi 329 | 330 | # Configure DNS 331 | if [[ ${configure_dns} -eq 1 ]]; 332 | then 333 | rm /mnt/etc/resolv.conf 334 | ln -s /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf 335 | sed -i 's/^#DNS=.*/DNS=1.1.1.1/' /mnt/etc/systemd/resolved.conf 336 | systemctl enable systemd-resolved --root=/mnt 337 | fi 338 | 339 | # Configure display manager 340 | if [[ ${configure_displaymanager} = "kde" ]]; 341 | then 342 | #@see 343 | # https://wiki.archlinux.org/title/Xorg#Installation 344 | # https://wiki.archlinux.org/title/KDE#Installation 345 | # https://wiki.archlinux.org/title/SDDM#Installation 346 | pacstrap /mnt \ 347 | xorg-server \ 348 | xorg-apps \ 349 | plasma-meta \ 350 | kde-applications 351 | 352 | systemctl enable sddm.service --root=/mnt 353 | fi 354 | 355 | # Activate zfs 356 | echo ":: bo zfs inconfiguration" 357 | echo " Enable zfs service" 358 | systemctl enable zfs-import-cache --root=/mnt 359 | systemctl enable zfs-mount --root=/mnt 360 | systemctl enable zfs-import.target --root=/mnt 361 | systemctl enable zfs.target --root=/mnt 362 | 363 | # Configure zfs-mount-generator 364 | print " Configure zfs-mount-generator" 365 | mkdir -p /mnt/etc/zfs/zfs-list.cache 366 | touch /mnt/etc/zfs/zfs-list.cache/${zpoolname} 367 | zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand | sed 's/\/mnt//' > /mnt/etc/zfs/zfs-list.cache/${zpoolname} 368 | systemctl enable zfs-zed.service --root=/mnt 369 | echo ":: eo zfs inconfiguration" 370 | 371 | echo ":: bo zfsbootmenu" 372 | # Configure zfsbootmenu 373 | mkdir -p /mnt/efi/EFI/ZBM 374 | 375 | # Generate zfsbootmenu efi 376 | print ":: Configure zfsbootmenu" 377 | # https://github.com/zbm-dev/zfsbootmenu/blob/master/etc/zfsbootmenu/mkinitcpio.conf 378 | 379 | cat > /mnt/etc/zfsbootmenu/mkinitcpio.conf <<"EOF" 380 | MODULES=() 381 | BINARIES=() 382 | FILES=() 383 | HOOKS=(base udev autodetect modconf block keyboard keymap) 384 | COMPRESSION="zstd" 385 | EOF 386 | 387 | cat > /mnt/etc/zfsbootmenu/config.yaml <<EOF 388 | Global: 389 | ManageImages: true 390 | BootMountPoint: /efi 391 | InitCPIO: true 392 | 393 | Components: 394 | Enabled: false 395 | EFI: 396 | ImageDir: /efi/EFI/ZBM 397 | Versions: false 398 | Enabled: true 399 | Kernel: 400 | CommandLine: ro quiet loglevel=0 zbm.import_policy=hostid 401 | Prefix: vmlinuz 402 | EOF 403 | 404 | # Set cmdline 405 | zfs set org.zfsbootmenu:commandline="rw quiet nowatchdog rd.vconsole.keymap=${keymap}" ${zpoolname}/ROOT/"${root_dataset}" 406 | 407 | # Generate ZBM 408 | print ":: Generate zbm" 409 | arch-chroot /mnt /bin/bash -xe <<"EOF" 410 | # Export locale 411 | export LANG="${locale}" 412 | 413 | # Generate zfsbootmenu 414 | generate-zbm 415 | EOF 416 | echo ":: eo zfsbootmenu" 417 | 418 | # Set DISK 419 | if [[ -f /tmp/disk ]] 420 | then 421 | DISK=$(cat /tmp/disk) 422 | else 423 | print ":: Select the disk you installed on:" 424 | select ENTRY in $(ls /dev/disk/by-id/); 425 | do 426 | DISK="/dev/disk/by-id/${ENTRY}" 427 | echo "Creating boot entries on ${ENTRY}." 428 | break 429 | done 430 | fi 431 | 432 | # Create UEFI entries 433 | echo ":: bo uefi boot entries" 434 | 435 | if ! efibootmgr | grep ZFSBootMenu 436 | then 437 | efibootmgr --disk "${DISK}" \ 438 | --part 1 \ 439 | --create \ 440 | --label "ZFSBootMenu Backup" \ 441 | --loader "\EFI\ZBM\vmlinuz-backup.efi" \ 442 | --verbose 443 | efibootmgr --disk "${DISK}" \ 444 | --part 1 \ 445 | --create \ 446 | --label "ZFSBootMenu" \ 447 | --loader "\EFI\ZBM\vmlinuz.efi" \ 448 | --verbose 449 | else 450 | print ":: Boot entries already created" 451 | fi 452 | 453 | # Umount all parts 454 | print ":: Umount all parts" 455 | umount /mnt/efi 456 | zfs umount -a 457 | 458 | # Export zpool 459 | print ":: Export zpool" 460 | zpool export ${zpoolname} 461 | 462 | # Finish 463 | echo -e "\e[32mAll OK" 464 | } 465 | 466 | _main ${@} 467 | 468 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see <http://www.gnu.org/licenses/>. 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | <http://www.gnu.org/licenses/>. 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | <http://www.gnu.org/philosophy/why-not-lgpl.html>. 675 | --------------------------------------------------------------------------------