From 4075058b1f5eed8b3ee020ff6e689cd52c773efe Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 30 Aug 2016 15:58:58 +0200 Subject: system: add support for automatic mount of /nv We add two new nv_auto_mount and nv_auto_format options to the system service. The first one enables automatic mounting of /nv, the second one allows to try to format it if mount fails. --- sbin/init.d/system | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sbin/init.d/system b/sbin/init.d/system index 22922a2..5094e9d 100755 --- a/sbin/init.d/system +++ b/sbin/init.d/system @@ -14,6 +14,8 @@ option sysset multiple_option option file_max standard_option option rtc standard_option "local" # "local", "utc", "disabled" option rtc_mode standard_option "direct" # "direct", "kernel" +option nv_auto_mount boolean_option +option nv_auto_format boolean_option function do_help { @@ -27,6 +29,8 @@ function do_help { echo " - filemax : integer ; ; cur=$opt_filemax" echo " - rtc : local|utc|disabled ; local ; cur=$opt_rtc" echo " - rtc_mode : direct|kernel ; direct ; cur=$opt_rtc_mode" + echo " - nv_auto_mount : boolean ; default= ; cur=$opt_nv_auto_mount" + echo " - nv_auto_format : boolean ; default= ; cur=$opt_nv_auto_format" echo exit 1 } @@ -110,6 +114,18 @@ function do_start { echo ${opt_hostname#*.} >/proc/sys/kernel/domainname fi + if [ -n "$opt_nv_auto_mount" ]; then + if [ ! -d "/nv/." ] && ! mkdir -p /nv >/dev/null 2>&1; then + echo " ==> start $svcname : cannot mount /nv, directory doesn't exist." + elif [ ! -x "/sbin/mount-nv" ]; then + echo " ==> start $svcname : cannot mount /nv, mount-nv isn't installed." + else + echo -n "Mounting /nv... " + /sbin/mount-nv ${opt_nv_auto_format:+--auto-format} + echo "Done." + fi + fi + do_date_from_hw for arg in "${opt_sysctl[@]}"; do -- 1.7.12.1