kvmx_clone $*
}
-# Edit guest config
-function kvmx_edit {
+# Get, set or edit guest config
+function kvmx_config {
if [ -z "$1" ]; then
if [ -z "$EDITOR" ]; then
EDITOR="vi"
echo "$BASENAME: $GLOBAL_USER_CONFIG_FOLDER/$VM: file not found."
fi
else
- if [ -z "$2" ]; then
- echo "usage: $BASENAME $VM edit $1 <value>"
- exit 1
- fi
+ #if [ -z "$2" ]; then
+ # echo "usage: $BASENAME $VM edit $1 <value>"
+ # exit 1
+ #fi
param="$1"
shift
- if ! grep -q "^$param=" $GLOBAL_USER_CONFIG_FOLDER/$VM; then
+ if [ -z "$1" ]; then
+ grep "^$param=" $GLOBAL_USER_CONFIG_FOLDER/$VM | \
+ 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
else
sed -i -e "s#^$param=.*#$param=\"$*\"#" $GLOBAL_USER_CONFIG_FOLDER/$VM
fi
}
+# Alias to config
+function kvmx_edit {
+ kvmx_config $*
+}
+
# Stop a guest
function kvmx_stop {
if kvmx_running; then