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

nfsd fixes #312

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion tools/json/config.system.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"id": "NFS03",
"description": "Remove network filesystem (NFS) daemon",
"command": [
"module_nfsd uninstall"
"module_nfsd remove"
],
"status": "Stable",
"author": "@igorpecovnik",
Expand Down
17 changes: 17 additions & 0 deletions tools/modules/functions/service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# service.sh

declare -A module_options
module_options+=(
["service,author"]="@dimitry-ishenko"
["service,desc"]="Wrapper for service manipulation"
["service,example"]="service install some.service"
["service,feature"]="service"
["service,status"]="active"
)

function service()
{
# ignore these commands, if running inside container
[[ "$1" =~ ^(reload|restart|start|status|stop)$ ]] && systemd-detect-virt -qc && return 0
systemctl "$@"
}
19 changes: 9 additions & 10 deletions tools/modules/network/module_nfsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ function module_nfsd () {
local title="nfsd"
local condition=$(which "$title" 2>/dev/null)?

local package_name=nfs-kernel-server
local service_name=nfs-server.service

# we will store our config in subfolder
mkdir -p /etc/exports.d/

Expand All @@ -24,13 +27,13 @@ function module_nfsd () {

case "$1" in
"${commands[0]}")
apt_install_wrapper apt-get -y install nfs-common nfs-kernel-server
apt_install_wrapper apt-get -y install $package_name
# add some exports
${module_options["module_nfsd,feature"]} ${commands[2]}
systemctl restart nfs-server.service
service restart $service_name
;;
"${commands[1]}")
apt_install_wrapper apt-get -y autopurge nfs-kernel-server
apt_install_wrapper apt-get -y autopurge $package_name
;;
"${commands[2]}")
while true; do
Expand Down Expand Up @@ -65,7 +68,7 @@ function module_nfsd () {
break
fi
done
systemctl restart nfs-server.service
service restart $service_name
;;
"${commands[3]}")
# choose between most common options
Expand Down Expand Up @@ -96,11 +99,7 @@ function module_nfsd () {
fi
;;
"${commands[4]}")
if systemctl is-active --quiet nfs-server.service; then
return 0
else
return 1
fi
check_if_installed $package_name
;;
"${commands[5]}")
echo -e "\nUsage: ${module_options["module_nfsd,feature"]} <command>"
Expand All @@ -114,7 +113,7 @@ function module_nfsd () {
echo
;;
*)
${module_options["module_nfsd,feature"]} ${commands[5]}
${module_options["module_nfsd,feature"]} ${commands[5]}
;;
esac
}
Loading