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

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

commit c230bc9eadbf510b2e8b97ab5dbb22e55b9d80f4
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Mon Apr 18 14:56:18 2022 -0400

    On RPM upgrade prompt for cookie only if previously set "monster"
---
 rpm/SPECS/couchdb.spec.in | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/rpm/SPECS/couchdb.spec.in b/rpm/SPECS/couchdb.spec.in
index bdaa4f7..9a3749f 100644
--- a/rpm/SPECS/couchdb.spec.in
+++ b/rpm/SPECS/couchdb.spec.in
@@ -144,12 +144,21 @@ if ! /usr/bin/getent passwd couchdb > /dev/null; then 
/usr/sbin/adduser \
 %{__ln_s} -f -T /var/log/%{name} %{buildroot}/opt/%{name}/var/log/%{name}
 
 %post
-echo "Please enter a cookie value for this installation: " >/dev/tty
-if exec </dev/tty; then
-  read cookie;
+if %{__grep} -q "^-setcookie monster$" /opt/%{name}/etc/vm.args; then
+  echo "Please enter a cookie value for this installation: " >/dev/tty
+  if exec </dev/tty; then
+    read cookie;
+  fi
+  echo "Writing $cookie to vm.args..."
+  %{__sed} -i "s/^-setcookie monster.*$/-setcookie ${cookie}/" 
/opt/%{name}/etc/vm.args
+elif %{__grep} -q "^[# ]*-setcookie$" /opt/%{name}/etc/vm.args; then
+  echo "Please enter a cookie value for this installation: " >/dev/tty
+  if exec </dev/tty; then
+    read cookie;
+  fi
+  echo "Writing $cookie to vm.args..."
+  %{__sed} -i "s/^[# ]*-setcookie.*$/-setcookie ${cookie}/" 
/opt/%{name}/etc/vm.args
 fi
-echo "Writing $cookie to vm.args..."
-%{__sed} -i "s/^[# ]*-setcookie.*$/-setcookie ${cookie}/" 
/opt/%{name}/etc/vm.args
 %{__chown} -R couchdb:couchdb /opt/%{name}
 %{__chmod} a+x /opt/%{name}/bin/*
 %if 0%{?fedora} || 0%{?rhel} >= 7

Reply via email to