Merge branch 'stable-3.8'

* stable-3.8:
  Set Gerrit to v3.8.3
  Set Gerrit to 3.7.6
  Set Gerrit to 3.6.8
  Set Gerrit to 3.7.5
  Set Gerrit to 3.6.7
  Set Gerrit to 3.7.4
  Set Gerrit to 3.6.6
  Set Gerrit to 3.7.3
  Set Gerrit to 3.6.5

Change-Id: I59e49a8a87c753f1e9f1824106a5b45e862bf446
diff --git a/fpm/Makefile b/fpm/Makefile
index 933a142..14ef202 100644
--- a/fpm/Makefile
+++ b/fpm/Makefile
@@ -1,9 +1,9 @@
-VERSION=3.8.3
-WAR_VERSION=3.8.3
-BRANCH=stable-3.8
+VERSION=3.9.0
+WAR_VERSION=3.9.0-rc5
+BRANCH=stable-3.9
 URL=https://storage.googleapis.com/gerrit-releases/gerrit-$(WAR_VERSION).war
 CI_URL=https://gerrit-ci.gerritforge.com
-RELEASE=1
+RELEASE=0rc5
 
 NAME=gerrit
 CATEGORY=Development
diff --git a/fpm/scripts/before-install.sh b/fpm/scripts/before-install.sh
index 3a0d045..96cb67a 100755
--- a/fpm/scripts/before-install.sh
+++ b/fpm/scripts/before-install.sh
@@ -1,5 +1,6 @@
 LOG=/tmp/gerrit-installer.log
 [ ! -f $LOG ] || chmod a+rw $LOG
+echo "Using log file $LOG"
 
 GROUP_ID=$(/usr/bin/getent group $GROUP | cut -d ':' -f 3 2>> $LOG || true)
 if [ "$GROUP_ID" == "" ]
@@ -25,20 +26,24 @@
 JAVA_VERSION=$(java -version 2>&1)
 [ $? != 0 ] && echo -e "NOT FOUND\nPlease install Java 11 and try again" && exit 2
 
-VERSION=`expr "$JAVA_VERSION" : '.*"\(1[17]\..*\)["_]'`
+VERSION=`expr "$JAVA_VERSION" : '.*"\(17\..*\)["_]'`
 echo "$VERSION"
-test "$VERSION" "<" "11" && echo "ERROR: Java 11 or 17 required by Gerrit" && exit 3
+test "$VERSION" "<" "17" && echo "ERROR: Java 17 required by Gerrit" && exit 3
 
 # Script is invoked even before upgrade, we need to stop Gerrit if active
-if [ -e /etc/init.d/gerrit ]
+GERRIT_PID=$(ps -o pid,command -u $USER | grep gerrit | awk '{print $1}')
+if [ "$GERRIT_PID" != "" ]
 then
-  GERRIT_PID=$(ps -o pid,command -u $USER | grep gerrit | awk '{print $1}')
-  if [ "$GERRIT_PID" != "" ]
+  echo -n "Stopping Gerrit (pid=$GERRIT_PID) ... "
+  if [ -e /etc/init.d/gerrit ]
   then
-    echo -n "Stopping Gerrit (pid=$GERRIT_PID) ..."
     /etc/init.d/gerrit stop >> $LOG 2>> $LOG
     [ $? != 0 ] && echo "FAILED" && exit 1
     echo "DONE"
+  else
+    echo "Cannot locate init.d script for Gerrit" | tee -a $LOG
+    echo "Please stop Gerrit (pid=$GERRIT_PID) manually and try the installation again" | tee -a $LOG
+    echo "FAILED" && exit 1
   fi
 fi
 
diff --git a/macOS/Makefile b/macOS/Makefile
index c6202db..c9df0a3 100644
--- a/macOS/Makefile
+++ b/macOS/Makefile
@@ -1,4 +1,4 @@
-VERSION := 3.8.3
+VERSION := 3.9.0-rc5
 
 all: server