w10install/optional/install-seafile.cmd
2022-12-23 20:35:22 +01:00

70 lines
1.4 KiB
Batchfile

@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b
set OPT=..\optional
set SOFTWARE=..\software
set MSI=seafile-setup.msi
set SETTINGS=..\company\settings.cmd
set seafile_server_url=0
set STARTMENU="%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs"
if NOT EXIST %SOFTWARE%\%MSI% (
echo ERROR: %SOFTWARE%\%MSI% not found!
exit /b
)
rem ===================
rem CONFIGFILE CHECK
rem ===================
if NOT EXIST %SETTINGS% (
echo.
echo WARNING: %SETTINGS% NOT FOUND
echo.
) else (
call %SETTINGS%
)
echo ####### %0 #######
echo installing SeaFile ...
cd %SOFTWARE%
@echo on
msiexec /i %MSI% /qn
@echo off
cd %OPT%
echo restarting explorer ...
taskkill /f /im explorer.exe 1>nul 2>nul
start explorer.exe
echo removing SeaFile Desktop icon ...
del /F "%Public%\Desktop\SeaFile.lnk" 2>nul
echo moving SeaFile startmenu shortcut ...
move /Y %STARTMENU%\"Seafile\Start Seafile.lnk" %STARTMENU%\SeaFile.lnk
echo removing SeaFile startmenu folder ...
rd /S /Q %STARTMENU%\"Seafile" 2>nul
echo refreshing desktop (W10 style) ...
ie4uinit.exe -show
if seafile_server_url == 0 (
echo no SeaFile server URL found!
) else (
echo setting SeaFile server URL ...
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\SeaFile" ^
/v "PreconfigureServerAddr" /d "%seafile_server_url%" /t REG_SZ /f 1>nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\SeaFile" ^
/v "PreconfigureServerAddrOnly" /d 1 /t REG_SZ /f 1>nul
)
echo ####### %0 #######
pause