Migrate installer to Apollo

This commit is contained in:
Yukino Song
2024-08-23 00:55:56 +08:00
parent 88a3cfd7a5
commit 8bbd64f025
15 changed files with 79 additions and 27 deletions

View File

@@ -2,14 +2,14 @@
# common cpack options # common cpack options
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "LizardByte") set(CPACK_PACKAGE_VENDOR "SudoMaker")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpack_artifacts) set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpack_artifacts)
set(CPACK_PACKAGE_CONTACT "https://app.lizardbyte.dev") set(CPACK_PACKAGE_CONTACT "https://www.sudomaker.com")
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_HOMEPAGE_URL ${CMAKE_PROJECT_HOMEPAGE_URL}) set(CPACK_PACKAGE_HOMEPAGE_URL ${CMAKE_PROJECT_HOMEPAGE_URL})
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE) set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/sunshine.png) set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/apollo.png)
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_STRIP_FILES YES) set(CPACK_STRIP_FILES YES)

View File

@@ -14,6 +14,11 @@ install(TARGETS audio-info RUNTIME DESTINATION "tools" COMPONENT audio)
install(TARGETS ddprobe RUNTIME DESTINATION "tools" COMPONENT application) install(TARGETS ddprobe RUNTIME DESTINATION "tools" COMPONENT application)
install(TARGETS sunshinesvc RUNTIME DESTINATION "tools" COMPONENT application) install(TARGETS sunshinesvc RUNTIME DESTINATION "tools" COMPONENT application)
# Drivers
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/drivers/sudovda"
DESTINATION "drivers"
COMPONENT sudovda)
# Mandatory scripts # Mandatory scripts
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/service/" install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/service/"
DESTINATION "scripts" DESTINATION "scripts"
@@ -62,8 +67,9 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
IfSilent +2 0 IfSilent +2 0
ExecShell 'open' 'https://sunshinestream.readthedocs.io/' # ExecShell 'open' 'https://sunshinestream.readthedocs.io/'
nsExec::ExecToLog 'icacls \\\"$INSTDIR\\\" /reset' nsExec::ExecToLog 'icacls \\\"$INSTDIR\\\" /reset'
nsExec::ExecToLog '\\\"$INSTDIR\\\\drivers\\\\sudovda\\\\install.bat\\\"'
nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\migrate-config.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\migrate-config.bat\\\"'
nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\add-firewall-rule.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\add-firewall-rule.bat\\\"'
nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\install-gamepad.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\install-gamepad.bat\\\"'
@@ -80,10 +86,15 @@ set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-service.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-service.bat\\\"'
nsExec::ExecToLog '\\\"$INSTDIR\\\\sunshine.exe\\\" --restore-nvprefs-undo' nsExec::ExecToLog '\\\"$INSTDIR\\\\sunshine.exe\\\" --restore-nvprefs-undo'
MessageBox MB_YESNO|MB_ICONQUESTION \ MessageBox MB_YESNO|MB_ICONQUESTION \
'Do you want to remove Virtual Gamepad)?' \ 'Do you want to remove Virtual Gamepad?' \
/SD IDNO IDNO NoGamepad /SD IDNO IDNO NoGamepad
nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-gamepad.bat\\\"'; skipped if no nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-gamepad.bat\\\"'; skipped if no
NoGamepad: NoGamepad:
MessageBox MB_YESNO|MB_ICONQUESTION \
'Do you want to remove SudoVDA Virtual Display Driver?' \
/SD IDNO IDNO NoSudoVDA
nsExec::ExecToLog '\\\"$INSTDIR\\\\drivers\\\\sudovda\\\\uninstall.bat\\\"'; skipped if no
NoSudoVDA:
MessageBox MB_YESNO|MB_ICONQUESTION \ MessageBox MB_YESNO|MB_ICONQUESTION \
'Do you want to remove $INSTDIR (this includes the configuration, cover images, and settings)?' \ 'Do you want to remove $INSTDIR (this includes the configuration, cover images, and settings)?' \
/SD IDNO IDNO NoDelete /SD IDNO IDNO NoDelete
@@ -95,11 +106,11 @@ set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
set(CPACK_NSIS_MODIFY_PATH "OFF") set(CPACK_NSIS_MODIFY_PATH "OFF")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# This will be shown on the installed apps Windows settings # This will be shown on the installed apps Windows settings
set(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME}.exe") set(CPACK_NSIS_INSTALLED_ICON_NAME "sunshine.exe")
set(CPACK_NSIS_CREATE_ICONS_EXTRA set(CPACK_NSIS_CREATE_ICONS_EXTRA
"${CPACK_NSIS_CREATE_ICONS_EXTRA} "${CPACK_NSIS_CREATE_ICONS_EXTRA}
CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${CMAKE_PROJECT_NAME}.lnk' \ CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${CMAKE_PROJECT_NAME}.lnk' \
'\$INSTDIR\\\\${CMAKE_PROJECT_NAME}.exe' '--shortcut' '\$INSTDIR\\\\sunshine.exe' '--shortcut'
") ")
set(CPACK_NSIS_DELETE_ICONS_EXTRA set(CPACK_NSIS_DELETE_ICONS_EXTRA
"${CPACK_NSIS_DELETE_ICONS_EXTRA} "${CPACK_NSIS_DELETE_ICONS_EXTRA}
@@ -109,14 +120,14 @@ set(CPACK_NSIS_DELETE_ICONS_EXTRA
# Checking for previous installed versions # Checking for previous installed versions
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
set(CPACK_NSIS_HELP_LINK "https://sunshinestream.readthedocs.io/en/latest/about/installation.html") # set(CPACK_NSIS_HELP_LINK "https://sunshinestream.readthedocs.io/en/latest/about/installation.html")
set(CPACK_NSIS_URL_INFO_ABOUT "${CMAKE_PROJECT_HOMEPAGE_URL}") # set(CPACK_NSIS_URL_INFO_ABOUT "${CMAKE_PROJECT_HOMEPAGE_URL}")
set(CPACK_NSIS_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL}/support") # set(CPACK_NSIS_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL}/support")
set(CPACK_NSIS_MENU_LINKS # set(CPACK_NSIS_MENU_LINKS
"https://sunshinestream.readthedocs.io" "Sunshine documentation" # "https://sunshinestream.readthedocs.io" "Sunshine documentation"
"https://app.lizardbyte.dev" "LizardByte Web Site" # "https://app.lizardbyte.dev" "LizardByte Web Site"
"https://app.lizardbyte.dev/support" "LizardByte Support") # "https://app.lizardbyte.dev/support" "LizardByte Support")
set(CPACK_NSIS_MANIFEST_DPI_AWARE true) set(CPACK_NSIS_MANIFEST_DPI_AWARE true)
# Setting components groups and dependencies # Setting components groups and dependencies
@@ -131,7 +142,7 @@ set(CPACK_COMPONENT_APPLICATION_DEPENDS assets)
# service auto-start script # service auto-start script
set(CPACK_COMPONENT_AUTOSTART_DISPLAY_NAME "Launch on Startup") set(CPACK_COMPONENT_AUTOSTART_DISPLAY_NAME "Launch on Startup")
set(CPACK_COMPONENT_AUTOSTART_DESCRIPTION "If enabled, launches Sunshine automatically on system startup.") set(CPACK_COMPONENT_AUTOSTART_DESCRIPTION "If enabled, launches Apollo automatically on system startup.")
set(CPACK_COMPONENT_AUTOSTART_GROUP "Core") set(CPACK_COMPONENT_AUTOSTART_GROUP "Core")
# assets # assets
@@ -140,6 +151,12 @@ set(CPACK_COMPONENT_ASSETS_DESCRIPTION "Shaders, default box art, and web UI.")
set(CPACK_COMPONENT_ASSETS_GROUP "Core") set(CPACK_COMPONENT_ASSETS_GROUP "Core")
set(CPACK_COMPONENT_ASSETS_REQUIRED true) set(CPACK_COMPONENT_ASSETS_REQUIRED true)
# drivers
set(CPACK_COMPONENT_SUDOVDA_DISPLAY_NAME "SudoVDA")
set(CPACK_COMPONENT_SUDOVDA_DESCRIPTION "Driver required for Virtual Display to function.")
set(CPACK_COMPONENT_SUDOVDA_GROUP "Drivers")
set(CPACK_COMPONENT_SUDOVDA_REQUIRED true)
# audio tool # audio tool
set(CPACK_COMPONENT_AUDIO_DISPLAY_NAME "audio-info") set(CPACK_COMPONENT_AUDIO_DISPLAY_NAME "audio-info")
set(CPACK_COMPONENT_AUDIO_DESCRIPTION "CLI tool providing information about sound devices.") set(CPACK_COMPONENT_AUDIO_DESCRIPTION "CLI tool providing information about sound devices.")

View File

@@ -140,7 +140,7 @@ namespace service_ctrl {
return; return;
} }
service_handle = OpenServiceA(scm_handle, "SunshineService", service_desired_access); service_handle = OpenServiceA(scm_handle, "ApolloService", service_desired_access);
if (!service_handle) { if (!service_handle) {
auto winerr = GetLastError(); auto winerr = GetLastError();
BOOST_LOG(error) << "OpenService() failed: "sv << winerr; BOOST_LOG(error) << "OpenService() failed: "sv << winerr;

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,25 @@
@echo off
pushd %~dp0
echo ================
echo Installing cert for the SudoVDA driver...
certutil -addstore -f root "code_signing.crt"
certutil -addstore -f TrustedPublisher "code_signing.crt"
echo ================
echo Removing the old driver... It's OK to show an error if you're installing the driver for the first time.
nefconc.exe --remove-device-node --hardware-id root\sudomaker\sudovda --class-guid "4D36E968-E325-11CE-BFC1-08002BE10318"
echo ================
echo Installing the new driver...
nefconc.exe --create-device-node --class-name Display --class-guid "4D36E968-E325-11CE-BFC1-08002BE10318" --hardware-id root\sudomaker\sudovda
nefconc.exe --install-driver --inf-path "SudoVDA.inf"
echo ================
echo Done!
popd

Binary file not shown.

View File

@@ -0,0 +1,9 @@
@echo off
pushd %~dp0
nefconc.exe --remove-device-node --hardware-id root\sudomaker\sudovda --class-guid "4D36E968-E325-11CE-BFC1-08002BE10318"
popd
pause

View File

@@ -1,4 +1,4 @@
@echo off @echo off
rem Set the service to auto-start rem Set the service to auto-start
sc config SunshineService start= auto sc config ApolloService start= auto

View File

@@ -3,7 +3,7 @@
rem Get sunshine root directory rem Get sunshine root directory
for %%I in ("%~dp0\..") do set "ROOT_DIR=%%~fI" for %%I in ("%~dp0\..") do set "ROOT_DIR=%%~fI"
set RULE_NAME=Sunshine set RULE_NAME=Apollo
set PROGRAM_BIN="%ROOT_DIR%\sunshine.exe" set PROGRAM_BIN="%ROOT_DIR%\sunshine.exe"
rem Add the rule rem Add the rule

View File

@@ -1,6 +1,6 @@
@echo off @echo off
set RULE_NAME=Sunshine set RULE_NAME=Apollo
rem Delete the rule rem Delete the rule
netsh advfirewall firewall delete rule name=%RULE_NAME% netsh advfirewall firewall delete rule name=%RULE_NAME%

View File

@@ -3,7 +3,7 @@
rem Get sunshine root directory rem Get sunshine root directory
for %%I in ("%~dp0\..") do set "ROOT_DIR=%%~fI" for %%I in ("%~dp0\..") do set "ROOT_DIR=%%~fI"
set SERVICE_NAME=SunshineService set SERVICE_NAME=ApolloService
set SERVICE_BIN="%ROOT_DIR%\tools\sunshinesvc.exe" set SERVICE_BIN="%ROOT_DIR%\tools\sunshinesvc.exe"
rem Set service to demand start. It will be changed to auto later if the user selected that option. rem Set service to demand start. It will be changed to auto later if the user selected that option.
@@ -13,7 +13,7 @@ rem Remove the legacy SunshineSvc service
net stop sunshinesvc net stop sunshinesvc
sc delete sunshinesvc sc delete sunshinesvc
rem Check if SunshineService already exists rem Check if ApolloService already exists
sc qc %SERVICE_NAME% > nul 2>&1 sc qc %SERVICE_NAME% > nul 2>&1
if %ERRORLEVEL%==0 ( if %ERRORLEVEL%==0 (
rem Stop the existing service if running rem Stop the existing service if running
@@ -27,10 +27,10 @@ if %ERRORLEVEL%==0 (
) )
rem Run the sc command to create/reconfigure the service rem Run the sc command to create/reconfigure the service
sc %SC_CMD% %SERVICE_NAME% binPath= %SERVICE_BIN% start= %SERVICE_START_TYPE% DisplayName= "Sunshine Service" sc %SC_CMD% %SERVICE_NAME% binPath= %SERVICE_BIN% start= %SERVICE_START_TYPE% DisplayName= "Apollo Service"
rem Set the description of the service rem Set the description of the service
sc description %SERVICE_NAME% "Sunshine is a self-hosted game stream host for Moonlight." sc description %SERVICE_NAME% "Apollo is a self-hosted game stream host for Moonlight."
rem Start the new service rem Start the new service
net start %SERVICE_NAME% net start %SERVICE_NAME%

View File

@@ -4,6 +4,6 @@ rem Stop and delete the legacy SunshineSvc service
net stop sunshinesvc net stop sunshinesvc
sc delete sunshinesvc sc delete sunshinesvc
rem Stop and delete the new SunshineService service rem Stop and delete the new ApolloService service
net stop SunshineService net stop ApolloService
sc delete SunshineService sc delete ApolloService

View File

@@ -18,7 +18,7 @@ SERVICE_STATUS service_status;
HANDLE stop_event; HANDLE stop_event;
HANDLE session_change_event; HANDLE session_change_event;
#define SERVICE_NAME "SunshineService" #define SERVICE_NAME "ApolloService"
DWORD WINAPI DWORD WINAPI
HandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) { HandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) {

View File

@@ -43,6 +43,7 @@ export default defineConfig({
root: resolve(assetsSrcPath), root: resolve(assetsSrcPath),
build: { build: {
outDir: resolve(assetsDstPath), outDir: resolve(assetsDstPath),
emptyOutDir: true,
rollupOptions: { rollupOptions: {
input: { input: {
apps: resolve(assetsSrcPath, 'apps.html'), apps: resolve(assetsSrcPath, 'apps.html'),