commit acbdbccb4633debeacf5f264fc6de075e8f99bc9
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 18 Apr 2025 02:12:24 +0530
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 18 Apr 2025 02:12:24 +0530
Brave New World
6 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/.gitattributes b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=crlf
diff --git a/README b/README @@ -0,0 +1,9 @@ +coop +==== + +coop is scoop but written in cmd instead of powershell. + +scoop manifest files can be directly used with coop. + +chocolatey manifests can also be used with coop. +
diff --git a/install-service.bat b/install-service.bat @@ -0,0 +1,26 @@ +@echo off +set SERVICE_NAME=mpd +set SERVICE_ARGS=C:\Users\Administrator\.config\mpd\mpd.conf +where /q srvany-ng +if ERRORLEVEL 1 ( + echo ERROR: srvany-ng does not exist in path + exit /b +) +where /q %SERVICE_NAME% +if ERRORLEVEL 1 ( + echo ERROR: %SERVICE_NAME% does not name a service + exit /b +) +echo "%~dp0srvany-ng.exe" +sc create mpd start= auto binPath= "%~dp0srvany-ng.exe" +if ERRORLEVEL 1 ( + :: echo "ERROR: Unable to create service" + :: exit /b + echo %SERVICE_NAME% already exists, old entry will be deleted, are you sure? [Y/n]: Y + sc delete mpd + sc create mpd start= auto binPath= "%~dp0srvany-ng.exe" +) + +reg add HKLM\SYSTEM\CurrentControlSet\Services\%SERVICE_NAME%\Parameters /v Application /f /d "%~dp0%SERVICE_NAME%.exe" +reg add HKLM\SYSTEM\CurrentControlSet\Services\%SERVICE_NAME%\Parameters /v AppDirectory /f /d "%~dp0." +reg add HKLM\SYSTEM\CurrentControlSet\Services\%SERVICE_NAME%\Parameters /v AppParameters /f /d "%SERVICE_ARGS%"
diff --git a/install-service.ps1 b/install-service.ps1 @@ -0,0 +1,29 @@ +$SERVICE_NAME='mpd' +$SERVICE_ARGS='C:\Users\Administrator\.config\mpd\mpd.conf' +$SrvAnyNgBinPath=$(Get-Command -Name srvany-ng -ErrorAction Ignore).Source +$exists=$? +if (-Not $exists ) { + echo "ERROR: srvany-ng does not exist in path" + exit +} +$ServiceBinPath=$(Get-Command -Name $SERVICE_NAME -ErrorAction Ignore).Source +$exists=$? +if (-Not $exists ) { + echo "ERROR: $SERVICE_NAME does not name a service" + return -1 +} +sc.exe create $SERVICE_NAME start= auto binPath= "$SrvAnyNgBinPath" +$NotError=$? +if (-Not $NotError) { + # echo "ERROR: Unable to create service" + # exit /b + echo "$SERVICE_NAME already exists, old entry will be deleted, are you sure? [Y/n]: Y" + sc.exe config $SERVICE_NAME start= auto binPath= "$SrvAnyNgBinPath" +} + +# TODO if ServiceBinPath is null exit this, possibly rollback + +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name Application -Value "$ServiceBinPath" +# TODO Use proper AppDir +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name AppDirectory -Value "$Env:Scoop\shims" +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name AppParameters -Value "$SERVICE_ARGS"
diff --git a/uninstall-service.ps1 b/uninstall-service.ps1 @@ -0,0 +1,29 @@ +$SERVICE_NAME='mpd' +$SERVICE_ARGS='C:\Users\Administrator\.config\mpd\mpd.conf' +$SrvAnyNgBinPath=$(Get-Command -Name srvany-ng -ErrorAction Ignore).Source +$exists=$? +if (-Not $exists ) { + echo "ERROR: srvany-ng does not exist in path" + exit +} +$ServiceBinPath=$(Get-Command -Name $SERVICE_NAME -ErrorAction Ignore).Source +$exists=$? +if (-Not $exists ) { + echo "ERROR: $SERVICE_NAME does not name a service" + return -1 +} +sc.exe create $SERVICE_NAME start= auto binPath= "$SrvAnyNgBinPath" +$NotError=$? +if (-Not $NotError) { + # echo "ERROR: Unable to create service" + # exit /b + echo "$SERVICE_NAME already exists, old entry will be deleted, are you sure? [Y/n]: Y" + sc.exe config $SERVICE_NAME start= auto binPath= "$SrvAnyNgBinPath" +} + +# TODO if ServiceBinPath is null exit this, possibly rollback + +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name Application -Value "$ServiceBinPath" +# TODO Use proper AppDir +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name AppDirectory -Value "$Env:Scoop\shims" +Set-ItemProperty -Path Registry::HKLM\SYSTEM\CurrentControlSet\Services\$SERVICE_NAME\Parameters -Name AppParameters -Value "$SERVICE_ARGS"