You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2024/01/09 19:13:14 UTC

(couchdb-pkg) branch main updated: Fix Regex and Snap unset (#131)

This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git


The following commit(s) were added to refs/heads/main by this push:
     new 9cc7fa6  Fix Regex and Snap unset (#131)
9cc7fa6 is described below

commit 9cc7fa6cf8fa36eb0da56e3442a5551999e0e1c7
Author: Simon Klassen <69...@users.noreply.github.com>
AuthorDate: Wed Jan 10 03:13:09 2024 +0800

    Fix Regex and Snap unset (#131)
    
    * vm.args regex handles comments; unsets key
    * Move the snapctl unset closer to the snapctl get
    
    ---------
    
    Co-authored-by: sklassen <none>
---
 snap/hooks/configure | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/snap/hooks/configure b/snap/hooks/configure
index a4af362..a63d4cf 100755
--- a/snap/hooks/configure
+++ b/snap/hooks/configure
@@ -22,8 +22,10 @@ _modify_vm_args() {
   opt=$1
   value="$2"
   replace_line="-$opt $value"
-  if $(grep -q "^[#|[:space:]]*-$opt " $VM_ARGS); then
-    sed --in-place "s/^[#|[:space:]]*-$opt .*/$replace_line/" $VM_ARGS 
+  if $(grep -q "^# -$opt" $VM_ARGS); then
+    sed --in-place "s/^# -$opt.*/$replace_line/" $VM_ARGS
+  elif $(grep -q "^-$opt " $VM_ARGS); then
+    sed --in-place "s/^-$opt .*/$replace_line/" $VM_ARGS
   else
     echo $replace_line >> $VM_ARGS
   fi
@@ -51,6 +53,7 @@ do
   if [ ! -z "$val" ]; then
     _modify_vm_args $key $val
     sleep 0.125
+    snapctl unset $key
   fi
 done
 
@@ -61,5 +64,6 @@ do
   if [ ! -z "$val" ]; then
     _modify_ini_args $key $val
     sleep 0.125
+    snapctl unset $key
   fi
 done