Signed-off-by: Lukas Czerner <lczerner@redhat.com> --- scripts/fsadm.sh | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh index db0fd4b..1968ee3 100755 --- a/scripts/fsadm.sh +++ b/scripts/fsadm.sh @@ -83,6 +83,8 @@ PROCDEVICES="/proc/devices" PROCPARTITIONS="/proc/partitions" NULL="$DM_DEV_DIR/null" +CONFIG_PATHS="/etc/fsadm.conf ~/fsadm.conf" + MAX_VGS=999 IFS_OLD=$IFS @@ -1325,6 +1327,20 @@ check() { esac } +set_default_config() { + [ -z "$DEFAULT_POOL" ] && DEFAULT_POOL="default_pool" +} + +parse_config() { + for line in $(cat $1); do + case "$line" in + "DEFAULT_POOL"*) DEFAULT_POOL=${line##*=} ;; + "#"*) continue ;; + *) error "Unknown value \"$line\" in configuration file" + esac + done +} + ############################# # start point of this script # - parsing parameters @@ -1365,6 +1381,7 @@ do "-o"|"--resize-fs-only") RESIZE_FS_ONLY=1 ;; "-y"|"--yes") YES="-y" ;; "-l"|"--lvresize") ;; + "-c"|"--config") CONFIG=$2; shift 1 ;; "check") COMMAND=$1; shift; ARGS=$@; break ;; "resize") COMMAND=$1; shift; ARGS=$@; break ;; "create") COMMAND=$1; shift; ARGS=$@; break ;; @@ -1380,6 +1397,17 @@ if [ -z $COMMAND ]; then error "Missing command. (see: $TOOL --help)" fi +set_default_config +if [ "$CONFIG" ]; then + [ ! -f "$CONFIG" ] && error "\"$CONFIG\" is not proper configuration file" + parse_config $CONFIG +else + for i in $CONFIG_PATHS; do + [ ! -f "$i" ] && continue + parse_config $i + done +fi + export FSADM_RUNNING="fsadm" $COMMAND $ARGS cleanup 0 -- 1.7.4.4 _______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/