-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to keep track if archzfs and upstream kernel are in sync to know when to update #393
Comments
Ok so I have played around a bit and came up with a little script that compares the official arch website with the archzfs repo. Since release packages not only contain the zfs version, but also the kernel version they are built for, this should work reasonably well. However, when using this, keep in mind that executing this script too often can ddos the repositories, so please only use with a reasonable, random delay like 12 hours + <random of 0-120 minutes>. #!/bin/bash
arch=x86_64
package_name=zfs-linux
# check latest kernel version in official arch repos
arch_repo_version=$(curl -s https://archlinux.org/packages/core/$arch/linux/ | grep "<h2>" | grep -oiE "[[:digit:]\.]+arch[[:digit:]-]+" | tr - .)
[ $? -ne 0 ] && echo "no" && exit 1
# check latest supported kernel version by archzfs package
archzfs_version=$(curl -s https://archzfs.com/archzfs/$arch/ | grep -oiE "$package_name-[[:digit:]][0-9\.\_arch]+-" | head -1 | grep -oP "(?<=_)[0-9\.\-arch]+(?=\-)")
[ $? -ne 0 ] && echo "no" && exit 1
# compare versions and print result
if [ "$arch_repo_version" = "$archzfs_version" ]; then
echo "yes"
else
echo "no"
fi |
My "trick" is to just put the following in
|
Here is another solution. This script grabs the version of the linux kernel from the Add #!/bin/bash
set -eo pipefail
PKG_CACHE="/var/cache/pacman/pkg/"
pacman --sync --refresh
# grep the kenrel version from the zfs-linux dependencies
KERNEL_VERSION="$(expac -S '%D' zfs-linux | grep -oP 'linux=\K.+')"
KERNEL_PKG="linux-${KERNEL_VERSION}-x86_64.pkg.tar.zst"
KERNEL_HEADERS_PKG="linux-headers-${KERNEL_VERSION}-x86_64.pkg.tar.zst"
KERNEL_PKG_FILE="${PKG_CACHE}/${KERNEL_PKG}"
KERNEL_HEADERS_PKG_FILE="${PKG_CACHE}/${KERNEL_HEADERS_PKG}"
KERNEL_URL="https://archive.archlinux.org/packages/l/linux/${KERNEL_PKG}"
KERNEL_HEADERS_URL="https://archive.archlinux.org/packages/l/linux-headers/${KERNEL_HEADERS_PKG}"
[[ -f "${KERNEL_PKG_FILE}" ]] || {
curl --output "$KERNEL_PKG_FILE" "${KERNEL_URL}"
}
[[ -f "${KERNEL_HEADERS_PKG_FILE}" ]] || {
curl --output "${KERNEL_HEADERS_PKG_FILE}" "${KERNEL_HEADERS_URL}"
}
pacman --needed --noconfirm --upgrade "${KERNEL_PKG_FILE}" "${KERNEL_HEADERS_PKG_FILE}"
pacman --sync --noconfirm --needed zfs-linux |
If it can help anyhow, I've ended up building a script to check which kernel package is needed by the latest zfs package and download/serve it via a custom repository: https://github.com/Soulsuke/zfs-kernels You can either use it to serve a local repository or put it on a vm with a cronjob (although it shouldn't be run too often). |
Requires: checkupdates Preparation /etc/pacman.conf
IgnorePkg = linux-zen linux-zen-headers zfs-linux-zen zfs-utils
...
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
[archzfs]
Include = /etc/pacman.d/mirrorlist-archzfs Simple update script #!/bin/sh
if [ $(id -u) != 0 ]; then
exec sudo "$0" "$@"
fi
echo 'A system upgrade starts.'
echo 'Check for pending updates...'
echo ''
if [ "$1" == "skip-kernel" ]; then
eval 'sed -ie "s/^#IgnorePkg/IgnorePkg/g" /etc/pacman.conf'
else
eval 'sed -ie "s/^IgnorePkg/#IgnorePkg/g" /etc/pacman.conf'
fi
upd_res=$(checkupdates)
rv=$?
case $rv in
0) echo "$upd_res" ;;
1) echo "Unknown cause of failure."; exit ;;
2) echo "No updates are available."; exit ;;
esac
str_zfs='zfs-linux-zen'
str_zfs_lts='zfs-linux-lts'
if [[ $upd_res == *"$str_kernel"* ]]; then
echo ' '
if [[ $upd_res == *"$str_zfs"* ]]; then
echo "ZEN Kernel and ZFS module update available."
else
echo "ZEN Kernel update available, but not the ZFS module."
eval 'sed -ie "s/^#IgnorePkg/IgnorePkg/g" /etc/pacman.conf'
exit -1
fi
fi
while true; do
read -p "Do you wish to upgrade process? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) eval 'sed -ie "s/^#IgnorePkg/IgnorePkg/g" /etc/pacman.conf'; exit;;
* ) echo "Please answer yes or no.";;
esac
done
snap_name=$(date +%Y%m%d)_$(uname -r)
eval "zfs snapshot -r <SOME_POOL>@${snap_name}_sys-upgrade"
eval 'pacman -Syu && sed -ie "s/^#IgnorePkg/IgnorePkg/g" /etc/pacman.conf' Someday I'll improve it to parsing issues related to the kernel )) |
I am pretty straight forward. When I do an system update, I give it a try with the default Cheers, |
The dependencies solution works fine when adding linux (linux-zen in my specific case) to IgnorePkg. I am having a problem with linux-headers. This package is not automatically updated along with linux or zfs-linux. Maybe a solution is to add linux-headers as a dependency of zfs-linux-headers? |
Hey there, really awesome project!
Like probably every single user that uses this repo with the
zfs-linux
packe I tend to run into the "upstream kernel is newer than the archzfs package" situation. This not so much of an issue, I can live with that. However, sometimes I even run into this issue multiple times in a row, with newer versions, because of sheer (un)luck, and I have to wait again 😆Is there an easy way to look up whether the current archzfs package is in sync with the latest upstream kernel version?
Maybe by comparing official arch repo website with the CI server website for this repo?
Maybe in a way that is possible via some minimal script using pacman?
I would really like to add a simple, automated "upgrade nao!" indicator to my taskbar, so I don't have start a system upgrade to see if it would work.
Thx!
The text was updated successfully, but these errors were encountered: