sklassen commented on code in PR #131:
URL: https://github.com/apache/couchdb-pkg/pull/131#discussion_r1446255021


##########
snap/hooks/configure:
##########
@@ -22,11 +22,14 @@ _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
+  snapctl unset $key

Review Comment:
   The hook should only use the set value for the sed transformation, after 
which it can be discarded. Subsequent calls to `snap set` should then be 
faster. The ultimate state is the text in the local.ini and vm.args files at 
the time of the `snap restart`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to