From 5f2574a31b6ed4391f644057e56a48cf713474a8 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 15:14:30 +0100 Subject: [PATCH 01/20] try dkms method --- init | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/init b/init index 725c2a0..7502701 100755 --- a/init +++ b/init @@ -120,6 +120,17 @@ download_package () { print "Downloading to $package_file ..." } +dkms_method () { + + print "Installing linux-headers from archive.org for current running kernel" + + pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/$1" --noconfirm + + print "Install zfs-dkms" + + pacman -S zfs-dkms --noconfirm +} + ### Main print "Testing if archiso is running" @@ -137,6 +148,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 +180,13 @@ 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" + print "Installing linux-headers and zfs-dkms" + dkms_method "$kernel_version_fixed_for_headers" + fi # Load kernel module From a17346592e488d8e559200aefe031eac889b3e62 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 15:17:28 +0100 Subject: [PATCH 02/20] fix filename to dl for headers --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 7502701..c700616 100755 --- a/init +++ b/init @@ -124,7 +124,7 @@ dkms_method () { print "Installing linux-headers from archive.org for current running kernel" - pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/$1" --noconfirm + pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/$1-x86_64.pkg.tar.zst" --noconfirm print "Install zfs-dkms" From a230607cc2d896b199d618687494344df0813c5b Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 15:20:08 +0100 Subject: [PATCH 03/20] tests --- init | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/init b/init index c700616..6961ac8 100755 --- a/init +++ b/init @@ -120,15 +120,12 @@ download_package () { print "Downloading to $package_file ..." } -dkms_method () { +dkms_init () { print "Installing linux-headers from archive.org for current running kernel" pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/$1-x86_64.pkg.tar.zst" --noconfirm - print "Install zfs-dkms" - - pacman -S zfs-dkms --noconfirm } ### Main @@ -185,7 +182,12 @@ else # DKMS fallback print "No zfs-linux package was found for current running kernel, fallback on DKMS method" print "Installing linux-headers and zfs-dkms" - dkms_method "$kernel_version_fixed_for_headers" + dkms_init "$kernel_version_fixed_for_headers" + + print "Install zfs-dkms" + + # Install package + pacman -S zfs-dkms --noconfirm && zfs=1 fi From fa7f561e98c9634ed26cb1bf9593821cf10bb9b6 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 15:21:10 +0100 Subject: [PATCH 04/20] tests --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 6961ac8..c05d58c 100755 --- a/init +++ b/init @@ -124,7 +124,7 @@ dkms_init () { print "Installing linux-headers from archive.org for current running kernel" - pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/$1-x86_64.pkg.tar.zst" --noconfirm + pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm } From 37b2f69d71fe431e1a6c99c7a702f27033dd74ea Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 15:25:59 +0100 Subject: [PATCH 05/20] should work with dkms now --- TODO | 3 +-- init | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) 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 c05d58c..270b760 100755 --- a/init +++ b/init @@ -122,8 +122,7 @@ download_package () { dkms_init () { - print "Installing linux-headers from archive.org for current running kernel" - + print "Installing linux-headers for current running kernel" pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm } @@ -181,7 +180,6 @@ else # DKMS fallback print "No zfs-linux package was found for current running kernel, fallback on DKMS method" - print "Installing linux-headers and zfs-dkms" dkms_init "$kernel_version_fixed_for_headers" print "Install zfs-dkms" From 3a233244f215996e4ad840a6c38bef90bc3dee49 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 22:19:16 +0100 Subject: [PATCH 06/20] added base-devel to be able to dkms --- init | 1 + 1 file changed, 1 insertion(+) diff --git a/init b/init index 270b760..e425837 100755 --- a/init +++ b/init @@ -185,6 +185,7 @@ else print "Install zfs-dkms" # Install package + pacman -S base-devel --noconfirm pacman -S zfs-dkms --noconfirm && zfs=1 fi From 573cb37be36887b9ce71122fddda8951d13fa8d7 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 22:43:39 +0100 Subject: [PATCH 07/20] use archive repo to the date of iso generation --- init | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/init b/init index e425837..eb852d7 100755 --- a/init +++ b/init @@ -122,8 +122,12 @@ download_package () { dkms_init () { - print "Installing linux-headers for current running kernel" - pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm + #print "Installing linux-headers for current running kernel" + #pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm + pacman_cache_date=$(stat -c '%y' /var/cache/pacman/pkg | cut -d' ' -f1 | sed 's:-:/:g') + + echo "Server=https://archive.archlinux.org/repos/$pacman_cache_date/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist + pacman -Syyu --noconfirm base-devel } @@ -185,7 +189,6 @@ else print "Install zfs-dkms" # Install package - pacman -S base-devel --noconfirm pacman -S zfs-dkms --noconfirm && zfs=1 fi From ca53c2f6720e8e5ce731eeee11aee7464b09a88c Mon Sep 17 00:00:00 2001 From: eoli3n Date: Tue, 15 Feb 2022 22:48:32 +0100 Subject: [PATCH 08/20] pacman --- init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init b/init index eb852d7..243b517 100755 --- a/init +++ b/init @@ -127,7 +127,8 @@ dkms_init () { pacman_cache_date=$(stat -c '%y' /var/cache/pacman/pkg | cut -d' ' -f1 | sed 's:-:/:g') echo "Server=https://archive.archlinux.org/repos/$pacman_cache_date/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist - pacman -Syyu --noconfirm base-devel + pacman -Syyuu --noconfirm + pacman -S --noconfirm base-devel } From 8f6e0e33da766add851d5af1188e3c37a4369948 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:21:14 +0100 Subject: [PATCH 09/20] use existing archive function --- init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init b/init index 243b517..98db5f1 100755 --- a/init +++ b/init @@ -124,10 +124,14 @@ dkms_init () { #print "Installing linux-headers for current running kernel" #pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm + print "Extract repo date and init Archlinux Archive repository" pacman_cache_date=$(stat -c '%y' /var/cache/pacman/pkg | cut -d' ' -f1 | sed 's:-:/:g') + init_archlinux_archive "$pacman_cache_date" - echo "Server=https://archive.archlinux.org/repos/$pacman_cache_date/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist + print "Download Archlinux Archives package lists and upgrade" pacman -Syyuu --noconfirm + + print "Install base-devel" pacman -S --noconfirm base-devel } From a0e075ee25d040199df1b615013900376d3eb78a Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:24:14 +0100 Subject: [PATCH 10/20] fix archive function --- init | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init b/init index 98db5f1..c40d482 100755 --- a/init +++ b/init @@ -52,11 +52,10 @@ init_archlinux_archive () { # Returns False if repo does not exists # Set repo - repo="Server=https://archive.archlinux.org/repos/$1/\$repo/os/\$arch" - pacman -Syy --quiet + repo="https://archive.archlinux.org/repos/$1/\$repo/os/\$arch" # If repo exists, set it - curl -s "$repo" && echo "$repo" > /etc/pacman.d/mirrorlist + curl -s "$repo" && echo "Server=$repo" > /etc/pacman.d/mirrorlist } From ecb31b79e82c2552ea9b1b521c758883aa390b42 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:30:16 +0100 Subject: [PATCH 11/20] use archiso version for archive --- init | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init b/init index c40d482..891caf8 100755 --- a/init +++ b/init @@ -123,9 +123,9 @@ dkms_init () { #print "Installing linux-headers for current running kernel" #pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm - print "Extract repo date and init Archlinux Archive repository" - pacman_cache_date=$(stat -c '%y' /var/cache/pacman/pkg | cut -d' ' -f1 | sed 's:-:/:g') - init_archlinux_archive "$pacman_cache_date" + 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 From e2950465a95171200b8de3f574de916b81f16100 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:31:32 +0100 Subject: [PATCH 12/20] fix archive test --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init b/init index 891caf8..93bc707 100755 --- a/init +++ b/init @@ -52,10 +52,10 @@ init_archlinux_archive () { # Returns False if repo does not exists # Set repo - repo="https://archive.archlinux.org/repos/$1/\$repo/os/\$arch" + repo="https://archive.archlinux.org/repos/$1" # If repo exists, set it - curl -s "$repo" && echo "Server=$repo" > /etc/pacman.d/mirrorlist + curl -s "$repo" && echo "Server=$repo/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist } From 3a114224c0302d89cd93984ad56288c05f51458b Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:32:57 +0100 Subject: [PATCH 13/20] fix archive test --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init b/init index 93bc707..5190713 100755 --- a/init +++ b/init @@ -52,10 +52,10 @@ init_archlinux_archive () { # Returns False if repo does not exists # Set repo - repo="https://archive.archlinux.org/repos/$1" + repo="https://archive.archlinux.org/repos/$1/" # If repo exists, set it - curl -s "$repo" && echo "Server=$repo/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist + curl -s "$repo" && echo "Server=$repo\$repo/os/\$arch" > /etc/pacman.d/mirrorlist } From cb58ca61bd5f8e94709c4581b79200fa04f29030 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:33:38 +0100 Subject: [PATCH 14/20] quiet curl test archive --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 5190713..d9c973f 100755 --- a/init +++ b/init @@ -55,7 +55,7 @@ init_archlinux_archive () { repo="https://archive.archlinux.org/repos/$1/" # If repo exists, set it - curl -s "$repo" && echo "Server=$repo\$repo/os/\$arch" > /etc/pacman.d/mirrorlist + curl -s "$repo" &>/dev/null && echo "Server=$repo\$repo/os/\$arch" > /etc/pacman.d/mirrorlist } From c4d06af8ab2d96582e2ca321435de14a5ab97f46 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:53:29 +0100 Subject: [PATCH 15/20] funny workaround for 2022/02/01 --- init | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/init b/init index d9c973f..b77e8f1 100755 --- a/init +++ b/init @@ -51,8 +51,16 @@ 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="https://archive.archlinux.org/repos/$1/" + repo="https://archive.archlinux.org/repos/$version/" # If repo exists, set it curl -s "$repo" &>/dev/null && echo "Server=$repo\$repo/os/\$arch" > /etc/pacman.d/mirrorlist From e11450c70be95eb02e14494875d2b406698e0a78 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 10:57:37 +0100 Subject: [PATCH 16/20] added debug log --- init | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init b/init index b77e8f1..3b65dbd 100755 --- a/init +++ b/init @@ -5,6 +5,8 @@ set -e +exec &> >(tee "debug.log") + ### Functions print () { From 96b0f70a22b5ccf8c95ffd5000df6473e3fa8ebf Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 11:16:38 +0100 Subject: [PATCH 17/20] udpated README --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f20ca32..6c5fc06 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,24 @@ In that case, the script uses [Arch Linux Archive](https://wiki.archlinux.org/in 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 From 6efecee5b590008dc2a74c85cd328df563ff40c5 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 11:23:28 +0100 Subject: [PATCH 18/20] updated TODO --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 4ad5216..8ec63ac 100644 --- a/TODO +++ b/TODO @@ -1 +1,2 @@ - test dkms fallback method + - match zfs-linux-dkms with current running kernel : http://sprunge.us/kPWTJf From 401d95e9e44ba2144da6bdfdeb18a0b94bbfa774 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 11:27:24 +0100 Subject: [PATCH 19/20] install linux-headers --- TODO | 1 - init | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 8ec63ac..4ad5216 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ - test dkms fallback method - - match zfs-linux-dkms with current running kernel : http://sprunge.us/kPWTJf diff --git a/init b/init index 3b65dbd..1da8a92 100755 --- a/init +++ b/init @@ -141,7 +141,7 @@ dkms_init () { pacman -Syyuu --noconfirm print "Install base-devel" - pacman -S --noconfirm base-devel + pacman -S --noconfirm base-devel linux-headers } @@ -198,7 +198,7 @@ else # DKMS fallback print "No zfs-linux package was found for current running kernel, fallback on DKMS method" - dkms_init "$kernel_version_fixed_for_headers" + dkms_init print "Install zfs-dkms" From 0199589d215b3611e4c90ecc0e18dc35cb91a8c0 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Wed, 16 Feb 2022 13:15:45 +0100 Subject: [PATCH 20/20] working ! --- README.md | 2 +- init | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6c5fc06..c3dca24 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ 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 diff --git a/init b/init index 1da8a92..9a04100 100755 --- a/init +++ b/init @@ -130,9 +130,8 @@ download_package () { } dkms_init () { +# Init everything to be able to install zfs-dkms - #print "Installing linux-headers for current running kernel" - #pacman -U "https://archive.org/download/archlinux_pkg_linux-headers/linux-headers-$1-x86_64.pkg.tar.zst" --noconfirm print "Init Archlinux Archive repository" archiso_version=$(sed 's-\.-/-g' /version) init_archlinux_archive "$archiso_version"