From: Silvio Rhatto Date: Sun, 10 Jun 2018 17:55:50 +0000 (-0300) Subject: Config: sed needs to work on KVMXFILE, not in the symlink, otherwise the symlink... X-Git-Tag: 0.1.0~260 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=684ca29524749320e0dfa0aa331bf105e2e5379f;p=kvmx.git Config: sed needs to work on KVMXFILE, not in the symlink, otherwise the symlink is broken --- diff --git a/kvmx b/kvmx index 722d17f..d5504c0 100755 --- a/kvmx +++ b/kvmx @@ -119,7 +119,7 @@ function __kvmx_initialize { fi # Load and check guest config - if [ "$ACTION" != "ls" ] && [ "$ACTION" != "edit" ] && [ "$ACTION" != "usage" ] && [ "$ACTION" != "config" ]; then + if [ "$ACTION" != "ls" ] && [ "$ACTION" != "edit" ] && [ "$ACTION" != "usage" ]; then if [ ! -e "$GLOBAL_USER_CONFIG_FOLDER/$VM" ]; then if [ -e "kvmxfile" ]; then # Existing kvmxfile but not registered at the global user config @@ -195,7 +195,7 @@ function __kvmx_initialize { mkdir -p $STATE_DIR $LOG_DIR if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "provision" ] && [ "$ACTION" != "purge" ] \ - && [ "$ACTION" != "destroy" ] && [ "$ACTION" != "install" ]; then + && [ "$ACTION" != "destroy" ] && [ "$ACTION" != "install" ] && [ "$ACTION" != "config" ]; then echo "$BASENAME: file not found: $image" exit 1 fi @@ -1108,12 +1108,12 @@ function kvmx_config { shift if [ -z "$1" ]; then - grep "^$param=" $GLOBAL_USER_CONFIG_FOLDER/$VM | \ + grep "^$param=" $KVMXFILE | \ sed -e 's/="/=/' -e 's/"$//' -e "s/='/=/" -e "s/'$//" -e 's/^.*=//' - elif ! grep -q "^$param=" $GLOBAL_USER_CONFIG_FOLDER/$VM; then - echo "$param=\"$*\"" >> $GLOBAL_USER_CONFIG_FOLDER/$VM + elif ! grep -q "^$param=" $KVMXFILE; then + echo "$param=\"$*\"" >> $KVMXFILE else - sed -i -e "s#^$param=.*#$param=\"$*\"#" $GLOBAL_USER_CONFIG_FOLDER/$VM + sed -i -e "s#^$param=.*#$param=\"$*\"#" $KVMXFILE fi fi }