-
Notifications
You must be signed in to change notification settings - Fork 0
/
zfs-yu
executable file
·47 lines (39 loc) · 1.36 KB
/
zfs-yu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
if ! pacman -Qi zfs-utils > /dev/null 2> /dev/null; then
# ZFS not installed, skip
yay -Syu
exit 0
fi
PKGNAME="linux"
if pacman -Qi linux-lts > /dev/null 2> /dev/null; then
PKGNAME="linux-lts"
fi
if [ "$1" != "--nosync" ]; then
sudo pacman -Sy
fi
# DKMS, skip all this
if pacman -Qi zfs-dkms > /dev/null 2> /dev/null; then
yay -Su
exit
elif pacman -Qi zfs-dkms-git > /dev/null 2> /dev/null; then
yay -Su
exit
fi
installed=$(pacman -Qi ${PKGNAME} | grep Version | awk '{print $NF}')
repo=$(pacman -Si ${PKGNAME} | grep Version | awk '{print $NF}')
needed=$(pacman -Si zfs-${PKGNAME} | grep Depends | awk -F= '{print $NF}')
if [ "$repo" = "$needed" ]; then
# All good
yay -Su
elif [ "$installed" = "$needed" ]; then
# Installed version is good
yay -Su --ignore ${PKGNAME},${PKGNAME}-headers
else
# Grab needed version from archive
cd /tmp
wget "https://archive.archlinux.org/packages/l/${PKGNAME}/${PKGNAME}-${needed}-x86_64.pkg.tar.zst"
wget "https://archive.archlinux.org/packages/l/${PKGNAME}-headers/${PKGNAME}-headers-${needed}-x86_64.pkg.tar.zst"
yay -Ud "${PKGNAME}-${needed}-x86_64.pkg.tar.zst" "${PKGNAME}-headers-${needed}-x86_64.pkg.tar.zst"
yay -Su --ignore ${PKGNAME},${PKGNAME}-headers
rm "${PKGNAME}-${needed}-x86_64.pkg.tar.zst" "${PKGNAME}-headers-${needed}-x86_64.pkg.tar.zst"
fi