-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.cmd
76 lines (61 loc) · 2.22 KB
/
install.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@echo off
SETLOCAL
goto init
:getvariables
REM if we have a directory passed in then we can look at copying the files to the programfiles directory
IF "%~1"=="" (
echo no parameters passed
Exit /b
)
REM getting source dir
set tmp_dir="%~1"
REM set destination dir
set destination_dir=%LOCALAPPDATA%\StreamRoller\
REM change to the tmp directory so we can read files and stuff
cd %tmp_dir%
REM get softwareversion from the local file
set /p SoftwareVersion=< SoftwareVersion.txt
Exit /b
:createshortcut
echo "%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\StreamRoller.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%destination_dir%\run.cmd" >> %SCRIPT%
echo oLink.WorkingDirectory = "%destination_dir%" >> %SCRIPT%
echo oLink.IconLocation = "%destination_dir%backend\data_center\public\favicon.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
exit /b
:init
REM unset any varibles we may have set (ie if someone exited the previous run half way though)
set tmp_dir=""
set destination_dir=""
set SoftwareVersion=""
call :getvariables %*
if %tmp_dir%=="" (
echo Couldn't set temp directory
Exit /b
)
if %destination_dir%=="" (
echo Couldn't set destination directory
Exit /b
)
echo [33mInstalling StreamRoller %SoftwareVersion%%[0m
echo Deleting previous version
rmdir /s /q %destination_dir%
if not exist %destination_dir% mkdir %destination_dir%
REM move to the new directory
cd %destination_dir%
echo Installing new version
xcopy %tmp_dir%\*.* %destination_dir% /e /c /i /q /h /r /y
echo Creating desktop shortcut
call :createshortcut
REM we need to pass in the temp dir so we can delete it once running (when we are not running a script in it :D)
echo running the software
run.cmd -d %tmp_dir% >> log.txt
:end
echo "Finished2"
ENDLOCAL