w10install/optional/install-seafile.cmd

71 lines
1.6 KiB
Batchfile
Raw Permalink Normal View History

2024-09-08 19:53:09 +02:00
@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b
set OPT=..\optional
set SOFTWARE=..\software
set MSI=seafile-setup.msi
set CUSTOM_SETTINGS=..\custom\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
)
echo ####### %0 #######
rem ===================
rem CONFIGFILE CHECK
rem ===================
echo.
echo searching for CUSTOM settings ...
if NOT EXIST %CUSTOM_SETTINGS% (
echo INFO: config file %CUSTOM_SETTINGS% NOT FOUND
) else (
echo OK. Loading CUSTOM settings ...
call %CUSTOM_SETTINGS%
)
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