Commit 60de3530 by Csók Tamás

Installation and uninstall logs are added

parent cf9dd786
......@@ -4,24 +4,29 @@ setLocal EnableDelayedExpansion
rem Get the running directory for later ease of use
SET running_directory=%~dp0
rem Set where this file will install the rest of the files
SET "install_location=%APPDATA%\CIRCLE"
rem Set whether we want output info on screen or not
IF NOT "%1"=="" (
SET "output_on_screen=%1"
SET "location=%1"
SET install_location=!location:"=!
) else (
SET "output_on_screen=False"
SET "install_location=%APPDATA%\CIRCLE"
)
rem Set whether we want to install selenium or not
rem Set whether we want output info on screen or not
IF NOT "%2"=="" (
SET "install_selenium=%2"
SET "output_on_screen=%2"
) else (
SET "output_on_screen=True"
)
rem Set whether we want to install selenium or not
IF NOT "%3"=="" (
SET "install_selenium=%3"
) else (
SET "install_selenium=False"
)
rem Set which website should the icon point to
SET "site=^"http://cloud.bme.hu/^""
IF NOT "%3"=="" (
IF NOT "%4"=="" (
IF "%install_selenium%"=="False" (
SET site=%3
SET site=%4
SET my_site=!site:"=!
SET "website= -t ^"!my_site!^""
)
......@@ -36,7 +41,10 @@ REM --> Check for permissions
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
IF NOT "!output_on_screen!"=="False" (
@echo Requesting administrative privileges...>CON
)
@echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
......@@ -53,15 +61,18 @@ if '%errorlevel%' NEQ '0' (
pushd "%CD%"
CD /D "%~dp0"
IF NOT "!output_on_screen!"=="False" (
@echo Elevated rights recived from UAC
@echo Elevated rights recived from UAC>CON
)
@echo Elevated rights recived from UAC
:--------------------------------------
rem Start the installation script
IF NOT "!output_on_screen!"=="False" (
@echo Starting CIRCLE Client install script
@echo.
@echo Starting CIRCLE Client install script>CON
@echo.>CON
)
@echo Starting CIRCLE Client install script
@echo.
call :SUB_ARCHITECTURE architecture
:PYTHON_CHECK_MODULE
......@@ -95,19 +106,22 @@ GOTO NOPYTHON
rem No 2.6+ Python is installed
:NOPYTHON
IF NOT "!output_on_screen!"=="False" (
@echo No 2.6^+ Python is detected on the system.
@echo No 2.6^+ Python is detected on the system.>CON
)
@echo No 2.6^+ Python is detected on the system.
if "!architecture!"=="64" (
IF NOT "!output_on_screen!"=="False" (
@echo 64 bit system detected, commencing the install
@echo 64 bit system detected, commencing the install>CON
)
@echo 64 bit system detected, commencing the install
start "Phyton Installer" /WAIT ^"%running_directory%x64^\python-2.7.7.amd64.msi^"
GOTO NOWHASPYTHON
)
if "!architecture!"=="32" (
IF NOT "!output_on_screen!"=="False" (
@echo 32 bit system detected, commencing the install
@echo 32 bit system detected, commencing the install>CON
)
@echo 32 bit system detected, commencing the install
start "Phyton Installer" /WAIT ^"%running_directory%x86^\python-2.7.7.msi^"
GOTO NOWHASPYTHON
)
......@@ -133,26 +147,31 @@ IF NOT "!output_on_screen!"=="False" (
rem Error within the installation
:ERR
IF NOT "!output_on_screen!"=="False" (
@echo Unsupported architecture! Please install files manually
@echo Please visit: https://www.python.org/downloads/
@echo Please visit: http://www.mozilla.org/en/firefox/new/
@echo Unsupported architecture! Please install files manually>CON
@echo Please visit: https://www.python.org/downloads/>CON
@echo Please visit: http://www.mozilla.org/en/firefox/new/>CON
pause
)
@echo Unsupported architecture! Please install files manually 1>&2
@echo Please visit: https://www.python.org/downloads/ 1>&2
@echo Please visit: http://www.mozilla.org/en/firefox/new/ 1>&2
GOTO END
rem The install program closed. Check whether the Python installation was successful
:NOWHASPYTHON
SET version=2.7
IF NOT "!output_on_screen!"=="False" (
@echo Python install finished, rechecking registry
@echo Python install finished, rechecking registry>CON
)
@echo Python install finished, rechecking registry
GOTO PYTHON_CHECK_MODULE
rem We have Python but let's check if it's in the PATH
:HASPYTHON
IF NOT "!output_on_screen!"=="False" (
@echo %version% Python is found, checking PATH variable
@echo %version% Python is found, checking PATH variable>CON
)
@echo %version% Python is found, checking PATH variable
rem Check Python install path
set install_path=
for /f "tokens=2,*" %%a in ('reg query "hklm\SOFTWARE\%python_registry%Python\PythonCore\%version%\InstallPath"') do (
......@@ -161,58 +180,66 @@ IF NOT "!output_on_screen!"=="False" (
rem Check whether python.exe is in the install path (python uninstall doesn't delete registry entrys)
if NOT EXIST "%install_path%python.exe" (
IF NOT "!output_on_screen!"=="False" (
@echo %version% Python was installed but it is NOT now. Restarting the search for python^^!
@echo %version% Python was installed but it is NOT now. Restarting the search for python^^!>CON
)
@echo %version% Python was installed but it is NOT now. Restarting the search for python^^!
goto loop
) else (
set test=%install_path:~0,-1%
call ^"%running_directory%inPath^" ^"test^" && (IF NOT "!output_on_screen!"=="False" (@echo !test! is already in PATH)) || (call ^"%running_directory%addPath^" ^"test^" & setx>nul PATH "%PATH%;!test!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !test! set to PATH))
call ^"%running_directory%inPath^" ^"test^" && (IF NOT "!output_on_screen!"=="False" (@echo !test! is already in PATH>CON) && @echo !test! is already in PATH) || (call ^"%running_directory%addPath^" ^"test^" & setx>nul PATH "%PATH%;!test!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !test! set to PATH>CON) && @echo !test! set to PATH)
set test=%install_path%Scripts
call ^"%running_directory%inPath^" ^"test^" && (IF NOT "!output_on_screen!"=="False" (@echo !test! is already in PATH)) || (call ^"%running_directory%addPath^" ^"test^" & setx>nul PATH "%PATH%;!test!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !test! set to PATH))
call ^"%running_directory%inPath^" ^"test^" && (IF NOT "!output_on_screen!"=="False" (@echo !test! is already in PATH>CON) && @echo !test! is already in PATH) || (call ^"%running_directory%addPath^" ^"test^" & setx>nul PATH "%PATH%;!test!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !test! set to PATH>CON) && @echo !test! set to PATH)
)
GOTO PIP_INSTALL
:INSTALL_EASY_INSTALL
IF NOT "!output_on_screen!"=="False" (
@echo Failed. Commencing installation of easy_install
CALL python ^"%running_directory%ez_setup.py^" >nul 2>&1
) else (
CALL python ^"%running_directory%ez_setup.py^" >nul 2>&1
@echo Failed. Commencing installation of easy_install>CON
)
@echo Failed. Commencing installation of easy_install
CALL python ^"%running_directory%ez_setup.py^"
IF NOT "!output_on_screen!"=="False" (
@echo Done.>CON
)
@echo Done.
@echo Done.
GOTO PIP_INSTALL
:PIP_INSTALL
IF NOT "!output_on_screen!"=="False" (
@echo Commencing PIP reinstall to solve compatibility issues
CALL easy_install pip
) else (
CALL easy_install pip >nul 2>&1
@echo Commencing PIP reinstall to solve compatibility issues>CON
)
@echo Commencing PIP reinstall to solve compatibility issues
CALL easy_install pip
IF ERRORLEVEL 1 GOTO INSTALL_EASY_INSTALL
SET "pip_program=requirements.txt"
IF NOT "!output_on_screen!"=="False" (
@echo Installing python modules
@echo Installing python modules>CON
)
@echo Installing python modules
GOTO PIP_PACKAGE_INSTALL
rem Check if the PIP package is installed or not
:PIP_PACKAGE_CHECK
IF NOT "!output_on_screen!"=="False" (
@echo.
@echo Check whether !pip_program! is installed
@echo.>CON
@echo Check whether !pip_program! is installed>CON
)
@echo.
@echo Check whether !pip_program! is installed
for /f "tokens=1,2 delims===" %%a in ('call python -m pip freeze') do (
if "%%a"=="!pip_program!" (
IF NOT "!output_on_screen!"=="False" (
@echo %%b !pip_program! is found
@echo %%b !pip_program! is found>CON
)
@echo %%b !pip_program! is found
GOTO CHECK_PACKAGE_LIST
)
)
IF NOT "!output_on_screen!"=="False" (
@echo No !pip_program! version is found, commencing install
@echo No !pip_program! version is found, commencing install>CON
)
@echo No !pip_program! version is found, commencing install
GOTO PIP_PACKAGE_INSTALL
rem Try to install the PIP packages via PIP
......@@ -220,11 +247,7 @@ IF NOT "!output_on_screen!"=="False" (
if "!pip_program!"=="pywin32" (
call python %running_directory%pywin_installer.py
) else (
IF NOT "!output_on_screen!"=="False" (
call python -m pip install -r !pip_program!
) else (
call python -m pip install -r !pip_program! >nul 2>&1
)
call python -m pip install -r !pip_program!
)
goto CHECK_PACKAGE_LIST
......@@ -233,197 +256,17 @@ IF NOT "!output_on_screen!"=="False" (
set "pip_program=pywin32"
goto PIP_PACKAGE_CHECK
)
if NOT "%install_selenium%"=="False" (
goto CHECK_BROWSER
) else (
goto FIN
)
goto FIN
rem Get installed browsers
:CHECK_BROWSER
set browserToUse=None
IF NOT "!output_on_screen!"=="False" (
@echo.
@echo Checking installed browsers
)
rem For 64 bit systems
START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Clients\StartMenuInternet
rem For 32 bit systems
if not exist "%Temp%\BROW3.reg" START /W REGEDIT /E "%Temp%\BROW3.reg" HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet
set count=1
for /f "tokens=*" %%B in ('type "%Temp%\BROW3.reg" ^| findstr /E "DefaultIcon]"') do (
rem Extracting browser name from icon path
set "browser=%%B"
rem Removing \DefaultIcon] string
set "browser=!browser:\DefaultIcon]=!"
rem Get the browser name
for %%P in ("!browser!") do (
call :SUB_PRINTBROWSER %%~nP
)
)
GOTO CHECK_BROWSER_TO_USE
rem Subroutine to print installed browsers
:SUB_PRINTBROWSER
set subBrowser=%*
CALL :UCase subBrowser upperBrowser
if "%upperBrowser%"=="FIREFOX" (
IF NOT "!output_on_screen!"=="False" (
@echo !count!. %upperBrowser% ^(Recommended^) ^- will be used
)
if NOT "%install_selenium%"=="False" (
SET "browserToUse=firefox"
)
) else (
IF NOT "!output_on_screen!"=="False" (
@echo !count!. %upperBrowser%
)
)
set /a count+=1
GOTO END
rem Determine which Selenium driver to use
:CHECK_BROWSER_TO_USE
if "!browserToUse!"=="None" (
IF NOT "!output_on_screen!"=="False" (
@echo Decide whitch browser to use
@echo Checking which one is the Default browser
)
START /W REGEDIT /E "%Temp%\BROW5.reg" HKEY_CLASSES_ROOT\http\shell\open\command
for /f tokens^=3^ delims^=^" %%B in ('type "%Temp%\BROW5.reg" ^| find "@"') do (
set "default=%%B"
rem removing double slashes
set "default=!default:\\=\!"
rem removing end slash
set "default=!default:~0,-1!"
rem get the name
for %%D in ("!default!") do (
call :SUB_DEFAULTBROWSER %%~nD
)
)
del /Q /F "%Temp%\BROW5.reg"
)
) else (
rem Registry location depends of the architecture
if "!architecture!"=="64" (
set "browser_architect=Wow6432Node\"
set "architecture_name=x64"
) else (
if "!architecture!"=="32" (
set "browser_architect="
set "architecture_name=x86"
) else (
GOTO ERR
)
)
rem Registry names for the different browsers out there
if "!browserToUse!"=="firefox" (
set "browser_path_name=FIREFOX.EXE"
set "selenium_driver_name="
)
if "!browserToUse!"=="chrome" (
set "browser_path_name=Google Chrome"
set "selenium_driver_name=chromedriver.exe"
)
if "!browserToUse!"=="iexplore" (
set "browser_path_name=IEXPLORE.EXE"
set "selenium_driver_name=IEDriverServer.exe"
)
rem Opera have to versions (in the registry) Opera and OperaStable, we try to Stable first
if "!browserToUse!"=="opera" (
set "browser_path_name=OperaStable"
set "selenium_driver_name="
)
set "browser_path="
IF NOT "!output_on_screen!"=="False" (
@echo Check if !browserToUse!.exe is in PATH
)
:get_browser_path
set browser_path=
set query="hklm\SOFTWARE\%browser_architect%Clients\StartMenuInternet\%browser_path_name%\shell\open\command"
reg>nul query %query% 2>nul
if ERRORLEVEL 1 (
if "%browser_path%"=="" (
if "%browser_architect%"=="" (
rem If the Stable failed check out the simple Opera
if "%browser_path_name%"=="OperaStable" (
SET "browser_path_name=Opera"
SET "browser_architect=Wow6432Node\"
goto get_browser_path
)
IF NOT "!output_on_screen!"=="False" (
@echo Location not found^^! Please add !browserToUse!.exe to PATH manually
pause
)
goto install_driver
) else (
set "browser_architect="
goto get_browser_path
)
)
)
rem Get the installation path for the selected browser
for /f "tokens=2,*" %%a in ('reg query %query%') do (
set browser_path=%%b
)
set browser_path=%browser_path:"=%
call :Split "%browser_path%" test
set myTest=!test:~0,-1!
rem Set that path in the PATH environment variable
call ^"%running_directory%inPath^" ^"myTest^" && (IF NOT "!output_on_screen!"=="False" ( @echo !myTest! is already in PATH)) || (call ^"%running_directory%addPath^" ^"myTest^" & setx>nul PATH "%PATH%;!myTest!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !myTest! set to PATH) )
:install_driver
IF NOT "%install_selenium%"=="False" (
if NOT "!selenium_driver_name!"=="" (
@echo Installing the !browserToUse! Selenium driver
xcopy>nul "%running_directory%%architecture_name%^\%selenium_driver_name%" "!install_location!\" /y
if ERRORLEVEL 0 (
IF NOT "!output_on_screen!"=="False" (
@echo Done
)
) else (
IF NOT "!output_on_screen!"=="False" (
@echo Error^^! Please copy the ^'chromedriver.exe^' to ^'!install_location!^\^' manually
)
)
)
rem For the Opera we need to install the selenium standalone jar
if "!browserToUse!"=="opera" (
SET "standalone_version=selenium-server-standalone-2.42.2.jar"
IF NOT "!output_on_screen!"=="False" (
@echo Installing the Selenium server stand alone JAR
)
xcopy>nul "%running_directory%!standalone_version!" "!install_location!\"
if ERRORLEVEL 0 (
IF NOT "!output_on_screen!"=="False" (
@echo Done
)
rem And set it in the SELENIUM_SERVER_JAR environment variable
IF NOT "!output_on_screen!"=="False" (
@echo Setting the SELENIUM_SERVER_JAR environment variable
)
setx>nul SELENIUM_SERVER_JAR "!install_location!^\!standalone_version!"
IF NOT "!output_on_screen!"=="False" (
@echo local SELENIUM_SERVER_JAR set to ^'!install_location!^\!standalone_version!^'
)
) else (
IF NOT "!output_on_screen!"=="False" (
@echo Error^^! Please copy the ^'%standalone_version%^' to ^'!test!^' manually
)
)
)
)
GOTO FIN
)
GOTO ERR
rem Finish up the install
:FIN
rem Create folder if needed and set it to PATH
IF NOT "!output_on_screen!"=="False" (
@echo Checking wheter ^'%install_location%^\^' exists already
@echo Checking wheter ^'%install_location%^\^' exists already>CON
)
call ^"%running_directory%inPath^" ^"install_location^" && (IF NOT "!output_on_screen!"=="False" ( @echo !install_location! is already in PATH)) || (call ^"%running_directory%addPath^" ^"install_location^" & setx>nul PATH "%PATH%;!install_location!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !install_location! set to PATH))
@echo Checking wheter ^'%install_location%^\^' exists already
call ^"%running_directory%inPath^" ^"install_location^" && (IF NOT "!output_on_screen!"=="False" ( @echo !install_location! is already in PATH>CON) && @echo !install_location! is already in PATH) || (call ^"%running_directory%addPath^" ^"install_location^" & setx>nul PATH "%PATH%;!install_location!" /m & IF NOT "!output_on_screen!"=="False" ( @echo !install_location! set to PATH>CON) && @echo !install_location! set to PATH)
if not exist "%install_location%\" (
mkdir ^"%install_location%^"
)
......@@ -432,52 +275,41 @@ if not exist "%install_location%\.rdp\" (
)
rem Copy the files to the folder
IF NOT "!output_on_screen!"=="False" (
@echo Copying files to ^'%install_location%^'
@echo Copying files to ^'%install_location%^'>CON
)
xcopy>nul "%running_directory%cloud.py" "%install_location%\" /y
xcopy>nul "%running_directory%cloud_connect_from_windows.py" "%install_location%\" /y
xcopy>nul "%running_directory%win_install.py" "%install_location%\" /y
xcopy>nul "%running_directory%windowsclasses.py" "%install_location%\" /y
xcopy>nul "%running_directory%nxkey.py" "%install_location%\" /y
xcopy>nul "%running_directory%OrderedDict.py" "%install_location%\" /y
xcopy>nul "%running_directory%putty.exe" "%install_location%\" /y
@echo Copying files to ^'%install_location%^'
xcopy "%running_directory%cloud.py" "%install_location%\" /y
xcopy "%running_directory%cloud_connect_from_windows.py" "%install_location%\" /y
xcopy "%running_directory%win_install.py" "%install_location%\" /y
xcopy "%running_directory%windowsclasses.py" "%install_location%\" /y
xcopy "%running_directory%nxkey.py" "%install_location%\" /y
xcopy "%running_directory%OrderedDict.py" "%install_location%\" /y
xcopy "%running_directory%putty.exe" "%install_location%\" /y
IF NOT "!output_on_screen!"=="False" (
@echo Done
@echo.
@echo Done>CON
@echo.>CON
)
@echo Done
@echo.
IF "%install_selenium%"=="False" (
SET "create_url_icon= -u"
) else (
SET "create_url_icon="
)
IF NOT "!output_on_screen!"=="False" (
@echo Starting the python installation script
@echo Starting the python installation script>CON
)
@echo Starting the python installation script
if NOT "!browserToUse!"=="" (
SET "selenium_driver= -d !browserToUse!"
)
call python ^"%running_directory%win_install.py^"!selenium_driver! ^-l "%install_location%\\"!create_url_icon!!website!
IF NOT "!output_on_screen!"=="False" (
call python ^"%running_directory%win_install.py^"!selenium_driver! ^-l "%install_location%\\"!create_url_icon!!website!
) else (
call python ^"%running_directory%win_install.py^"!selenium_driver! ^-l "%install_location%\\"!create_url_icon!!website! >nul 2>&1
)
IF NOT "!output_on_screen!"=="False" (
@echo Done
@echo Installation complete
)
GOTO END
rem Subroutine to decide which Selenium driver to use
:SUB_DEFAULTBROWSER
set defBrowser=%*
CALL :LCase defBrowser lowerFound
if "%lowerFound%"=="launcher" (
set "lowerFound=opera"
)
IF NOT "!output_on_screen!"=="False" (
@echo %lowerFound% is the default browser
@echo Done>CON
@echo Installation complete>CON
)
set browserToUse=%lowerFound%
@echo Done
@echo Installation complete
GOTO END
......
@echo off
cls
setLocal EnableDelayedExpansion
rem Set whether we want output info on screen or not
rem Set where this file will install the rest of the files
IF NOT "%1"=="" (
SET "output_on_screen=%1"
SET "location=%1"
SET install_location=!location:"=!
) else (
SET "install_location=%APPDATA%\CIRCLE"
)
rem Set whether we want output info on screen or not
IF NOT "%2"=="" (
SET "output_on_screen=%2"
) else (
SET "output_on_screen=False"
SET "output_on_screen=True"
)
rem Starting the uninstall script
IF NOT "!output_on_screen!"=="False" (
@echo Starting CIRCLE Client uninstall script
@echo.
@echo Starting CIRCLE Client uninstall script>CON
@echo.>CON
)
@echo Starting CIRCLE Client uninstall script
@echo.
rem Get the running directory for later ease of use
SET running_directory=%~dp0
rem Set where this file will install the rest of the files
SET "install_location=%APPDATA%\CIRCLE"
if not exist "%install_location%\" (
SET "install_location=%ProgramFiles%\CIRCLE"
)
rem Check the install location whether it exists
if not exist "%install_location%\" (
IF NOT "!output_on_screen!"=="False" (
@echo Installation direcory not found^^! Please delete ^'CIRCLE^' direcory manually
@echo Installation direcory not found^^! Please delete ^'CIRCLE^' direcory manually>CON
pause
)
@echo Installation direcory not found^^! Please delete ^'CIRCLE^' direcory manually 1>&2
goto end
)
IF NOT "!output_on_screen!"=="False" (
@echo Installation direcory found at ^'%install_location%^'
@echo Installation direcory found at ^'%install_location%^'>CON
)
@echo Installation direcory found at ^'%install_location%^'
rem Delete files and directory
IF NOT "!output_on_screen!"=="False" (
@echo Removing desktop icon
call python "%install_location%\win_install.py" ^-r
@echo Done
@echo Removing files
) else (
call python "%install_location%\win_install.py" ^-r >nul 2>&1
@echo Removing desktop icon>CON
)
rd>nul /q/s %install_location% 2>nul
@echo Removing desktop icon
call python "%install_location%\win_install.py" ^-r ^-l "%install_location%\\"
IF NOT "!output_on_screen!"=="False" (
@echo Done
@echo Done>CON
)
@echo Done
:end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment