Commit ed9d6a72 authored by Franz Reischl's avatar Franz Reischl 🏖
Browse files

Removing all directory changes, working with relative paths from now on

parent ca1e7c01
......@@ -8,8 +8,8 @@ set "MVN_PATH=apache-maven-3.6.0\bin"
rem echo %cd%
@REM change working directory to drive and folder of batch file location
%~d0
cd %~dp0
::%~d0
::cd %~dp0
rem echo %cd%
......@@ -26,7 +26,7 @@ if %ERRORLEVEL% NEQ 0 GOTO javanogood
::if %ERRORLEVEL% NEQ 0 GOTO jdknogood
@REM -- Stopping tomcat server, if running
CALL catalina_stop.bat
CALL 5-catalina_stop.bat
@REM -- Checking if the code folder exists, creating it if necessary
......@@ -40,34 +40,34 @@ rem echo "code" directory already exists
:cont
@REM -- Changing working directory
cd code
::cd code
@REM -- Check if the folder containing the git repository exists
IF NOT EXIST %REPO_NAME% goto init_repo
IF NOT EXIST code\%REPO_NAME%\ goto init_repo
rem echo "Verzeichnis %REPO_NAME% vorhanden."
goto exist_repo
:init_repo
@REM -- Initialize the repository for the first time
git clone %REPO_URL% %REPO_NAME%
git clone %REPO_URL% code\%REPO_NAME%
if %ERRORLEVEL% NEQ 0 goto clone_fail
:exist_repo
@REM -- Checking validity of git repository
cd %REPO_NAME%
git status >NUL 2>NUL
::cd %REPO_NAME%
git -C code\%REPO_NAME% status >NUL 2>NUL
if %ERRORLEVEL% NEQ 0 goto bad_repo
:good_repo
@REM -- Update the git repository to the latest version.
cd %REPO_NAME%
git fetch --all
git checkout --force origin/master
git submodule sync
git submodule update --init --recursive
::cd %REPO_NAME%
git -C code\%REPO_NAME% fetch --all
git -C code\%REPO_NAME% checkout --force origin/master
git -C code\%REPO_NAME% submodule sync
git -C code\%REPO_NAME% submodule update --init --recursive
@REM -- Update the submodule (client files) to latest version
git submodule foreach git pull origin master
git -C code\%REPO_NAME% submodule foreach git pull origin master
:maven
@REM Set JAVA_HOME
......@@ -90,22 +90,22 @@ set Cmd=reg query "%KeyName%" /s
for /f "tokens=2*" %%i in ('%Cmd% ^| find "JavaHome"') do set JAVA_HOME=%%j
@REM -- Apache Maven Build
call ..\..\%MVN_PATH%\mvn.cmd compile
call .\%MVN_PATH%\mvn.cmd -f .\code\%REPO_NAME% compile
@REM -- Apache Maven Generate Site
call ..\..\%MVN_PATH%\mvn.cmd deploy
call .\%MVN_PATH%\mvn.cmd -f .\code\%REPO_NAME% package
@REM -- Return to original path
cd ..\..
:: cd ..\..
@REM -- Overwriting web server files
xcopy /E /C /H /R /Y /Q "code\%REPO_NAME%\target\at.jku.ce" "webapps\ROOT"
xcopy /E /C /H /R /Y /Q "code\%REPO_NAME%\target\at.jku.ce\." "webapps\ROOT"
IF %ERRORLEVEL% NEQ 0 goto copy_fail
echo.
echo ---
echo Server files have successfully updated to latest version.
echo You can now restart Tomcat via 'catalina_start.bat'
echo You can now restart Tomcat via '3-catalina_start.bat'
echo ---
echo.
goto end
......
......@@ -77,15 +77,15 @@ else
fi
# -- Changing working directory
cd code
# cd code
pwd
# -- Check if the directory containing the git repository exists
if [ -d $REPO_NAME ]
if [ -d code/$REPO_NAME ]
then
# -- Directory exists, checking validity of git repository
cd $REPO_NAME
# cd $REPO_NAME
pwd
git status >/dev/null 2>&1
git -C code/$REPO_NAME status >/dev/null 2>&1
if [ $? -gt 0 ] # %ERRORLEVEL% NEQ 0 goto bad_repo
then #:bad_repo
# -- Error: damaged repo
......@@ -100,7 +100,7 @@ then
fi
else
# -- Initialize the repository for the first time
git clone $REPO_URL $REPO_NAME
git clone $REPO_URL code/$REPO_NAME
if [ $? -gt 0 ]
then #:clone_fail
......@@ -115,32 +115,32 @@ else
exit 1
fi
#:clone_good
cd $REPO_NAME
# cd $REPO_NAME
fi
# :good_repo
# -- Update the git repository to the latest version.
#pwd
git fetch --all
git checkout --force origin/master
git submodule sync
git submodule update --init --recursive
git -C code/$REPO_NAME fetch --all
git -C code/$REPO_NAME checkout --force origin/master
git -C code/$REPO_NAME submodule sync
git -C code/$REPO_NAME submodule update --init --recursive
# -- Update the submodule (client files) to latest version
git submodule foreach git pull origin master
git -C code/$REPO_NAME submodule foreach git pull origin master
# :maven
# -- Apache Maven Build
#pwd
sh ../../$MVN_PATH/bin/mvn -e compile
sh ./$MVN_PATH/bin/mvn -f ./code/$REPO_NAME -e compile
# -- Apache Maven Generate Site
sh ../../$MVN_PATH/bin/mvn -e deploy
sh ./$MVN_PATH/bin/mvn -f ./code/$REPO_NAME -e package
# -- Return to original path
cd ../..
# cd ../..
pwd
# -- Overwriting Server site
......@@ -162,7 +162,7 @@ fi
echo
echo ---
echo Server files have successfully updated to latest version.
echo You can now restart Tomcat via 'catalina_start.sh'
echo You can now restart Tomcat via '3-catalina_start.sh'
echo ---
echo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment