Kovri: fix/finish preliminary Windows install script

References:
- monero-project/meta#50
- monero-project/meta#35
- monero-project/kovri#362
This commit is contained in:
anonimal 2017-02-22 15:03:43 +00:00
parent 57ad0d1eea
commit c31c829371
No known key found for this signature in database
GPG key ID: 66A76ECF914409F1

View file

@ -31,37 +31,56 @@ REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SET _banner=The Kovri I2P Router Project Installer SET _banner=The Kovri I2P Router Project Installer
SET _data=%APPDATA%\Kovri SET _data=%APPDATA%\Kovri
REM
REM Backup existing installation REM Backup existing installation
REM
SET _config=%_data%\config SET _config=%_data%\config
SET _kovri_conf=%_config%\kovri.conf SET _kovri_conf=%_config%\kovri.conf
SET _tunnels_conf=%_config%\tunnels.conf SET _tunnels_conf=%_config%\tunnels.conf
REM TODO(anonimal): implement IF EXIST "%_config%%" (
REM IF EXIST "%_config%%" ( ECHO Begin configuration backup...
REM ECHO Begin configuration backup... IF EXIST "%_kovri_conf%" (
REM IF EXIST "%_kovri_conf%" ( ECHO Backing up "%_kovri_conf%"
REM MOVE /Y "%_kovri_conf%" "%_kovri_conf%".bak COPY /Y "%_kovri_conf%" "%_kovri_conf%".bak
REM ) )
REM IF EXIST "%_tunnels_conf%" ( IF EXIST "%_tunnels_conf%" (
REM MOVE /Y "%_tunnels_conf%" "%_tunnels_conf%".bak ECHO Backing up "%_tunnels_conf%"
REM ) COPY /Y "%_tunnels_conf%" "%_tunnels_conf%".bak
REM CALL :catch could not backup configuration )
REM ) CALL :catch could not backup configuration
)
REM
REM Remove existing install REM Remove existing install
REM
SET _core=%_data%\core SET _core=%_data%\core
SET _client=%_data%\client SET _client=%_data%\client
SET _installed[0]="%_core%" SET _installed[0]=%_core%
SET _installed[1]="%_client%\address_book\addresses" SET _installed[1]=%_client%\address_book\addresses
SET _installed[2]="%_client%\address_book\addresses.csv" SET _installed[2]=%_client%\address_book\addresses.csv
SET _installed[3]="%_client%\certificates" SET _installed[3]=%_client%\certificates
FOR /F "tokens=2 delims==" %%s IN ('set _installed[') DO (
REM TODO(anonimal): implement IF EXIST %%s\* (
REM FOR /F "tokens=2 delims==" %%s IN ('set _installed[') DO IF EXIST %%s (ECHO Removing %%s && DEL /S /Q %%s) REM Remove directory
ECHO Removing %%s
RMDIR /S /Q %%s
)
IF EXIST %%s (
REM Remove file
ECHO Removing %%s
DEL /F /S /Q %%s
)
)
CALL :catch could not remove existing install CALL :catch could not remove existing install
REM
REM Create new install REM Create new install
REM
REM TODO(anonimal): Install to Program Files? REM TODO(anonimal): Install to Program Files?
SET _path=%USERPROFILE%\Desktop SET _path=%USERPROFILE%\Desktop
SET _binary=kovri.exe SET _binary=kovri.exe
@ -81,8 +100,13 @@ SET _resources[0]=client
SET _resources[1]=config SET _resources[1]=config
SET _resources[2]=%_binary% SET _resources[2]=%_binary%
REM TODO(anonimal): prefer to copy FOR /F "tokens=2 delims==" %%s IN ('set _resources[') DO (
FOR /F "tokens=2 delims==" %%s IN ('set _resources[') DO IF %%s == %_binary% (MOVE /Y %%s "%_path%") else (MOVE /Y %%s "%_data%") IF %%s == %_binary% (
COPY /Y %%s "%_path%"
) ELSE (
XCOPY /F /S /E /Y %%s\* "%_data%"\%%s\*
)
)
CALL :catch could not install resources CALL :catch could not install resources
ECHO Installation success! ECHO Installation success!