From 684ca29524749320e0dfa0aa331bf105e2e5379f Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 10 Jun 2018 14:55:50 -0300 Subject: Config: sed needs to work on KVMXFILE, not in the symlink, otherwise the symlink is broken --- kvmx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'kvmx') 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 } -- cgit v1.2.3