[java-idp-plugin-jetty] 03/03: fff

Rod Widdowson rdw at steadingsoftware.com
Wed Aug 6 18:28:10 UTC 2025


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch dev/BatfileWIP
in repository java-idp-plugin-jetty.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-jetty.git;a=commit;h=925cadc69d1a993d815ef72ca4f8404cb277bff3

commit 925cadc69d1a993d815ef72ca4f8404cb277bff3
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Aug 6 19:27:17 2025 +0100

    fff
---
 .../shibboleth/idp/module/jetty/config-jetty.bat   | 64 ++++++++++++---
 .../shibboleth/idp/module/jetty/setjettybase.bat   | 90 ++++++++++++++++++----
 .../idp/module/jetty/setprocrunversion.bat         | 16 ++--
 3 files changed, 134 insertions(+), 36 deletions(-)

diff --git a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/config-jetty.bat b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/config-jetty.bat
index ef71581..cddbbc2 100644
--- a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/config-jetty.bat
+++ b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/config-jetty.bat
@@ -1,4 +1,8 @@
-REM @echo off
+ at echo off
+
+REM
+REM We do not want any environment changes we make to escape
+REM
 setlocal
 
 REM We need a JVM
@@ -12,7 +16,6 @@ set IDP_HOME_UNIX=%IDP_HOME_WINDOWS:\=/%
 set JETTY_TMP=%IDP_HOME_WINDOWS%\jetty-dist\jetty-tmp
 set PRUNSRV=%PROCRUN_HOME%\amd64\prunsrv.exe
 
-
 if not exist "%JAVA_HOME%\bin\server\jvm.dll" (
   echo Error: %JAVA_HOME%\bin\server\jvm.dll not found
   exit /b
@@ -28,7 +31,6 @@ if not exist "%JETTY_BASE%\start.d\idp.ini" (
   exit /b
 )
 
-
 if not exist "%PRUNSRV%" (
   echo Error: %PRUNSRV% not found
   exit /b
@@ -58,27 +60,67 @@ if NOT "%2" EQU "" (
    SET PR_SERVICEPASSWORD=%PASSWORD%
 ) else (
     SET USERNAME=LocalService
+    SET PR_SERVICEUSER=
+    SET PR_SERVICEPASSWORD=
 )
 
-REM We need to set a variable with %JETTY_HOME% in it
-SET PER_JETTY_HOME=%JETTY_HOME
-SET PER_JETTY_HOME=%PER_JETTY_HOME%%
-
-
 REM
 REM First up create and configure the procrun instance which will run jetty
 REM This is described in
 REM https://commons.apache.org/proper/commons-daemon/procrun.html
 REM And what is set comes from the jetty documentation
 REM
-SET PORTPASS=%random%-%random%-%random%-%random%
+REM We use use PR_xxx for parameters to keep things legible and to allow for spaces in paths.
+REM But before we do anything we need make sure there is nothing rogue in our environment.
+REM
+SET PR_DESCRIPTION=
+SET PR_DISPLAYNAME=
+SET PR_INSTALL=
+SET PR_STARTUP=
+SET PR_TYPE=
+SET PR_DEPENDSON=
+SET PR_ENVIRONMENT=
+SET PR_USER=
+SET PR_PASSWORD=
+SET PR_LIBRARYPATH=
+SET PR_JAVAHOME=
+SET PR_JVM=
+SET PR_JVMOPTIONS=
+SET PR_JVMOPTIONS9=
+SET PR_CLASSPATH=
+SET PR_JVMMS=
+SET PR_JVMMX=
+SET PR_JVMSS=
+SET PR_STARTMODE=
+SET PR_STARTIMAGE=
+SET PR_STARTPATH=
+SET PR_STARTCLASS=
+SET PR_STARTMETHOD=
+SET PR_STARTPARAMS=
+SET PR_STOPMODE=
+SET PR_STOPIMAGE=
+SET PR_STOPPATH=
+SET PR_STOPCLASS=
+SET PR_STOPMETHOD=
+SET PR_STOPPARAMS=
+SET PR_STOPTIMEOUT=
+SET PR_LOGPATH=
+SET PR_LOGPREFIX=
+SET PR_LOGLEVEL=
+SET PR_LOGJNIMESSAGES=
+SET PR_STDOUTPUT=
+SET PR_STDERROR=
+SET PR_PIDFILE=
 
 REM
-REM Use PR_xxx for parameters to keep things legible and to allow for spaces in paths
+REM Now set up the things we do want to set
 REM
+
+SET PORTPASS=%random%-%random%-%random%-%random%
+
 SET PR_DISPLAYNAME=Shibboleth IdP Daemon
 SET PR_DESCRIPTION=Runs the Jetty Container
-SET PR_CLASSPATH=%PER_JETTY_HOME%\start.jar
+SET PR_CLASSPATH=%%JETTY_HOME%%\start.jar
 SET PR_JVMOPTIONS=-Didp.home=%IDP_HOME_UNIX%;-Djdk.tls.ephemeralDHKeySize=2048;-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog;-Djava.io.tmpdir=%JETTY_TMP%;-Dlogback.configurationFile=%JETTY_BASE%\resources\logback.xml;-XX:+UseG1GC
 SET PR_JVMMX=2048
 SET PR_JVM=auto
diff --git a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setjettybase.bat b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setjettybase.bat
index 78c01b9..f16bf44 100644
--- a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setjettybase.bat
+++ b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setjettybase.bat
@@ -1,4 +1,4 @@
-rem @echo off
+REM @echo off
 
 set IDP_HOME_WINDOWS=%~dp0..
 if not exist %IDP_HOME_WINDOWS%\jetty-base-%1% (
@@ -6,36 +6,92 @@ if not exist %IDP_HOME_WINDOWS%\jetty-base-%1% (
    exit /b
 )
 
-set IDP_HOME_UNIX=%IDP_HOME_WINDOWS:\=/%
-set JETTY_TMP=%IDP_HOME_WINDOWS%\jetty-dist\jetty-tmp
-set PRUNSRV=%PROCRUN_HOME%\amd64\prunsrv.exe
 set JETTY_BASE=%IDP_HOME_WINDOWS%\jetty-base-%1%
 setx /m JETTY_BASE %JETTY_BASE%
 echo JETTY_BASE set to be %JETTY_BASE%
 
-sc qc shibd_idp >nl:
+sc qc shibd_idp > nul 2>&1
 
-REM below reads if error level > 0 then ....
-if errorlevel 0 (
-(
+REM below reads if error level > 1 then ....
+if errorlevel 1 (
    echo Procrun not installed, skipping further configuration
    exit /b
 )
 
+REM
+REM we do no wantany of these variables polluting the environment
+REM
 setlocal
+set IDP_HOME_UNIX=%IDP_HOME_WINDOWS:\=/%
+set JETTY_TMP=%IDP_HOME_WINDOWS%\jetty-dist\jetty-tmp
+set PRUNSRV=%PROCRUN_HOME%\amd64\prunsrv.exe
 
-SET PORTPASS=%random%-%random%-%random%-%random%
-
-SET PR_JVMOPTIONS=-Didp.home=%IDP_HOME_UNIX%;-Djdk.tls.ephemeralDHKeySize=2048;-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog;-Djava.io.tmpdir=%JETTY_TMP%;-Dlogback.configurationFile=%JETTY_BASE%\resources\logback.xml;-XX:+UseG1GC
+REM
+REM As per config-jetty we will set the shibd_idp parameters according to 
+REM https://commons.apache.org/proper/commons-daemon/procrun.html
+REM
+REM Annoyingly, the PR_xxx trick always appends so we run //US twice
+REM once to set the first parameter via the --Option thing
+REM and a second time to append the rest of the stuff.
+REM
+REM Make sure there are no parameters set (otherwise they will be appended
+REM to our exiting settings.
+REM
+SET PR_DESCRIPTION=
+SET PR_DISPLAYNAME=
+SET PR_INSTALL=
+SET PR_STARTUP=
+SET PR_TYPE=
+SET PR_DEPENDSON=
+SET PR_ENVIRONMENT=
+SET PR_USER=
+SET PR_PASSWORD=
+SET PR_SERVICEUSER=
+SET PR_SERVICEPASSWORD=
+SET PR_LIBRARYPATH=
+SET PR_JAVAHOME=
+SET PR_JVM=
+SET PR_JVMOPTIONS=
+SET PR_JVMOPTIONS9=
+SET PR_CLASSPATH=
+SET PR_JVMMS=
+SET PR_JVMMX=
+SET PR_JVMSS=
+SET PR_STARTMODE=
+SET PR_STARTIMAGE=
+SET PR_STARTPATH=
+SET PR_STARTCLASS=
+SET PR_STARTMETHOD=
+SET PR_STARTPARAMS=
+SET PR_STOPMODE=
+SET PR_STOPIMAGE=
+SET PR_STOPPATH=
+SET PR_STOPCLASS=
+SET PR_STOPMETHOD=
+SET PR_STOPPARAMS=
+SET PR_STOPTIMEOUT=
+SET PR_LOGPATH=
+SET PR_LOGPREFIX=
+SET PR_LOGLEVEL=
+SET PR_LOGJNIMESSAGES=
+SET PR_STDOUTPUT=
+SET PR_STDERROR=
+SET PR_PIDFILE=
 
-SET PR_STARTMODE=JVM
-SET PR_STARTCLASS=org.eclipse.jetty.start.Main
-SET PR_STARTPARAMS=STOP_PORT=8963;STOP.KEY=%PORTPASS%;jetty.base=%JETTY_BASE%;jetty.logging.dir=%IDP_HOME_WINDOWS%\logs
+REM
+REM Force a reser if the three things we want to change
+REM
+%PRUNSRV%  //US/Shibd_idp --JvmOptions=-Didp.home=%IDP_HOME_UNIX% --StartParams=STOP_PORT=8963 --StopParams=--stop;STOP_PORT=8963
 
-SET PR_STOPMODE=JVM
-SET PR_STOPCLASS=org.eclipse.jetty.start.Main
-SET PR_STOPPARAMS=--stop;%PR_STARTPARAMS%
+REM
+REM And set up the rest to be appended
+REM
+SET PORTPASS=%random%-%random%-%random%-%random%
+SET PR_JVMOPTIONS=-Djdk.tls.ephemeralDHKeySize=2048;-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog;-Djava.io.tmpdir=%JETTY_TMP%;-Dlogback.configurationFile=%JETTY_BASE%\resources\logback.xml;-XX:+UseG1GC
+SET PR_STARTPARAMS=STOP.KEY=%PORTPASS%;jetty.base=%JETTY_BASE%;jetty.logging.dir=%IDP_HOME_WINDOWS%\logs
+SET PR_STOPPARAMS=%PR_STARTPARAMS%
 
 %PRUNSRV%  //US/Shibd_idp
 
 echo Restart shibd_idp to start using this version
+
diff --git a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setprocrunversion.bat b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setprocrunversion.bat
index 24445e0..f9abc14 100644
--- a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setprocrunversion.bat
+++ b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/setprocrunversion.bat
@@ -9,16 +9,16 @@ if not exist %IDP_HOME_WINDOWS%\jetty-dist\commons-daemon-%1% (
 set PROCRUN_HOME=%IDP_HOME_WINDOWS%\jetty-dist\commons-daemon-%1%
 setx /m PROCRUN_HOME %PROCRUN_HOME%
 
-echo "PROCRUN_HOME set to be %PROCRUN_HOME%"
+echo PROCRUN_HOME set to be %PROCRUN_HOME%
 
-sc qc shibd_idp > nl:
+sc qc shibd_idp > nul 2>&1
 
-if NOT ERRORLEVEL 0 (
-       
-   sc config shibd_idp binpath="%procrun_home%amd64\prunsrv.exe //RS//Shibd_idp
-   echo Restart shibd_idp to start using this version"
-)  else (
-echo NOTE shibd_idp service has not been configured yet
+if ERRORLEVEL 1 (
+   echo NOTE shibd_idp service has not been configured yet
+   exit /b
 )
 
+sc config shibd_idp binpath="%procrun_home%\amd64\prunsrv.exe //RS//Shibd_idp
+echo Restart shibd_idp to start using this version"
+
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list