mirror of
https://github.com/eoli3n/archiso-zfs.git
synced 2025-12-06 07:02:00 +01:00
dkms fallback method when no zfs-linux match current running kernel
This commit is contained in:
commit
9800a8d578
16
README.md
16
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
|
||||
|
|
|
|||
3
TODO
3
TODO
|
|
@ -1,2 +1 @@
|
|||
- add community repo to kernel build date in any cases
|
||||
- fallback to DKMS method
|
||||
- test dkms fallback method
|
||||
|
|
|
|||
42
init
42
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue