Skip to content
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

System: add ZFS compilation support #282

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tools/include/images/SY018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions tools/json/config.system.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,26 @@
"status": "Stable",
"author": "@viraniac @igorpecovnik",
"condition": "[ -d /boot/dtb/ ] && [ -f /boot/armbianEnv.txt ]"
},
{
"id": "SY018",
"description": "ZFS filesystem - enable support",
"command": [
"module_zfs install"
],
"status": "Stable",
"author": "@armbian",
"condition": "! module_zfs status && linux-version compare ${KERNELID} le $(module_zfs kernel_max)"
},
{
"id": "SY019",
"description": "ZFS filesystem - remove support",
"command": [
"module_zfs remove"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_zfs status"
}
]
}
Expand Down
59 changes: 59 additions & 0 deletions tools/modules/system/install_zfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module_options+=(
["module_zfs,author"]="@armbian"
["module_zfs,feature"]="module_zfs"
["module_zfs,desc"]="Install zfs filesystem support"
["module_zfs,example"]="install remove status kernel_max zfs_version help"
["module_zfs,port"]=""
["module_zfs,status"]="Active"
["module_zfs,arch"]=""
)
#
# Mmodule_zfs
#
function module_zfs () {
local title="zfs"
local condition=$(which "$title" 2>/dev/null)

local commands
IFS=' ' read -r -a commands <<< "${module_options["module_zfs,example"]}"

# determine if our kernel is not too recent
local zfs_dkms=$(LC_ALL=C apt-cache policy zfs-dkms | grep Candidate | xargs | cut -d" " -f2 | cut -c-5)
local kernel_max=$(wget -qO- https://github.com/openzfs/zfs/raw/refs/tags/zfs-${zfs_dkms}/META | grep Maximum | cut -d" " -f2)

case "$1" in
"${commands[0]}")
module_headers install
apt_install_wrapper apt-get -y install zfsutils-linux zfs-dkms || exit 1
;;
"${commands[1]}")
module_headers remove
apt_install_wrapper apt-get -y autopurge zfsutils-linux zfs-dkms || exit 1
;;
"${commands[2]}")
if check_if_installed zfsutils-linux; then
return 0
else
return 1
fi
;;
"${commands[3]}")
echo "${kernel_max}"
;;
"${commands[4]}")
echo "v${zfs_dkms}"
;;
"${commands[5]}")
echo -e "\nUsage: ${module_options["module_zfs,feature"]} <command>"
echo -e "Commands: ${module_options["module_zfs,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tstatus\t- Installation status $title."
echo -e "\tremove\t- Remove $title."
echo
;;
*)
${module_options["module_zfs,feature"]} ${commands[3]}
;;
esac
}
Loading