]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Config: sed needs to work on KVMXFILE, not in the symlink, otherwise the symlink...
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 10 Jun 2018 17:55:50 +0000 (14:55 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 10 Jun 2018 17:55:50 +0000 (14:55 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 722d17f1e3e4d5a35a75751d173d91a6438f6029..d5504c0d78c83c4a2aeb825f37f7b93bada02bc8 100755 (executable)
--- 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
 }