diff --git a/README.md b/README.md index f20ca32..c3dca24 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,30 @@ In order to build the module, DKMS needs the ``linux-headers`` package for the r It extracts running kernel version and try to find a matching ZFS module in ``Archzfs`` repositories. If it doesn't, it fallbacks to the DKMS build of the ZFS module. -In that case, the script uses [Arch Linux Archive](https://wiki.archlinux.org/index.php/Arch_Linux_Archive#How_to_restore_all_packages_to_a_specific_date) to install the ``linux-headers`` package required for DKMS. +In that case, the script uses [Arch Linux Archive](https://wiki.archlinux.org/index.php/Arch_Linux_Archive#How_to_restore_all_packages_to_a_specific_date) to install the ``linux-headers`` and ``base-devel`` packages required for DKMS. You need at least ~6Gb RAM to use that method to be able to store packages in cowspace. ### How to use Boot on any archiso system, and run: ``` -curl -s https://eoli3n.github.io/archzfs/init | bash +$ curl -s https://eoli3n.github.io/archzfs/init | bash ``` ### Debug To run the script in verbose mode, use: ``` -curl -s https://eoli3n.github.io/archzfs/init | sed 's- &>/dev/null--' | bash &> debug.log +$ curl -s https://eoli3n.github.io/archzfs/init | sed 's- &>/dev/null--' | bash &> debug.log +``` + +### Dev + +```bash +$ loadkeys fr +# In pacman.conf, comment SigLevel line +# Set "SigLevel = Never" +$ pacman -Syy git +# In pacman.conf, restore Siglevel line ``` ### Related diff --git a/TODO b/TODO index 29f455d..4ad5216 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ -- add community repo to kernel build date in any cases -- fallback to DKMS method +- test dkms fallback method diff --git a/init b/init index 725c2a0..9a04100 100755 --- a/init +++ b/init @@ -5,6 +5,8 @@ set -e +exec &> >(tee "debug.log") + ### Functions print () { @@ -51,12 +53,19 @@ init_archlinux_archive () { # $1 is date formated as 'YYYY/MM/DD' # Returns False if repo does not exists + # Archlinux Archive workaround for 2022/02/01 + if [[ "$1" == "2022/02/01" ]] + then + version="2022/02/02" + else + version="$1" + fi + # Set repo - repo="Server=https://archive.archlinux.org/repos/$1/\$repo/os/\$arch" - pacman -Syy --quiet + repo="https://archive.archlinux.org/repos/$version/" # If repo exists, set it - curl -s "$repo" && echo "$repo" > /etc/pacman.d/mirrorlist + curl -s "$repo" &>/dev/null && echo "Server=$repo\$repo/os/\$arch" > /etc/pacman.d/mirrorlist } @@ -120,6 +129,21 @@ download_package () { print "Downloading to $package_file ..." } +dkms_init () { +# Init everything to be able to install zfs-dkms + + print "Init Archlinux Archive repository" + archiso_version=$(sed 's-\.-/-g' /version) + init_archlinux_archive "$archiso_version" + + print "Download Archlinux Archives package lists and upgrade" + pacman -Syyuu --noconfirm + + print "Install base-devel" + pacman -S --noconfirm base-devel linux-headers + +} + ### Main print "Testing if archiso is running" @@ -137,6 +161,7 @@ init_archzfs # https://github.com/archzfs/archzfs/issues/337#issuecomment-624312576 get_running_kernel_version kernel_version_fixed="${kernel_version//-/\.}" +kernel_version_fixed_for_headers="${kernel_version/-/\.}" # Search zfs-linux package matching running kernel version search_package "zfs-linux" "$kernel_version_fixed" @@ -168,6 +193,17 @@ then pacman -U "$zfs_utils_url" --noconfirm &>/dev/null pacman -U "$zfs_linux_package" --noconfirm &>/dev/null && zfs=1 fi +else + + # DKMS fallback + print "No zfs-linux package was found for current running kernel, fallback on DKMS method" + dkms_init + + print "Install zfs-dkms" + + # Install package + pacman -S zfs-dkms --noconfirm && zfs=1 + fi # Load kernel module