diff --git a/tools/include/images/SY018.png b/tools/include/images/SY018.png new file mode 100644 index 000000000..32fd3e21e Binary files /dev/null and b/tools/include/images/SY018.png differ diff --git a/tools/json/config.system.json b/tools/json/config.system.json index d8d21825e..eeb5305b9 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -332,6 +332,26 @@ "status": "Stable", "author": "@viraniac @igorpecovnik", "condition": "[ -d /boot/dtb/ ]" + }, + { + "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" } ] } diff --git a/tools/modules/runtime/config.runtime.sh b/tools/modules/runtime/config.runtime.sh index 77d72fc31..9b6e19203 100644 --- a/tools/modules/runtime/config.runtime.sh +++ b/tools/modules/runtime/config.runtime.sh @@ -97,6 +97,9 @@ update_sub_submenu_data "Software" "Media" "SW24" "https://localhost:$emby_media plex_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'plex' | awk -F: '{print $2}' | awk '{print $1}' | head -n 1)" update_sub_submenu_data "Software" "Media" "SW22" "https://localhost:$plex_media_port" +# ZSH show version in the menu +update_submenu_data "System" "SY019" "$(module_zfs zfs_version)" + update_sub_submenu_data "Software" "Containers" "CON006" "http://$LOCALIPADD:${module_options["module_portainer,port"]}" update_sub_submenu_data "Software" "HomeAutomation" "HA004" "http://$LOCALIPADD:${module_options["module_haos,port"]}" diff --git a/tools/modules/system/install_zfs.sh b/tools/modules/system/install_zfs.sh new file mode 100644 index 000000000..f374132c3 --- /dev/null +++ b/tools/modules/system/install_zfs.sh @@ -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"]} " + 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 +}