[cpp-sp] 03/03: CPPSP-53 Replace Windows Installer with Bat and C program (for registry operations)
Codeberg
noreply at shibboleth.net
Wed Apr 15 13:37:27 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository cpp-sp.
View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/15f66e74dac9dc6aa2243e67f84b097b0eb065d5
commit 15f66e74dac9dc6aa2243e67f84b097b0eb065d5
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Apr 15 14:36:09 2026 +0100
CPPSP-53 Replace Windows Installer with Bat and C program (for registry operations)
https://shibboleth.atlassian.net/browse/CPPSP-53
All registry work now done. Uninstall (from program and features) now works
---
Projects/vc22/build.bat | 2 +-
WindowsInstall/doupdate.bat | 43 ++++++++++++++++++++++++-------------------
WindowsInstall/install.bat | 4 +---
WindowsInstall/uninstall.bat | 35 ++++++++++++++++++-----------------
4 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/Projects/vc22/build.bat b/Projects/vc22/build.bat
index 7ef3392f..6b879d98 100644
--- a/Projects/vc22/build.bat
+++ b/Projects/vc22/build.bat
@@ -54,11 +54,11 @@ copy ..\..\configs\agent.ini kit\dist\etc
copy ..\..\configs\handlers.ini kit\dist\etc
copy ..\..\configs\iis-config.ini kit\dist\etc
copy ..\..\configs\request-map.xml kit\dist\etc
-copy ..\..\WindowsInstall\shib.ico kit\dist
mkdir kit\dist\dist-bin\
copy ..\..\WindowsInstall\doupdate.bat kit\dist\dist-bin\
copy ..\..\WindowsInstall\regkeys.txt kit\dist\dist-bin\
copy ..\..\WindowsInstall\uninstall.bat kit\dist\dist-bin\
+copy ..\..\WindowsInstall\shib.ico kit\dist\dist-bin
tar -a -c -f kit.zip kit
diff --git a/WindowsInstall/doupdate.bat b/WindowsInstall/doupdate.bat
index df4a6588..2f232e50 100644
--- a/WindowsInstall/doupdate.bat
+++ b/WindowsInstall/doupdate.bat
@@ -5,10 +5,12 @@ setlocal
Rem Find FQP for target and root of installation
set SAVE_WORKING_DIR=%cd%
-cd %1%
+cd /d %1%
set TargetDir=%cd%
-cd /d %~dp0..
+cd /d %~dp0
+set SourceDir=%cd%
+cd ..
echo "Installing from %cd%"
Rem Grab version as string
@@ -37,6 +39,7 @@ robocopy /s /is /njs /njh . "%targetDir%\dist-%VersionString%"
echo Copying Batch Files to %targetdir%\bin\shibboleth-sp\
mkdir "%targetdir%\bin\shibboleth-sp\"
robocopy /is /njs /njh bin "%targetdir%\bin\shibboleth-sp"
+copy /y dist-bin\uninstall.bat "%targetdir%\bin"
echo Copying Dll Files to %targetdir%\lib\shibboleth-sp\
mkdir "%targetdir%\lib\shibboleth-sp\"
@@ -52,22 +55,24 @@ mkdir "%targetdir%\etc\shibboleth-sp\"
robocopy /xc /xn /xo /njs /njh etc "%targetdir%\etc\shibboleth-sp"
Rem Set registry
-echo "just add code to update registry"
-exit /b
-
-reg by hand
-
-[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730}]
-
-"DisplayIcon"="C:\\opt\\shibboleth-sp\\etc\\shibboleth-sp\\shib.ico,0"
-"InstallSource"="C:\\Users\\Administrator\\Desktop\\"
-"DisplayVersion"="4.0.0.0"
-"Version"=dword:04000000
-"VersionMinor"=dword:00000000
-"VersionMajor"=dword:00000004
-"UninstallString"="cmd /c pause"
-"InstallLocation"=""
-
-reg file called regkeys.txt
+Rem Firstly the "have I been installed" setting
+
+reg import dist-bin\regkeys.txt
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v DisplayIcon /t REG_SZ /d "%SourceDir%\shib.ico,0"
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v InstallSource /t REG_SZ /d "%SourceDir%"
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v Version /t REG_DWORD /d %Version%
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v DisplayVersion /t REG_SZ /d "%VersionString%"
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v VersionMinor /t REG_DWORD /d %MinorVersion%
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v InstallLocation /t REG_SZ /d "%TargetDir%"
+Rem note double quoting for "
+reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f /v UninstallString /t REG_SZ /d "cmd /c ""%targetdir%\bin\uninstall.bat"""
+Rem
+Rem now the event viewer
+Rem
+reg add "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Shibboleth\Shibboleth Service Provider" /f /v CategoryCount /t REG_DWORD /d 0
+reg add "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Shibboleth\Shibboleth Service Provider" /f /v TypesSupported /t REG_DWORD /d 7
+reg add "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Shibboleth\Shibboleth Service Provider" /f /v CategoryMessageFile /t REG_SZ /d "%TargetDir%\lib\shibboleth-sp\NTEventLogAppender.dll"
+reg add "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Shibboleth\Shibboleth Service Provider" /f /v EventMessageFile /t REG_SZ /d "%TargetDir%\lib\shibboleth-sp\NTEventLogAppender.dll"
+exit /b
diff --git a/WindowsInstall/install.bat b/WindowsInstall/install.bat
index d1a76737..f2270a8a 100644
--- a/WindowsInstall/install.bat
+++ b/WindowsInstall/install.bat
@@ -25,13 +25,11 @@ if exist "%TargetDir%\lib\shibboleth-sp" (
exit /b
)
-Rem Call generic "install/update" bar file shipped with this release
+Rem Call generic "install/update" bat file shipped with this release
mkdir "%targetDir%"
cmd /c dist\dist-bin\doupdate.bat "%targetDir%"
-Rem TODOODOTODO nativelogmessage into registry
-
Rem Detect IIS and configure if there
if exist %SYSTEMROOT%\System32\INETSRV\appcmd.exe (
diff --git a/WindowsInstall/uninstall.bat b/WindowsInstall/uninstall.bat
index 4a2ab7fe..66bdeeeb 100644
--- a/WindowsInstall/uninstall.bat
+++ b/WindowsInstall/uninstall.bat
@@ -2,29 +2,30 @@ setlocal
Rem
Rem File to uninstall the SP agent
Rem
+Rem This file is found in a non-standard location of an install
+Rem (/opt/shibboleth-sp/bin, as a peer to /opt/shibboleth-sp/bin/shibboleth-sp)
+Rem (so it doesn't delete itself). It is really only expected to
+Rem be run from the "uninstall" menu item of the apps and features
+Rem but it is idempotent so can be run any time.
-Rem Goto root of install - we are running from %targetDir%\dist-4.x.7\dist-bin\
-
-cd /d %1%
-set TargetDir=%cd%
-
-if not exist "%targetdir%\bin\shibboleth-sp" (
- echo "No installation found %targetdir%
- exit /b
-)
+cd /d %~dp0
if exist %SYSTEMROOT%\System32\INETSRV\appcmd.exe (
echo Uninstalling ShibAgent module from IIS
- %SYSTEMROOT%\System32\INETSRV\appcmd.exe delete module ShibAgent
- %SYSTEMROOT%\System32\INETSRV\appcmd.exe uninstall module ShibAgent
+ %SYSTEMROOT%\System32\INETSRV\appcmd.exe delete module ShibAgent 2> nul:
+ %SYSTEMROOT%\System32\INETSRV\appcmd.exe uninstall module ShibAgent 2> nul:
)
-echo Removing %TargetDir%\bin\shibboleth-sp\
-rd /s /q "%TargetDir%\bin\shibboleth-sp"
+echo "Removing bat files"
+rd /s /q shibboleth-sp
-echo Removing %TargetDir%\lib\shibboleth-sp\
-rd /s /q "%TargetDir%\lib\shibboleth-sp"
+cd ..\lib
+echo "Removing library files"
+rd /s /q shibboleth-sp
-echo Not touching %TargetDir%\etc\shibboleth-sp\
+Echo Not touching configuration files
-echo "just add code to remove [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730}]" and reg keys
+Rem remove from "installed apps & Features"
+reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9DA52E3-F96E-4C84-B153-C3B17C34F730} /f
+Rem and from logging
+reg delete HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Shibboleth\ShibbolethSPAgent /f
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list