* Makefile and debian package.
* Patch for spice-client-gtk for menuless windows (spicec usecase).
* Accept args into monitor action.
-* Support for key=value options at `init` action to populate the `kvmxfile` with custom values.
# Edit guest config
function kvmx_edit {
- if [ -z "$EDITOR" ]; then
- EDITOR="vi"
- fi
+ if [ -z "$1" ]; then
+ if [ -z "$EDITOR" ]; then
+ EDITOR="vi"
+ fi
- if [ -e "$GLOBAL_USER_CONFIG_FOLDER/$VM" ]; then
- $EDITOR $GLOBAL_USER_CONFIG_FOLDER/$VM
+ if [ -e "$GLOBAL_USER_CONFIG_FOLDER/$VM" ]; then
+ $EDITOR $GLOBAL_USER_CONFIG_FOLDER/$VM
+ else
+ echo "$BASENAME: $GLOBAL_USER_CONFIG_FOLDER/$VM: file not found."
+ fi
else
- echo "$BASENAME: $GLOBAL_USER_CONFIG_FOLDER/$VM: file not found."
+ 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
+ echo "$param=\"$*\"" >> $GLOBAL_USER_CONFIG_FOLDER/$VM
+ else
+ sed -i -e "s#^$param=.*#$param=\"$*\"#" $GLOBAL_USER_CONFIG_FOLDER/$VM
+ fi
fi
}