Remove build agent binaries

This commit is contained in:
Petr Mrázek 2024-02-01 18:11:05 +01:00
parent 2655cfc321
commit 9cfa05eb8e
125 changed files with 9 additions and 2751 deletions

View file

@ -3,33 +3,12 @@
FROM ubuntu:latest
MAINTAINER Petr Mrázek, peterix@gmail.com
VOLUME /data/teamcity_agent/conf
ENV LANG en_US.UTF-8
ARG DEBIAN_FRONTEND=noninteractive
ENV CONFIG_FILE /data/teamcity_agent/conf/buildAgent.properties
COPY run-agent.sh /run-agent.sh
COPY run-services.sh /run-services.sh
COPY buildagent /opt/buildagent
RUN apt-get update && apt-get install -y --no-install-recommends sudo
RUN useradd -m buildagent
RUN chmod +x /opt/buildagent/bin/*.sh
RUN chmod +x /run-agent.sh /run-services.sh
RUN mv /opt/buildagent/conf /opt/buildagent/conf_dist && sync
CMD ["/run-services.sh"]
# We need "apt-add-repository"
RUN apt-get install -y software-properties-common curl
# Install Java
RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install -y openjdk-8-jre-headless
EXPOSE 9090
RUN apt-get update && apt-get install -y python3 python3-pip python3-requests git wget zip unzip s3cmd rsync
RUN apt-get install -y --no-install-recommends sudo
RUN apt-get install -y sudo software-properties-common curl python3 python3-pip python3-requests git wget zip unzip s3cmd rsync
RUN pip3 install 'git+https://github.com/MultiMC/repoman2.git'
# add patron scraper script so it can be used by schedulers
@ -44,4 +23,3 @@ RUN pip3 install iso8601 lockfile cachecontrol
# Oh god, have mercy
RUN mkdir -p ~/.ssh/
RUN ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

View file

@ -1,35 +1,15 @@
# MultiMC 64-bit Linux Build Environment
# MultiMC website build environment
# Add teamcity parts to an ancient base of Ubuntu 14.04
FROM ubuntu:trusty
FROM ubuntu:latest
MAINTAINER Petr Mrázek, peterix@gmail.com
VOLUME /data/teamcity_agent/conf
ENV LANG en_US.UTF-8
ENV CONFIG_FILE /data/teamcity_agent/conf/buildAgent.properties
COPY run-agent.sh /run-agent.sh
COPY run-services.sh /run-services.sh
COPY buildagent /opt/buildagent
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends sudo
RUN useradd -m buildagent
RUN chmod +x /opt/buildagent/bin/*.sh
RUN chmod +x /run-agent.sh /run-services.sh
RUN mv /opt/buildagent/conf /opt/buildagent/conf_dist && sync
# We need "apt-add-repository"
RUN apt-get install -y software-properties-common python-software-properties curl
# Install Java
RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk
CMD ["/run-services.sh"]
EXPOSE 9090
RUN apt-get install -y software-properties-common curl
# Download and install hugo
ENV HUGO_VERSION 0.31.1

View file

@ -1,23 +1,13 @@
# MultiMC 32-bit Linux Build Environment
# Add teamcity parts to an ancient base of Ubuntu 14.04
FROM i386/ubuntu:trusty-20180807
FROM i386/ubuntu:trusty
MAINTAINER Petr Mrázek, peterix@gmail.com
VOLUME /data/teamcity_agent/conf
ENV LANG en_US.UTF-8
ENV CONFIG_FILE /data/teamcity_agent/conf/buildAgent.properties
COPY run-agent.sh /run-agent.sh
COPY run-services.sh /run-services.sh
COPY buildagent /opt/buildagent
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends sudo
RUN useradd -m buildagent
RUN chmod +x /opt/buildagent/bin/*.sh
RUN chmod +x /run-agent.sh /run-services.sh
RUN mv /opt/buildagent/conf /opt/buildagent/conf_dist && sync
# We need "apt-add-repository"
RUN apt-get install -y software-properties-common python-software-properties curl
@ -45,7 +35,3 @@ RUN apt-get install -y openjdk-8-jdk
# Install extra packages
RUN apt-get install -y mesa-common-dev libglu1-mesa-dev libgtk2.0-dev vim
CMD ["/run-services.sh"]
EXPOSE 9090

View file

@ -1,23 +1,13 @@
# MultiMC 64-bit Linux Build Environment
# Add teamcity parts to an ancient base of Ubuntu 14.04
FROM ubuntu:trusty
MAINTAINER Petr Mrázek, peterix@gmail.com
VOLUME /data/teamcity_agent/conf
ENV LANG en_US.UTF-8
ENV CONFIG_FILE /data/teamcity_agent/conf/buildAgent.properties
COPY run-agent.sh /run-agent.sh
COPY run-services.sh /run-services.sh
COPY buildagent /opt/buildagent
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends sudo
RUN useradd -m buildagent
RUN chmod +x /opt/buildagent/bin/*.sh
RUN chmod +x /run-agent.sh /run-services.sh
RUN mv /opt/buildagent/conf /opt/buildagent/conf_dist && sync
# We need "apt-add-repository"
RUN apt-get install -y software-properties-common python-software-properties curl
@ -46,10 +36,6 @@ RUN apt-get install -y openjdk-8-jdk
# Install extra packages
RUN apt-get install -y mesa-common-dev libglu1-mesa-dev libgtk2.0-dev vim
CMD ["/run-services.sh"]
EXPOSE 9090
# Oh god, have mercy
RUN mkdir -p ~/.ssh/
RUN ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

View file

@ -1,169 +0,0 @@
@echo off
:: ---------------------------------------------------------------------
:: TeamCity build agent start/stop script
:: ---------------------------------------------------------------------
:: Environment variables:
::
:: TEAMCITY_AGENT_MEM_OPTS Set agent memory options (JVM options)
::
:: TEAMCITY_AGENT_OPTS Set additional agent JVM options
::
:: TEAMCITY_LAUNCHER_MEM_OPTS Set agent launcher memory options (JVM options)
::
:: TEAMCITY_LAUNCHER_OPTS Set agent launcher JVM options
::
:: TEAMCITY_AGENT_PREPARE_SCRIPT name of a script to execute before start/stop
::
:: ---------------------------------------------------------------------
setlocal
SET TEAMCITY_AGENT_CURRENT_DIR=%CD%
cd /d %~dp0
set QUIET=0
IF ""%1"" == ""status"" if ""%2"" == ""short"" set QUIET=1
:: Fail fast if command is not supported
IF ""%1"" == ""start"" goto command_ok
IF ""%1"" == ""stop"" goto command_ok
IF ""%1"" == ""status"" goto command_ok
IF ""%1"" == ""configure"" goto command_ok
goto command_unknown
:command_ok
IF not "%TEAMCITY_AGENT_CONFIG_FILE%" == "" goto config_file_set
SET TEAMCITY_AGENT_CONFIG_FILE=..\conf\buildAgent.properties
:config_file_set
IF not "%TEAMCITY_AGENT_LOG_DIR%" == "" goto log_dir_set
SET TEAMCITY_AGENT_LOG_DIR=../logs/
:log_dir_set
IF not "%TEAMCITY_AGENT_MEM_OPTS%" == "" goto agent_mem_opts_set
SET TEAMCITY_AGENT_MEM_OPTS_ACTUAL=-Xmx384m
:: uncomment for debugging OOM errors:
:: SET TEAMCITY_AGENT_MEM_OPTS_ACTUAL=-Xmx384m -XX:+HeapDumpOnOutOfMemoryError
goto agent_mem_opts_set_done
:agent_mem_opts_set
SET TEAMCITY_AGENT_MEM_OPTS_ACTUAL=%TEAMCITY_AGENT_MEM_OPTS%
:agent_mem_opts_set_done
SET TEAMCITY_AGENT_OPTS_ACTUAL=%TEAMCITY_AGENT_OPTS% -ea %TEAMCITY_AGENT_MEM_OPTS_ACTUAL% -Dlog4j.configuration=file:../conf/teamcity-agent-log4j.xml -Dteamcity_logs=%TEAMCITY_AGENT_LOG_DIR%
IF not "%TEAMCITY_LAUNCHER_MEM_OPTS%" == "" goto launcher_mem_opts_set
SET TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL=-Xms16m -Xmx64m
goto launcher_mem_opts_set_done
:launcher_mem_opts_set
SET TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL=%TEAMCITY_LAUNCHER_MEM_OPTS%
:launcher_mem_opts_set_done
SET TEAMCITY_LAUNCHER_OPTS_ACTUAL=%TEAMCITY_LAUNCHER_OPTS% -ea %TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL%
IF NOT "%QUIET%"=="1" ECHO Looking for installed Java...
set "java_hint="
IF NOT EXIST ..\conf\teamcity-agent.jvm goto findJava
set /p java_hint=< ..\conf\teamcity-agent.jvm
call :dirname "%java_hint%" java_bin_dir
call :dirname "%java_bin_dir%" java_hint
set "java_bin_dir="
:findJava
set "FJ_MIN_UNSUPPORTED_JAVA_VERSION=12"
:: First search only among specified directories
set "FJ_SKIP_ALL_EXCEPT_ARGS=1"
CALL "%cd%\findJava.bat" "1.8" "%TEAMCITY_JRE%" "%java_hint%" "%cd%\..\jre" "%cd%\..\..\jre" 1>nul 2>nul
set "FJ_SKIP_ALL_EXCEPT_ARGS="
IF ERRORLEVEL 0 GOTO java_search_done
set "FJ_LOOK_FOR_X86_JAVA=1"
:: Then in all other possible locations for 32bit java 1.8+, arguments are required there as it's covered in previous attempt
CALL "%cd%\findJava.bat" "1.8" 1>nul 2>nul
set "FJ_LOOK_FOR_X86_JAVA="
IF ERRORLEVEL 0 GOTO java_search_done
:: Then in all other possible locations for any bitness
CALL "%cd%\findJava.bat" "1.8" "%TEAMCITY_JRE%" "%java_hint%" "%cd%\..\jre" "%cd%\..\..\jre"
IF ERRORLEVEL 0 GOTO java_search_done
IF NOT "%QUIET%"=="1" ECHO Java not found. Cannot start TeamCity agent. Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it.
GOTO done
:java_search_done
set "java_hint="
IF NOT "%QUIET%"=="1" ECHO Java executable is found: '%FJ_JAVA_EXEC%'
SET TEAMCITY_AGENT_JAVA_EXEC=%FJ_JAVA_EXEC%
:: Cleanup env
SET "FJ_JAVA_EXEC="
SET "FJ_JAVA_VERSION="
SET "FJ_MIN_UNSUPPORTED_JAVA_VERSION="
:run
set TEAMCITY_LAUNCHER_CLASSPATH=..\launcher\lib\launcher.jar
if EXIST ..\lib\latest\launcher.jar set TEAMCITY_LAUNCHER_CLASSPATH = ..\lib\latest\launcher.jar
if "%TEAMCITY_AGENT_PREPARE_SCRIPT%" == "" goto skip_prepare
call "%TEAMCITY_AGENT_PREPARE_SCRIPT%" %*
:skip_prepare
SET QUIET=
IF ""%1"" == ""start"" goto start
IF ""%1"" == ""stop"" goto stop
IF ""%1"" == ""status"" goto status
IF ""%1"" == ""configure"" goto configure
:command_unknown
echo Error parsing command line.
echo ----------------------------------------
echo Usage: agent.bat start or agent.bat stop[ force]
echo start - starts the agent in new console window
echo stop - stops the agent after the currently running build (if any) is finished
echo stop force - stops the agent cancelling the build
echo ----------------------------------------
goto done
:start
IF EXIST ..\lib\latest\launcher.jar goto start_upgrade
goto start_run
:start_upgrade
del /Q ..\lib\launcher.jar
move ..\lib\latest\launcher.jar ..\lib\launcher.jar
:start_run
"%TEAMCITY_AGENT_JAVA_EXEC%" %TEAMCITY_LAUNCHER_OPTS_ACTUAL% -cp %TEAMCITY_LAUNCHER_CLASSPATH% jetbrains.buildServer.agent.Check %TEAMCITY_AGENT_OPTS_ACTUAL% jetbrains.buildServer.agent.AgentMain -file %TEAMCITY_AGENT_CONFIG_FILE%
IF ERRORLEVEL 1 goto done
IF not "%TEAMCITY_AGENT_START_EXEC%" == "" goto start_cmd
SET TEAMCITY_AGENT_START_EXEC=start /min
:start_cmd
%TEAMCITY_AGENT_START_EXEC% "TeamCity Build Agent" "%TEAMCITY_AGENT_JAVA_EXEC%" %TEAMCITY_LAUNCHER_OPTS_ACTUAL% -cp %TEAMCITY_LAUNCHER_CLASSPATH% jetbrains.buildServer.agent.Launcher %TEAMCITY_AGENT_OPTS_ACTUAL% jetbrains.buildServer.agent.AgentMain -file %TEAMCITY_AGENT_CONFIG_FILE%
goto done
:stop
"%TEAMCITY_AGENT_JAVA_EXEC%" %TEAMCITY_LAUNCHER_OPTS_ACTUAL% -cp %TEAMCITY_LAUNCHER_CLASSPATH% jetbrains.buildServer.agent.Stop %TEAMCITY_AGENT_OPTS_ACTUAL% -file %TEAMCITY_AGENT_CONFIG_FILE% %2
goto done
:status
set TEAMCITY_CONFIGURATOR_JAR=..\lib\agent-configurator.jar
"%TEAMCITY_AGENT_JAVA_EXEC%" %TEAMCITY_LAUNCHER_OPTS_ACTUAL% -jar %TEAMCITY_CONFIGURATOR_JAR% %* --agent-config-file %TEAMCITY_AGENT_CONFIG_FILE%
goto done
:configure
set TEAMCITY_CONFIGURATOR_JAR=..\lib\agent-configurator.jar
"%TEAMCITY_AGENT_JAVA_EXEC%" %TEAMCITY_LAUNCHER_OPTS_ACTUAL% -jar %TEAMCITY_CONFIGURATOR_JAR% %* --agent-config-file %TEAMCITY_AGENT_CONFIG_FILE%
goto done
:dirname file varName
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET _dir=%~dp1
SET _dir=%_dir:~0,-1%
endlocal & set %2=%_dir%
goto:eof
:done
set "TEAMCITY_AGENT_JAVA_EXEC="
cd /d %TEAMCITY_AGENT_CURRENT_DIR%

View file

@ -1,345 +0,0 @@
#!/bin/sh
# ------------------------------------------------------------------------------------------------
# Please do not modify this script, your changes will be lost after each TeamCity server upgrade !
# ------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------
# TeamCity build agent start/stop script
# ---------------------------------------------------------------------
# Environment variables:
#
# JAVA_HOME or JRE_HOME Set Java to use by agent process. Must point to a directory with bin/java executable.
#
# TEAMCITY_AGENT_MEM_OPTS Set agent memory options (JVM options)
#
# TEAMCITY_AGENT_OPTS Set additional agent JVM options
#
# TEAMCITY_LAUNCHER_MEM_OPTS Set agent launcher memory options (JVM options)
#
# TEAMCITY_LAUNCHER_OPTS Set agent launcher JVM options
#
# TEAMCITY_AGENT_PREPARE_SCRIPT name of a script to execute before start/stop
#
# ---------------------------------------------------------------------
old_cwd=`pwd`
this_script="$0"
command_name=$1
command_sub_name=$2
workingdir=`dirname "$this_script"`
cd "$workingdir"
if [ "$CONFIG_FILE" = "" ]; then
CONFIG_FILE=../conf/buildAgent.properties
fi
# TODO: Read LOG_DIR from buildAgent.properties for Bundle compatibility
if [ "$LOG_DIR" = "" ]; then
LOG_DIR=../logs
fi
TEAMCITY_AGENT_MEM_OPTS_ACTUAL="$TEAMCITY_AGENT_MEM_OPTS"
if [ "$TEAMCITY_AGENT_MEM_OPTS_ACTUAL" = "" ]; then
TEAMCITY_AGENT_MEM_OPTS_ACTUAL="-Xmx384m"
fi
# uncomment for debugging OOM errors:
# TEAMCITY_AGENT_MEM_OPTS_ACTUAL="$TEAMCITY_AGENT_MEM_OPTS_ACTUAL -XX:+HeapDumpOnOutOfMemoryError"
TEAMCITY_AGENT_OPTS_ACTUAL="$TEAMCITY_AGENT_OPTS -ea $TEAMCITY_AGENT_MEM_OPTS_ACTUAL -Dteamcity_logs=$LOG_DIR/"
TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL="$TEAMCITY_LAUNCHER_MEM_OPTS"
if [ "$TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL" = "" ]; then
TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL="-Xms16m -Xmx64m"
fi
TEAMCITY_LAUNCHER_OPTS_ACTUAL="-ea $TEAMCITY_LAUNCHER_OPTS $TEAMCITY_LAUNCHER_MEM_OPTS_ACTUAL"
if [ -f ../conf/teamcity-agent-log4j.xml ]; then
TEAMCITY_AGENT_OPTS_ACTUAL="$TEAMCITY_AGENT_OPTS_ACTUAL -Dlog4j.configuration=file:../conf/teamcity-agent-log4j.xml"
fi
if [ "$PID_FILE" = "" ]; then
PID_FILE=$LOG_DIR/buildAgent.pid
fi
TEAMCITY_LAUNCHER_CLASSPATH="../launcher/lib/launcher.jar"
check_alive() {
ps_alive=0
if [ -f "$PID_FILE" ] ; then
# Some 'ps' requires '-p' flag (Solaris 10 default). Solaris 10 /usr/ucb/ps does not support '-p'
minus_p=''
if ps -p 1 >/dev/null 2>/dev/null; then
minus_p='-p'
fi
if ps $minus_p `cat $PID_FILE` >/dev/null 2>&1; then
ps_alive=1;
else
rm $PID_FILE
fi
fi
if [ "$ps_alive" = "0" ]; then
return 1
else
# Special case for Solaris, since default ps truncates output and there no '-w' option
case "`uname`" in
SunOS*)
# Ensure proper ps and grep would be used
PATH="/usr/ucb:/usr/xpg6/bin:/usr/xpg4/bin:$PATH"
export PATH
if ps auxww 1>/dev/null 2>/dev/null; then
if ps auxww "`cat "$PID_FILE"`" 2>/dev/null | grep 'jetbrains.buildServer.agent' >/dev/null; then
return 0
else
echo "PID file ($PID_FILE) contains pid not from TeamCity agent and will be removed."
rm "$PID_FILE"
return 1
fi
else
echo "[WARN] Result of check for running TeamCity may be false positive: 'ps' works not as expected"
return 0
fi
;;
esac
# Check that process is TeamCity agent
# Alternative: pgrep -F "$PID_FILE" -f 'jetbrains.buildServer.agent'
# Unfortunately AIX, OSX, HP-UX does not support pgrep
if ps -oargs 1>/dev/null 2>/dev/null; then
field="args"
elif ps -ocommand 1>/dev/null 2>/dev/null; then
field="command"
else
echo "[WARN] Result of check for running TeamCity may be false positive: cannot use 'ps', neither 'args' nor 'command' output supported."
return 0
fi
if ps "-o$field" -p "`cat "$PID_FILE"`" 2>/dev/null | grep 'jetbrains.buildServer.agent' >/dev/null; then
return 0
else
echo "PID file ($PID_FILE) contains pid not from TeamCity agent and will be removed."
rm "$PID_FILE"
return 1
fi
fi
echo "[ERROR] Unexpected state"
return 0
}
exit1() {
cd "$old_cwd"
exit $1
}
java_exec=""
QUIET=0
need_java() {
java_hint=""
if [ -f '../conf/teamcity-agent.jvm' ]; then
java_hint="`head -n 1 '../conf/teamcity-agent.jvm'`"
if [ ! -z "$java_hint" ]; then
java_hint="`dirname \"$java_hint\"`"
java_hint="`dirname \"$java_hint\"`"
fi
fi
if [ -z "$java_hint" ] || [ ! -d "$java_hint" ]; then
java_hint=""
fi
. ./findJava.sh
FJ_MIN_UNSUPPORTED_JAVA_VERSION=12
FJ_SKIP_ALL_EXCEPT_ARGS=1
# First search only among specified directories
find_java 1.8 "$TEAMCITY_JRE" "$java_hint" "`pwd`/../jre" "`pwd`/../../jre" >/dev/null 2>&1
unset FJ_SKIP_ALL_EXCEPT_ARGS
FJ_LOOK_FOR_X86_JAVA=1
# Then in all other possible locations for 32bit java 1.8+, arguments are required there as it's covered in previous attempt
find_java 1.8 >/dev/null 2>&1
unset FJ_LOOK_FOR_X86_JAVA
# Then in all other possible locations for any bitness
find_java 1.8 "$TEAMCITY_JRE" "$java_hint" "`pwd`/../jre" "`pwd`/../../jre";
if [ $? -ne 0 ]; then
if [ "$QUIET" -eq 0 ]; then
echo "Java not found. $1 Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it."
fi
if [ ! -z "$2" ]; then
exit1 $2
fi
exit1 1
fi
java_exec="$FJ_JAVA_EXEC"
if [ "$QUIET" -eq 0 ]; then
echo "Java executable is found: '$FJ_JAVA_EXEC'"
fi
# Cleanup env
unset FJ_JAVA_EXEC
unset FJ_JAVA_VERSION
unset FJ_MIN_UNSUPPORTED_JAVA_VERSION
}
case "$command_name" in
start|run)
if check_alive ; then
echo "Build agent is already running with PID `cat $PID_FILE`"
exit1 1
fi
if [ ! -r "$CONFIG_FILE" ]; then
mkdir ../conf >/dev/null 2>&1
mv *.properties *.xml *.dtd ../conf >/dev/null 2>&1
fi
echo "Starting TeamCity build agent..."
need_java "Cannot start TeamCity agent."
mkdir -p $LOG_DIR 2>/dev/null
# Fix attributes for Mac service launcher (TW-49776, TW-57312)
chmod +x ../launcher/bin/* 2>/dev/null
if [ -f ../lib/latest/launcher.jar ]; then
rm ../lib/launcher.jar
mv ../lib/latest/launcher.jar ../lib/launcher.jar
TEAMCITY_LAUNCHER_CLASSPATH="../lib/launcher.jar"
fi
if [ "$TEAMCITY_AGENT_PREPARE_SCRIPT" != "" ]; then
"$TEAMCITY_AGENT_PREPARE_SCRIPT" "$@"
fi
"$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -cp $TEAMCITY_LAUNCHER_CLASSPATH jetbrains.buildServer.agent.Check $TEAMCITY_AGENT_OPTS_ACTUAL jetbrains.buildServer.agent.AgentMain -file $CONFIG_FILE
check_result="$?"
if [ "$check_result" != "0" ]; then
exit1 1;
fi
if [ "$command_name" = "start" ]; then
NOHUP=""
nohup id >/dev/null 2>&1 && NOHUP=nohup
$NOHUP "$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -cp $TEAMCITY_LAUNCHER_CLASSPATH jetbrains.buildServer.agent.Launcher $TEAMCITY_AGENT_OPTS_ACTUAL jetbrains.buildServer.agent.AgentMain -file $CONFIG_FILE > "$LOG_DIR/output.log" 2> "$LOG_DIR/error.log" &
launcher_pid=$!
echo $launcher_pid > $PID_FILE
echo "Done [$launcher_pid], see log at `cd $LOG_DIR && pwd`/teamcity-agent.log"
else
"$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -cp $TEAMCITY_LAUNCHER_CLASSPATH jetbrains.buildServer.agent.Launcher $TEAMCITY_AGENT_OPTS_ACTUAL jetbrains.buildServer.agent.AgentMain -file $CONFIG_FILE
fi
;;
stop)
echo "Stopping TeamCity build agent..."
if [ "$command_sub_name" = "kill" ] ; then
if check_alive ; then
echo "Stopping buildAgent [`cat $PID_FILE`]"
kill `cat $PID_FILE`
for i in 1 2 3 4 5 6 7 8 9 10; do
# '!' Negation does not work on Solaris sh. ':' is noop.
if check_alive; then :;
else break;
fi
sleep 1
done
if check_alive; then
echo "Cannot stop buildAgent"
exit1 1
else
echo "Stopped"
rm "$PID_FILE"
fi
else
echo "$PID_FILE not found, nothing to stop."
fi
else
check_alive ;
need_java "Cannot stop TeamCity agent."
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
export LD_LIBRARY_PATH
if [ "$command_sub_name" = "force" ]; then
FORCE="force"
fi
if [ -f ../lib/latest/launcher.jar ]; then
TEAMCITY_LAUNCHER_CLASSPATH="../lib/latest/launcher.jar"
fi
if [ "$TEAMCITY_AGENT_PREPARE_SCRIPT" != "" ]; then
"$TEAMCITY_AGENT_PREPARE_SCRIPT" "$@"
fi
"$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -cp $TEAMCITY_LAUNCHER_CLASSPATH jetbrains.buildServer.agent.Stop -file $CONFIG_FILE $FORCE $TEAMCITY_AGENT_OPTS_ACTUAL
check_result="$?"
if [ "$check_result" != "0" ]; then
echo "Cannot stop agent gracefully, you can try to kill agent by '$this_script stop kill' command"
exit1 1
fi
fi
;;
status)
if [ "$2" = "short" ]; then
QUIET=1
fi
## Simple pid file based checking.
#if check_alive ; then
# echo "Build Agent running with pid [`cat $PID_FILE`]"
# exit1 0
#else
# echo "$PID_FILE not found."
# exit1 1
#fi
need_java "Cannot check TeamCity agent status. " -1
if [ "$2" != "short" ]; then
echo "Checking TeamCity build agent status..."
fi
if [ -f ../lib/latest/launcher.jar ]; then
TEAMCITY_LAUNCHER_CLASSPATH="../lib/latest/launcher.jar"
fi
if [ "$TEAMCITY_AGENT_PREPARE_SCRIPT" != "" ]; then
"$TEAMCITY_AGENT_PREPARE_SCRIPT" "$@"
fi
TEAMCITY_CONFIGURATOR_JAR="../lib/agent-configurator.jar"
"$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -jar "$TEAMCITY_CONFIGURATOR_JAR" "$@" --agent-config-file "$CONFIG_FILE"
exit1 $?
;;
configure)
need_java "Cannot configure TeamCity agent. " 1
echo "Configuring TeamCity build agent..."
if [ "$TEAMCITY_AGENT_PREPARE_SCRIPT" != "" ]; then
"$TEAMCITY_AGENT_PREPARE_SCRIPT" "$@"
fi
TEAMCITY_CONFIGURATOR_JAR="../lib/agent-configurator.jar"
"$java_exec" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -jar "$TEAMCITY_CONFIGURATOR_JAR" "$@" --agent-config-file "$CONFIG_FILE"
exit1 $?
;;
*)
echo "JetBrains TeamCity Build Agent"
echo "Usage: "
echo " $this_script start - to start build agent in background"
echo " $this_script stop - to stop build agent after current build finish"
echo " "
echo " $this_script run - to start build agent in the current console"
echo " $this_script stop force - to stop build agent terminating currently running build"
exit1 1
;;
esac
exit1 0

View file

@ -1,56 +0,0 @@
:: ---------------------------------------------------------------------
:: TeamCity build agent configuration script
:: ---------------------------------------------------------------------
:: Usage: changeAgentProps.bat <parameter_name> <new_parameter_value> <properties_file>
:: %1 parameter name
:: %2 new parameter value
:: %3 properties file
:: ---------------------------------------------------------------------
FOR /F "tokens=*" %%i in ("%1") DO SET PARAMETER_NAME=%%~i
FOR /F "tokens=*" %%i in ("%2") DO SET PARAMETER_VALUE=%%~i
FOR /F "tokens=*" %%i in ("%3") DO SET AGENT_PROPERTIES_FILE=%%~i
IF "%AGENT_PROPERTIES_FILE%"=="" GOTO print_usage
ECHO Setting '%PARAMETER_NAME%' with '%PARAMETER_VALUE%' in '%AGENT_PROPERTIES_FILE%'...
:: Use existing as template if so
IF EXIST "%AGENT_PROPERTIES_FILE%" SET TEMPLATE_PROPERTIES_FILE=%AGENT_PROPERTIES_FILE%
:: Check template exists
IF NOT EXIST "%TEMPLATE_PROPERTIES_FILE%" (
ECHO Could not find Agent's property file '%TEMPLATE_PROPERTIES_FILE%'. Terminating[2]
SET ERRORLEVEL=2
GOTO end
)
:: Use temporary file for replacing
SET TMP_PROPERTIES_FILE=%AGENT_PROPERTIES_FILE%.tmp
:: Replace...
SET PARAMETER_FOUND="NO"
FOR /F "tokens=*" %%i IN ('type "%TEMPLATE_PROPERTIES_FILE%"') DO (
FOR /F "tokens=1 delims==" %%j IN ("%%i") DO (
if "%%j"=="%PARAMETER_NAME%" (
ECHO %PARAMETER_NAME%=%PARAMETER_VALUE%>>"%TMP_PROPERTIES_FILE%"
SET PARAMETER_FOUND="YES"
ECHO Parameter set successfully.
) ELSE (
ECHO %%i>>"%TMP_PROPERTIES_FILE%"
)
)
)
IF %PARAMETER_FOUND%=="NO" (
ECHO Could not find '%PARAMETER_NAME%' parameter in the file. Terminating[%ERRORLEVEL%]
set ERRORLEVEL=2
GOTO end
)
SET ERRORLEVEL=
move>NUL /Y "%TMP_PROPERTIES_FILE%" "%AGENT_PROPERTIES_FILE%"
IF "%ERRORLEVEL%"=="0" GOTO end
ECHO Could not override the Agent's property file '%AGENT_PROPERTIES_FILE%'. Terminating[%ERRORLEVEL%]
SET ERRORLEVEL=2
GOTO end
:print_usage
ECHO "Usage: changeAgentProps.bat <parameter_name> <new_parameter_value> <properties_file>"
:end

View file

@ -1,530 +0,0 @@
@echo off
rem --------------------------------------------------------------------------------------
rem DO NOT CHANGE THIS FILE! ALL YOUR CHANGES WILL BE ELIMINATED AFTER AUTOMATIC UPGRADE.
rem --------------------------------------------------------------------------------------
rem Searches for Java executable
rem Usage: findJava.bat <Minimal required Java version> [<Additional search directory> <Additional search directory> ...]
rem E.g.: findJava.bat 1.8
rem Set FJ_LOOK_FOR_SERVER_JAVA environment variable to look for server Java only
rem Set FJ_LOOK_FOR_X64_JAVA environment variable to look for x64 Java only
rem Set FJ_LOOK_FOR_X86_JAVA environment variable to look for x86 Java only
rem Set FJ_MIN_UNSUPPORTED_JAVA_VERSION environment variable to ignore Java starting from the specified version
rem --------------------------------------------------------------------------------------
rem workaround for the case if ERRORLEVEL was set by parent process
set ERRORLEVEL=
setlocal disabledelayedexpansion
set "FJ_SCRIPT=%~df0"
setlocal enabledelayedexpansion
rem **************************************************************************************
rem --------------------------------------------------------------------------------------
rem Function declarations
rem --------------------------------------------------------------------------------------
rem **************************************************************************************
if "%~1" == "fun" (
endlocal
set "FUN_NAME=%~2"
set "FUN_ARG_PATH=%~df3"
set "FUN_ARG1=%~3"
set "FUN_ARG2=%~4"
setlocal enabledelayedexpansion
rem --------------------------------------------------------------------------------------
rem "detect_version" function
rem --------------------------------------------------------------------------------------
rem Determines version of Java executable located at #3.
rem Returns exit code 0 and sets determined version to FJ_JAVA_VERSION variable on success, returns exit code -1 otherwise.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "detect_version" (
if "!FUN_ARG1!" == "" goto exit_fail
call "!FUN_ARG_PATH!" -version 1>nul 2>nul <nul
if not "!ERRORLEVEL!" == "0" goto exit_fail
for /f "tokens=3" %%i in ('call "!FUN_ARG_PATH!" -version 2^>^&1 ^| findstr /i "version"') do (
endlocal
set "FJ_JAVA_VERSION=%%~i"
setlocal enabledelayedexpansion
)
if "!FJ_JAVA_VERSION!" == "" goto exit_fail
goto exit_ok
)
rem --------------------------------------------------------------------------------------
rem "version_ge" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if Java version #3 is greater than or equal to #4, -1 otherwise.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "version_ge" (
for /f "tokens=1 delims=-_+" %%a in ("!FUN_ARG1!") do (
for /f "tokens=1 delims=-_+" %%b in ("!FUN_ARG2!") do (
endlocal
set "V1=%%a"
set "V2=%%b"
setlocal enabledelayedexpansion
for /f "tokens=1,2,3 delims=." %%i in ("!V1!") do (
for /f "tokens=1,2,3 delims=." %%x in ("!V2!") do (
endlocal
set "MAJOR1=%%i"
set "MINOR1=%%j"
set "SECURITY1=%%k"
set "MAJOR2=%%x"
set "MINOR2=%%y"
set "SECURITY2=%%z"
setlocal enabledelayedexpansion
if "!MAJOR1!" == "1" if not "!MINOR1!" == "" (
set "MAJOR1=!MINOR1!"
set "MINOR1=!SECURITY1!"
)
if "!MAJOR2!" == "1" if not "!MINOR2!" == "" (
set "MAJOR2=!MINOR2!"
set "MINOR2=!SECURITY2!"
)
if "!MINOR1!" == "" (
set "MINOR1=0"
)
if "!MINOR2!" == "" (
set "MINOR2=0"
)
if !MAJOR1! equ !MAJOR2! (
if !MINOR1! geq !MINOR2! (
exit /b 0
) else (
exit /b -1
)
) else (
if !MAJOR1! gtr !MAJOR2! (
exit /b 0
) else (
exit /b -1
)
)
)
)
)
)
)
rem --------------------------------------------------------------------------------------
rem "check_java" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified Java executable #3 exists, has proper version and is server/x64 if needed; -1 otherwise.
rem Sets FJ_JAVA_EXEC and FJ_JAVA_VERSION variables on success.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "check_java" (
if "!FUN_ARG1!" == "" goto exit_fail
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Checking Java: !FUN_ARG_PATH! 1>&2
if not exist "!FUN_ARG_PATH!" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Java executable does not exist 1>&2
goto exit_fail
)
call "!FJ_SCRIPT!" fun detect_version "!FUN_ARG_PATH!" <nul
if "!ERRORLEVEL!" == "-1" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Failed to detect Java version 1>&2
goto exit_fail
)
call "!FJ_SCRIPT!" fun check_java_internal "!FUN_ARG_PATH!" <nul
if not "!ERRORLEVEL!" == "0" goto exit_fail
for /f "delims=" %%x in ("!FJ_JAVA_VERSION!") do (
endlocal
set "FJ_JAVA_VERSION=%%x"
setlocal enabledelayedexpansion
)
for /f "delims=" %%x in ("!FUN_ARG_PATH!") do (
endlocal
set "FJ_JAVA_EXEC=%%x"
setlocal enabledelayedexpansion
)
goto exit_ok
)
rem --------------------------------------------------------------------------------------
rem "check_java_internal" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified Java executable #3 has proper version and is server/x64 if needed; -1 otherwise.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "check_java_internal" (
if "!FUN_ARG1!" == "" goto exit_fail
if not exist "!FUN_ARG_PATH!" goto exit_fail
if "!FJ_JAVA_VERSION!" == "" goto exit_fail
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Version: !FJ_JAVA_VERSION! 1>&2
call "!FJ_SCRIPT!" fun version_ge !FJ_JAVA_VERSION! !FJ_MIN_REQUIRED_JAVA_VERSION! <nul
if not "!ERRORLEVEL!" == "0" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Version is not suitable ^(less than !FJ_MIN_REQUIRED_JAVA_VERSION!^) 1>&2
goto exit_fail
)
if not "!FJ_MIN_UNSUPPORTED_JAVA_VERSION!" == "" (
call "!FJ_SCRIPT!" fun version_ge !FJ_JAVA_VERSION! !FJ_MIN_UNSUPPORTED_JAVA_VERSION! <nul
if "!ERRORLEVEL!" == "0" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Version is not supported ^(!FJ_MIN_UNSUPPORTED_JAVA_VERSION!+^) 1>&2
goto exit_fail
)
)
if not "!FJ_LOOK_FOR_SERVER_JAVA!" == "" (
call "!FUN_ARG_PATH!" -server -version 1>nul 2>nul <nul
if not "!ERRORLEVEL!" == "0" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Not a server Java 1>&2
goto exit_fail
)
)
if not "!FJ_LOOK_FOR_X64_JAVA!" == "" (
rem This code works for Java 1.7+ only.
call "!FUN_ARG_PATH!" -d64 -version 1>nul 2>nul <nul
if not "!ERRORLEVEL!" == "0" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Not an x64 Java 1>&2
goto exit_fail
)
)
if not "!FJ_LOOK_FOR_X86_JAVA!" == "" (
rem This code works for Java 1.7+ only.
call "!FUN_ARG_PATH!" -d32 -version 1>nul 2>nul <nul
if not "!ERRORLEVEL!" == "0" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Not an x86 Java 1>&2
goto exit_fail
)
)
if not "!FJ_DEBUG!" == "" (
echo [!TIME!] !FJ_DEBUG_INDENT! Java found^^! 1>&2
echo. 1>&2
)
goto exit_ok
)
rem --------------------------------------------------------------------------------------
rem "check_dir" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified directory #3 is JDK home or JRE home, -1 otherwise.
rem Sets FJ_JAVA_EXEC and FJ_JAVA_VERSION variables on success.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "check_dir" (
if "!FUN_ARG1!" == "" goto exit_fail
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT!Checking directory: !FUN_ARG_PATH! 1>&2
if not exist "!FUN_ARG_PATH!" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] !FJ_DEBUG_INDENT! Directory does not exist 1>&2
goto exit_fail
)
call "!FJ_SCRIPT!" fun check_java "!FUN_ARG_PATH!\jre\bin\java.exe" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun check_java "!FUN_ARG_PATH!\bin\java.exe" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
goto exit_fail
)
rem --------------------------------------------------------------------------------------
rem "scan_dir" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified directory #3 is JDK home or JRE home or contains a child directory, which is JDK home or JRE home, -1 otherwise.
rem Sets FJ_JAVA_EXEC and FJ_JAVA_VERSION variables on success.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "scan_dir" (
if "!FUN_ARG1!" == "" goto exit_fail
if not "!FJ_DEBUG!" == "" echo [!TIME!] Scanning directory: !FUN_ARG_PATH! 1>&2
if not exist "!FUN_ARG_PATH!" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Directory does not exist 1>&2
goto exit_fail
)
call "!FJ_SCRIPT!" fun check_dir "!FUN_ARG_PATH!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
for /f %%i in ('dir "!FUN_ARG_PATH!" /A:D /B /O:-D /X 2^>nul') do (
endlocal
set "II=%%i"
setlocal enabledelayedexpansion
call "!FJ_SCRIPT!" fun check_dir "!FUN_ARG_PATH!\!II!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
goto exit_fail
)
rem --------------------------------------------------------------------------------------
rem "check_reg_version_key" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified registry Java version key #3 exists and has the specified Java home, -1 otherwise.
rem Sets FJ_JAVA_EXEC and FJ_JAVA_VERSION variables on success.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "check_reg_version_key" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking registry key: !FUN_ARG1! 1>&2
for /f "tokens=2*" %%a in ('reg query "!FUN_ARG1!" /v JavaHome 2^>nul ^| find "JavaHome"') do (
endlocal
set "BB=%%b"
setlocal enabledelayedexpansion
call "!FJ_SCRIPT!" fun check_dir "!BB!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
goto exit_fail
)
rem --------------------------------------------------------------------------------------
rem "scan_reg_key" function
rem --------------------------------------------------------------------------------------
rem Returns exit code 0 if the specified registry key "#3\#4" contains a child version key with the specified Java home, -1 otherwise.
rem Sets FJ_JAVA_EXEC and FJ_JAVA_VERSION variables on success.
rem --------------------------------------------------------------------------------------
if "!FUN_NAME!" == "scan_reg_key" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Scanning registry key: !FUN_ARG1!\!FUN_ARG2! 1>&2
for /f "tokens=5* delims=\" %%x in ('reg query "!FUN_ARG1!\!FUN_ARG2!" 2^>nul ^| findstr /i /c:"!FUN_ARG2!\\"') do (
endlocal
set "XX=%%x"
set "YY=%%y"
setlocal enabledelayedexpansion
if "!YY!" == "" (
call "!FJ_SCRIPT!" fun check_reg_version_key "!FUN_ARG1!\!FUN_ARG2!\!XX!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
) else (
call "!FJ_SCRIPT!" fun check_reg_version_key "!FUN_ARG1!\!FUN_ARG2!\!YY!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
)
goto exit_fail
)
goto exit_fail
)
rem **************************************************************************************
rem --------------------------------------------------------------------------------------
rem Script start
rem --------------------------------------------------------------------------------------
rem **************************************************************************************
endlocal
set "FJ_MIN_REQUIRED_JAVA_VERSION=%~1"
set "FJ_SCRIPT_NAME=%~nx0"
set "FJ_DEBUG_INDENT="
setlocal enabledelayedexpansion
if "!FJ_MIN_REQUIRED_JAVA_VERSION!" == "" (
echo. 1>&2
echo Usage: 1>&2
echo !FJ_SCRIPT_NAME! ^<Minimal required Java version^> [^<Additional search directory^> ^<Additional search directory^> ...] 1>&2
echo. 1>&2
echo E.g.: !FJ_SCRIPT_NAME! 1.8 1>&2
echo. 1>&2
echo Set FJ_LOOK_FOR_SERVER_JAVA environment variable to look for server Java only 1>&2
echo Set FJ_LOOK_FOR_X64_JAVA environment variable to look for x64 Java only 1>&2
echo Set FJ_LOOK_FOR_X86_JAVA environment variable to look for x86 Java only 1>&2
echo Set FJ_MIN_UNSUPPORTED_JAVA_VERSION environment variable to ignore Java starting from the specified version 1>&2
echo. 1>&2
exit /b 1
)
if not "!FJ_DEBUG!" == "" (
echo. 1>&2
echo Looking for Java !FJ_MIN_REQUIRED_JAVA_VERSION!+ 1>&2
if not "!FJ_LOOK_FOR_SERVER_JAVA!" == "" echo Looking for server Java 1>&2
if not "!FJ_LOOK_FOR_X64_JAVA!" == "" echo Looking for x64 Java 1>&2
if not "!FJ_LOOK_FOR_X86_JAVA!" == "" echo Looking for x86 Java 1>&2
if not "!FJ_MIN_UNSUPPORTED_JAVA_VERSION!" == "" echo Looking for Java less than !FJ_MIN_UNSUPPORTED_JAVA_VERSION! 1>&2
echo. 1>&2
)
rem Check if result is already found and is suitable
if not "!FJ_JAVA_EXEC!" == "" (
if not "!FJ_DEBUG!" == "" (
echo [!TIME!] Checking the previously found or explicitly specified Java 1>&2
echo [!TIME!] Checking Java: !FJ_JAVA_EXEC! 1>&2
)
if not exist "!FJ_JAVA_EXEC!" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Java executable does not exist 1>&2
) else (
if "!FJ_JAVA_VERSION!" == "" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Detecting Java version 1>&2
call "!FJ_SCRIPT!" fun detect_version "!FJ_JAVA_EXEC!" <nul
)
if "!FJ_JAVA_VERSION!" == "" (
if not "!FJ_DEBUG!" == "" echo [!TIME!] Version is unknown 1>&2
) else (
call "!FJ_SCRIPT!" fun check_java_internal "!FJ_JAVA_EXEC!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
)
)
endlocal
set "FJ_JAVA_EXEC="
set "FJ_JAVA_VERSION="
set "FJ_DEBUG_INDENT= "
setlocal enabledelayedexpansion
rem Check directories passed as parameters
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking directories passed as parameters 1>&2
endlocal
set "FJ_ALL_CUSTOM_DIRS="
:: -1 to ignore first argument
set "FJ_CUSTOM_DIRS_ARGC=-1"
for %%x in (%*) do set /A FJ_CUSTOM_DIRS_ARGC+=1
setlocal enabledelayedexpansion
:params_loop
if !FJ_CUSTOM_DIRS_ARGC! LEQ 0 goto params_loop_end
shift
endlocal
set "FJ_CUSTOM_DIR=%~1"
set "FJ_CUSTOM_DIR_PATH=%~df1"
set /A FJ_CUSTOM_DIRS_ARGC-=1
setlocal enabledelayedexpansion
if "!FJ_CUSTOM_DIR!" == "" goto params_loop
if not "!FJ_ALL_CUSTOM_DIRS!" == "" set "FJ_ALL_CUSTOM_DIRS=!FJ_ALL_CUSTOM_DIRS!, "
set "FJ_ALL_CUSTOM_DIRS=!FJ_ALL_CUSTOM_DIRS!^"!FJ_CUSTOM_DIR_PATH!^""
for /f "delims=" %%x in ("!FJ_ALL_CUSTOM_DIRS!") do (
endlocal
set "FJ_ALL_CUSTOM_DIRS=%%x"
setlocal enabledelayedexpansion
)
call "!FJ_SCRIPT!" fun scan_dir "!FJ_CUSTOM_DIR_PATH!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
goto params_loop
:params_loop_end
endlocal
set "FJ_CUSTOM_DIRS_ARGC="
set "FJ_DEBUG_INDENT= "
setlocal enabledelayedexpansion
if not "!FJ_SKIP_ALL_EXCEPT_ARGS!" == "" goto skip_all
rem Check JRE_HOME
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking JRE_HOME: !JRE_HOME! 1>&2
call "!FJ_SCRIPT!" fun check_dir "!JRE_HOME!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
rem Check JAVA_HOME
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking JAVA_HOME: !JAVA_HOME! 1>&2
call "!FJ_SCRIPT!" fun check_dir "!JAVA_HOME!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
rem Check JDK_HOME
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking JDK_HOME: !JDK_HOME! 1>&2
call "!FJ_SCRIPT!" fun check_dir "!JDK_HOME!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
endlocal
set "FJ_DEBUG_INDENT= "
setlocal enabledelayedexpansion
rem Check registry
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking registry 1>&2
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "SOFTWARE\JavaSoft\JRE" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "Software\Wow6432Node\JavaSoft\Java Runtime Environment" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "Software\JavaSoft\Java Runtime Environment" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "SOFTWARE\JavaSoft\JDK" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "Software\Wow6432Node\JavaSoft\Java Development Kit" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
call "!FJ_SCRIPT!" fun scan_reg_key "HKLM" "Software\JavaSoft\Java Development Kit" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
endlocal
set "FJ_DEBUG_INDENT= "
setlocal enabledelayedexpansion
rem Check Windows default places
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking default places 1>&2
if not "!ProgramW6432!" == "" (
call "!FJ_SCRIPT!" fun scan_dir "!ProgramW6432!\Java" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
if not "!ProgramFiles(x86)!" == "" (
call "!FJ_SCRIPT!" fun scan_dir "!ProgramFiles(x86)!\Java" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
) else if not "!ProgramFiles!" == "" (
call "!FJ_SCRIPT!" fun scan_dir "!ProgramFiles!\Java" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
endlocal
set "FJ_DEBUG_INDENT="
setlocal enabledelayedexpansion
rem Check Java in PATH
if not "!FJ_DEBUG!" == "" echo [!TIME!] Checking Java in PATH 1>&2
for /f %%i in ("java.exe") do (
endlocal
set "II=%%~fd$PATH:i"
setlocal enabledelayedexpansion
call "!FJ_SCRIPT!" fun check_java "!II!" <nul
if "!ERRORLEVEL!" == "0" goto exit_ok
)
:skip_all
rem Report 'no Java found'
echo. 1>&2
echo Java executable of version !FJ_MIN_REQUIRED_JAVA_VERSION! is not found: 1>&2
if not "!FJ_ALL_CUSTOM_DIRS!" == "" echo - Java executable is not found under the specified directories: !FJ_ALL_CUSTOM_DIRS! 1>&2
echo - Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 1>&2
echo - Path to JVM is not found in Windows registry 1>&2
echo - Java executable is not found in the default locations 1>&2
echo - Java executable is not found in the directories listed in the PATH environment variable 1>&2
echo. 1>&2
echo Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java ^(JRE^) installation 1>&2
if not "!FJ_MIN_UNSUPPORTED_JAVA_VERSION!" == "" echo Please note that all Java versions starting from !FJ_MIN_UNSUPPORTED_JAVA_VERSION! were skipped because stable operation on these Java versions is not guaranteed 1>&2
if "!FJ_DEBUG!" == "" (
echo. 1>&2
echo Environment variable FJ_DEBUG can be set to enable debug output 1>&2
)
echo. 1>&2
:exit_fail
if 0 == 0 (
endlocal
endlocal
set "FJ_JAVA_EXEC="
set "FJ_JAVA_VERSION="
)
exit /b -1
:exit_ok
if 0 == 0 (
endlocal
endlocal
set "FJ_JAVA_EXEC=%FJ_JAVA_EXEC%"
set "FJ_JAVA_VERSION=%FJ_JAVA_VERSION%"
)
exit /b 0

View file

@ -1,377 +0,0 @@
#!/bin/sh
# --------------------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE! ALL YOUR CHANGES WILL BE ELIMINATED AFTER AUTOMATIC UPGRADE.
# --------------------------------------------------------------------------------------
# Searches for Java executable
# Usage: . findJava.sh; find_java <Minimal Java Version> [<Additional search directory> <Additional search directory> ...]
# E.g.: . findJava.sh; find_java 1.8
# Set FJ_LOOK_FOR_SERVER_JAVA environment variable to look for server Java only
# Set FJ_LOOK_FOR_X64_JAVA environment variable to look for x64 Java only
# Set FJ_LOOK_FOR_X86_JAVA environment variable to look for x86 Java only
# Set FJ_MIN_UNSUPPORTED_JAVA_VERSION environment variable to ignore Java starting from the specified version
# --------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------
# Determines version of Java executable located at $1.
# Returns 0 and sets determined version to $FJ_JAVA_VERSION variable on success, returns 1 otherwise.
# --------------------------------------------------------------------------------------
detect_version() {
if [ -z "$1" ]; then return 1; fi
eval "$1" -version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then return 1; fi
FJ_JAVA_VERSION=`"$1" -version 2>&1 | grep "version" | awk '-F"' '{print($2)}'`
if [ -z "$FJ_JAVA_VERSION" ]; then return 1; fi
return 0
}
# --------------------------------------------------------------------------------------
# Returns 0 if Java version ($1) is greater than or equal to $2, 1 otherwise.
# --------------------------------------------------------------------------------------
version_ge() {
v1=`echo "$1" | sed -e 's/[-_+].*//g' 2>/dev/null`
v2=`echo "$2" | sed -e 's/[-_+].*//g' 2>/dev/null`
major1=`echo "$v1" | awk -F. '{print($1)}' 2>/dev/null`
minor1=`echo "$v1" | awk -F. '{print($2)}' 2>/dev/null`
major2=`echo "$v2" | awk -F. '{print($1)}' 2>/dev/null`
minor2=`echo "$v2" | awk -F. '{print($2)}' 2>/dev/null`
if [ $major1 -eq 1 -a -n "$minor1" ]; then
major1="$minor1"
minor1=`echo "$v1" | awk -F. '{print($3)}' 2>/dev/null`
fi
if [ $major2 -eq 1 -a -n "$minor2" ]; then
major2="$minor2"
minor2=`echo "$v2" | awk -F. '{print($3)}' 2>/dev/null`
fi
if [ -z "$minor1" ]; then
minor1="0"
fi
if [ -z "$minor2" ]; then
minor2="0"
fi
if [ $major1 -eq $major2 ]; then
test $minor1 -ge $minor2
return $?
else
test $major1 -gt $major2
return $?
fi
}
# --------------------------------------------------------------------------------------
# Returns 0 if the specified Java executable ($1) exists, has proper version and is server/x64 if needed; 1 otherwise.
# Sets $FJ_JAVA_EXEC and $FJ_JAVA_VERSION variables on success.
# --------------------------------------------------------------------------------------
check_java() {
if [ -z "$1" ]; then return 1; fi
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Checking Java: $1" 1>&2; fi
if [ ! -f "$1" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Java executable does not exist" 1>&2; fi
return 1
fi
detect_version "$1"
if [ $? -ne 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Failed to detect Java version" 1>&2; fi
return 1
fi
check_java_internal "$1"
if [ $? -ne 0 ]; then
FJ_JAVA_VERSION=""
return 1
fi
FJ_JAVA_EXEC="$1"
return 0
}
# --------------------------------------------------------------------------------------
# Returns 0 if the specified Java executable ($1) has proper version and is server/x64 if needed; 1 otherwise.
# --------------------------------------------------------------------------------------
check_java_internal() {
if [ -z "$1" ]; then return 1; fi
if [ -z "$FJ_JAVA_VERSION" ]; then return 1; fi
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Version: $FJ_JAVA_VERSION" 1>&2; fi
version_ge $FJ_JAVA_VERSION $FJ_MIN_REQUIRED_JAVA_VERSION
if [ $? -ne 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Version is not suitable (less than $FJ_MIN_REQUIRED_JAVA_VERSION)" 1>&2; fi
return 1
fi
if [ -n "$FJ_MIN_UNSUPPORTED_JAVA_VERSION" ]; then
version_ge $FJ_JAVA_VERSION $FJ_MIN_UNSUPPORTED_JAVA_VERSION
if [ $? -eq 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Version is not supported (${FJ_MIN_UNSUPPORTED_JAVA_VERSION}+)" 1>&2; fi
return 1
fi
fi
if [ -n "$FJ_LOOK_FOR_SERVER_JAVA" ]; then
eval "$1" -server -version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Not a server Java" 1>&2; fi
return 1
fi
fi
if [ -n "$FJ_LOOK_FOR_X64_JAVA" ]; then
# This code works for Java 1.7+ only.
eval "$1" -d64 -version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Not an x64 Java" 1>&2; fi
return 1
fi
fi
if [ -n "$FJ_LOOK_FOR_X86_JAVA" ]; then
# This code works for Java 1.7+ only.
eval "$1" -d32 -version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Not an x86 Java" 1>&2; fi
return 1
fi
fi
if [ -n "$FJ_DEBUG" ]; then
echo "[`date +%T`] $FJ_DEBUG_INDENT Java found!" 1>&2
echo "" 1>&2
fi
return 0
}
# --------------------------------------------------------------------------------------
# Returns 0 if the specified directory ($1) is JDK home or JRE home, 1 otherwise.
# Sets $FJ_JAVA_EXEC and $FJ_JAVA_VERSION variables on success.
# --------------------------------------------------------------------------------------
check_dir() {
if [ -z "$1" ]; then return 1; fi
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] ${FJ_DEBUG_INDENT}Checking directory: $1" 1>&2; fi
if [ ! -d "$1" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] $FJ_DEBUG_INDENT Directory does not exist" 1>&2; fi
return 1
fi
check_java "$1/jre/bin/java"
if [ $? -eq 0 ]; then return 0; fi
check_java "$1/bin/java"
return $?
}
# --------------------------------------------------------------------------------------
# Returns 0 if the specified directory ($1) is JDK home or JRE home or contains a child directory, which is JDK home or JRE home, 1 otherwise.
# Additional relative path can be specified in $2.
# Sets $FJ_JAVA_EXEC and $FJ_JAVA_VERSION variables on success.
# --------------------------------------------------------------------------------------
scan_dir() {
if [ -z "$1" ]; then return 1; fi
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Scanning directory: $1" 1>&2; fi
if [ ! -d "$1" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Directory does not exist" 1>&2; fi
return 1
fi
check_dir "$1$2"
if [ $? -eq 0 ]; then return 0; fi
for child in $1/*; do
if [ -d "$child" ]; then
check_dir "$child$2"
if [ $? -eq 0 ]; then return 0; fi
fi
done
return 1
}
# --------------------------------------------------------------------------------------
# Main entry point.
# Returns 0 if Java of the version not less than $1 is found, 1 on incorrect usage, 2 otherwise.
# Sets $FJ_JAVA_EXEC and $FJ_JAVA_VERSION variables on success.
# --------------------------------------------------------------------------------------
find_java() {
FJ_DEBUG_INDENT=""
FJ_MIN_REQUIRED_JAVA_VERSION="$1"
if [ -z "$FJ_MIN_REQUIRED_JAVA_VERSION" ]; then
echo "" 1>&2
echo "Usage:" 1>&2
echo " . findJava.sh; find_java <Minimal required Java version> [<Additional search directory> <Additional search directory> ...]" 1>&2
echo "" 1>&2
echo "E.g.: . findJava.sh; find_java 1.8" 1>&2
echo "" 1>&2
echo "Set FJ_LOOK_FOR_SERVER_JAVA environment variable to look for server Java only" 1>&2
echo "Set FJ_LOOK_FOR_X64_JAVA environment variable to look for x64 Java only" 1>&2
echo "Set FJ_LOOK_FOR_X86_JAVA environment variable to look for x86 Java only" 1>&2
echo "Set FJ_MIN_UNSUPPORTED_JAVA_VERSION environment variable to ignore Java starting from the specified version" 1>&2
echo "" 1>&2
return 1
fi
if [ -n "$FJ_DEBUG" ]; then
echo "" 1>&2
echo "Looking for Java ${FJ_MIN_REQUIRED_JAVA_VERSION}+" 1>&2
if [ -n "$FJ_LOOK_FOR_SERVER_JAVA" ]; then echo "Looking for server Java" 1>&2; fi
if [ -n "$FJ_LOOK_FOR_X64_JAVA" ]; then echo "Looking for x64 Java" 1>&2; fi
if [ -n "$FJ_LOOK_FOR_X86_JAVA" ]; then echo "Looking for x86 Java" 1>&2; fi
if [ -n "$FJ_MIN_UNSUPPORTED_JAVA_VERSION" ]; then echo "Looking for Java less than $FJ_MIN_UNSUPPORTED_JAVA_VERSION" 1>&2; fi
echo "" 1>&2;
fi
# Check if result is already found and is suitable
if [ -n "$FJ_JAVA_EXEC" ]; then
if [ -n "$FJ_DEBUG" ]; then
echo "[`date +%T`] Checking the previously found or explicitly specified Java" 1>&2
echo "[`date +%T`] Checking Java: $FJ_JAVA_EXEC" 1>&2
fi
if [ ! -f "$FJ_JAVA_EXEC" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Java executable does not exist" 1>&2; fi
else
if [ -z "$FJ_JAVA_VERSION" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Detecting Java version" 1>&2; fi
detect_version "$FJ_JAVA_EXEC"
fi
if [ -z "$FJ_JAVA_VERSION" ]; then
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Version is unknown" 1>&2; fi
else
check_java_internal "$FJ_JAVA_EXEC"
if [ $? -eq 0 ]; then return 0; fi
fi
fi
fi
FJ_JAVA_EXEC=""
FJ_JAVA_VERSION=""
FJ_DEBUG_INDENT=" "
# Check directories passed as parameters
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking directories passed as parameters" 1>&2; fi
FJ_ALL_CUSTOM_DIRS=""
shift
for dir in "$@"; do
scan_dir "$dir"
if [ $? -eq 0 ]; then return 0; fi
if [ -n "$FJ_ALL_CUSTOM_DIRS" ]; then FJ_ALL_CUSTOM_DIRS="$FJ_ALL_CUSTOM_DIRS, "; fi
FJ_ALL_CUSTOM_DIRS="$FJ_ALL_CUSTOM_DIRS'$dir'"
done
FJ_DEBUG_INDENT=" "
if [ -n "$FJ_SKIP_ALL_EXCEPT_ARGS" ]; then
return 2
fi
# Check JRE_HOME
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking JRE_HOME: $JRE_HOME" 1>&2; fi
check_dir "$JRE_HOME"
if [ $? -eq 0 ]; then return 0; fi
# Check JAVA_HOME
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking JAVA_HOME: $JAVA_HOME" 1>&2; fi
check_dir "$JAVA_HOME"
if [ $? -eq 0 ]; then return 0; fi
# Check JDK_HOME
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking JDK_HOME: $JDK_HOME" 1>&2; fi
check_dir "$JDK_HOME"
if [ $? -eq 0 ]; then return 0; fi
# Mac OS X
test `uname` = "Darwin"
IS_MAC=$?
if [ $IS_MAC -eq 0 ]; then
# Try java_home utility first
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Trying 'java_home' utility" 1>&2; fi
check_dir `/usr/libexec/java_home -v $FJ_MIN_REQUIRED_JAVA_VERSION 2>/dev/null`
if [ $? -eq 0 ]; then return 0; fi
check_dir `/usr/libexec/java_home 2>/dev/null`
if [ $? -eq 0 ]; then return 0; fi
FJ_DEBUG_INDENT=" "
# Check Mac OS X default place
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking default places" 1>&2; fi
scan_dir "/Library/Java/JavaVirtualMachines" "/Contents/Home"
if [ $? -eq 0 ]; then return 0; fi
scan_dir "/System/Library/Java/JavaVirtualMachines" "/Contents/Home"
if [ $? -eq 0 ]; then return 0; fi
scan_dir "/System/Library/Frameworks/JavaVM.framework/Versions" "/Home"
if [ $? -eq 0 ]; then return 0; fi
FJ_DEBUG_INDENT=" "
check_dir "/System/Library/Frameworks/JavaVM.framework/Home"
if [ $? -eq 0 ]; then return 0; fi
check_dir "/Library/Java/Home"
if [ $? -eq 0 ]; then return 0; fi
fi
FJ_DEBUG_INDENT=" "
# Check Linux default places
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking default places" 1>&2; fi
scan_dir "/usr/lib/jvm"
if [ $? -eq 0 ]; then return 0; fi
scan_dir "/usr/java"
if [ $? -eq 0 ]; then return 0; fi
scan_dir "/usr/local/java"
if [ $? -eq 0 ]; then return 0; fi
FJ_DEBUG_INDENT=""
# Check Java in PATH
if [ -n "$FJ_DEBUG" ]; then echo "[`date +%T`] Checking Java in PATH" 1>&2; fi
check_java `which java 2>/dev/null`
if [ $? -eq 0 ]; then return 0; fi
check_java java
if [ $? -eq 0 ]; then return 0; fi
# Report 'no Java found'
echo "" 1>&2
echo "Java executable of version $FJ_MIN_REQUIRED_JAVA_VERSION is not found:" 1>&2
if [ -n "$FJ_ALL_CUSTOM_DIRS" ]; then echo "- Java executable is not found under the specified directories: $FJ_ALL_CUSTOM_DIRS" 1>&2; fi
echo "- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined" 1>&2
if [ $IS_MAC -eq 0 ]; then
echo "- Java executable is not found using 'java_home' utility" 1>&2
fi
echo "- Java executable is not found in the default locations" 1>&2
echo "- Java executable is not found in the directories listed in the PATH environment variable" 1>&2
echo "" 1>&2
echo "Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java (JRE) installation" 1>&2
if [ -n "$FJ_MIN_UNSUPPORTED_JAVA_VERSION" ]; then
echo "Please note that all Java versions starting from $FJ_MIN_UNSUPPORTED_JAVA_VERSION were skipped because stable operation on these Java versions is not guaranteed" 1>&2;
fi
if [ -z "$FJ_DEBUG" ]; then
echo "" 1>&2
echo "Environment variable FJ_DEBUG can be set to enable debug output" 1>&2
fi
echo "" 1>&2
return 2
}

View file

@ -1,40 +0,0 @@
@echo off
:: ---------------------------------------------------------------------
:: The script looking into Windows Registry for non-existent Service Name starting from <DEFAULT_SERVICE_NAME>
:: Set NEW_SERVICE_NAME environment variable with found one.
::
:: %1 Default service name
:: ---------------------------------------------------------------------
IF "%1"=="" (
echo "Usage: generateNewServiceName.bat <DEFAULT_SERVICE_NAME>"
exit /b 1
)
SET DEFAULT_SERVICE_NAME=%1
SET NEW_SERVICE_NAME=
:: Check deafult
SC QUERY %DEFAULT_SERVICE_NAME%|find "STATE" >NUL 2>&1
IF ERRORLEVEL 1 (
set NEW_SERVICE_NAME=%DEFAULT_SERVICE_NAME%
ECHO %DEFAULT_SERVICE_NAME%
GOTO found
)
:: Scan for an empty slot
FOR /L %%A IN (1,1,100) DO (
SC QUERY %DEFAULT_SERVICE_NAME%-%%A|find "STATE" >NUL 2>&1
IF ERRORLEVEL 1 (
SET NEW_SERVICE_NAME=%DEFAULT_SERVICE_NAME%-%%A
ECHO %DEFAULT_SERVICE_NAME%-%%A
GOTO found
)
)
::No empty Service name found
exit /b 2
:found
exit /b 0

View file

@ -1,53 +0,0 @@
:: ---------------------------------------------------------------------
:: TeamCity build agent automatic installation script
:: ---------------------------------------------------------------------
:: Usage: install.bat <TC_Server_URL> <path_to_install_into> (authorization_token|-1) [<Service_running_account> [<Account_password>]]
::
:: %1 required: TeamCity Server root URL
:: %2 required: Agent Install location
:: %3 required: Authorization token. Must be "-1" if no auto registration required
:: %4 optional: Windows Service account
:: %5 optional: Account password
:: ---------------------------------------------------------------------
@ECHO OFF
:: Check second parameter and set target to folder if exists
SET SERVER_URL=%1%
SET AGENT_INSTALLATION_HOME=%2%
:: Remove superfluous quotations if exists
FOR /F "tokens=*" %%i in ("%AGENT_INSTALLATION_HOME%") do set AGENT_INSTALLATION_HOME=%%~i
ECHO Agent installation is executing on '%COMPUTERNAME%'...
ECHO Current directory: '%cd%'
systeminfo | find /I "System type"
SET TEAMCITY_JAVA_INSTALL_PATH=%AGENT_INSTALLATION_HOME%\jre
:: Check there is an installed JRE and break installation if not so
:checking_java
ECHO Looking for installed JRE...
set FJ_MIN_UNSUPPORTED_JAVA_VERSION=12
CALL "%cd%\bin\findJava.bat" "1.6" "%TEAMCITY_JAVA_INSTALL_PATH%"
IF NOT ERRORLEVEL 0 (
ECHO Warning: No installed JRE found.
goto download_jre
)
ECHO Installed JRE found.
GOTO perform_install
:download_jre
SET ERRORLEVEL=
CALL "%cd%\bin\installJava.bat" "%SERVER_URL%/update" "%TEAMCITY_JAVA_INSTALL_PATH%"
IF "%ERRORLEVEL%"=="0" GOTO checking_java
ECHO Could not install neither JDK nor JRE. Terminating[%ERRORLEVEL%]
SET ERRORLEVEL=1
GOTO end
:perform_install
SET ERRORLEVEL=
::%TEAMCITY_LAUNCHER_OPTS_ACTUAL%
"%FJ_JAVA_EXEC%" -Xmx128m -jar lib\agent-configurator.jar install %*
:end
EXIT /B %ERRORLEVEL%

View file

@ -1,66 +0,0 @@
#!/bin/sh
# ---------------------------------------------------------------------
# TeamCity build agent installation script
# ---------------------------------------------------------------------
# Parameters:
#
# $1 required: TeamCity Server URL
# $2 required: Authorization token. Must be "-1" if no auto registration required
# $3 optional: Agent account
# $4 optional: Account password
#
# ---------------------------------------------------------------------
TC_SERVER_URL="$1"
TC_AUTH_TOKEN="$2"
TC_AA_USERNAME="$3"
TC_AA_PASSWORD="$4"
echo "Installing TeamCity Agent for $TC_SERVER_URL"
if [ -z "$TC_SERVER_URL" ]; then
echo "usage $0 <TC Server URL>" >&2
exit 1
fi
##
# looking for Java
##
echo "Looking for Java Runtime Environment..."
chmod +x findJava.sh
. ./findJava.sh
FJ_MIN_UNSUPPORTED_JAVA_VERSION=12
find_java 1.6 "`pwd`/../jre" ;
if [ $? -ne 0 ]; then
echo "Cannot install the Agent due to JRE is not found. Please install JRE or JDK first."
exit 1
fi
##
# setup Agent properties
##
echo "Configuring the Agent's properties..."
cat ../conf/buildAgent.dist.properties | sed '/serverUrl=/ c\
serverUrl='"$TC_SERVER_URL"'' > ../conf/buildAgent.properties
# set authorization token if auto registration requested
if [ "$TC_AUTH_TOKEN" != "-1" ]; then
printf "\n%b\n" "agent.push.auth.key=$TC_AUTH_TOKEN" >> ../conf/buildAgent.properties
fi
##
# start agent
##
chmod +x agent.sh
pwd
if [ -n "$TC_AA_USERNAME" ]; then
echo "Starting the Agent under '$TC_AA_USERNAME' account..."
echo $TC_AA_PASSWORD|su $TC_AA_USERNAME -c "nohup ./agent.sh start"
else
echo "Starting the Agent under '`whoami`' account..."
nohup ./agent.sh start
fi
echo WARNING: The TeamCity Agent installed as standalone application and will not start automatically on machine reboot.
exit 0

View file

@ -1,67 +0,0 @@
:: ---------------------------------------------------------------------
:: Downloads and install/unzip JDK/JRE from a TeamCity Server/Sun
:: %1 TeamCity Server download url
:: %2 Installation directory
:: ---------------------------------------------------------------------
IF "%2%"=="" (
ECHO "Usage: installJava.bat <TeamCity Server download url> <Installation directory>"
SET ERRORLEVEL=2
GOTO end
)
SET TEAMCITY_DOWNLOAD_URL=%1%
SET TEAMCITY_JDK_WIN_ZIP=%TEAMCITY_DOWNLOAD_URL%/agent-jdk-win.zip
SET TEAMCITY_JRE_WIN_ZIP=%TEAMCITY_DOWNLOAD_URL%/agent-jre-win.zip
SET SUN_JRE_WIN_INSTALLER=http://javadl.sun.com/webapps/download/AutoDL?BundleId=48344
SET TEAMCITY_JAVA_INSTALL_PATH=%2%
FOR /F "tokens=*" %%i in ("%TEAMCITY_JAVA_INSTALL_PATH%") DO SET TEAMCITY_JAVA_INSTALL_PATH=%%~i
:: check bootsrapper's functionality available
IF "%TEAMCITY_BOOTSRAPPER_WIN%"=="" SET TEAMCITY_BOOTSRAPPER_WIN=bootstrapper.exe
"%TEAMCITY_BOOTSRAPPER_WIN%">NUL 2>&1
IF ERRORLEVEL 251 (
SET ERRORLEVEL=2
ECHO Could not find '%TEAMCITY_BOOTSRAPPER_WIN%'.
GOTO end
)
:: clean target if exist
IF EXIST "%TEAMCITY_JAVA_INSTALL_PATH%" (
ECHO Cleaning "%TEAMCITY_JAVA_INSTALL_PATH%"...
RMDIR /S /Q "%TEAMCITY_JAVA_INSTALL_PATH%"
)
:: try JDK
ECHO Attempt to download JDK from '%TEAMCITY_JDK_WIN_ZIP%'...
"%TEAMCITY_BOOTSRAPPER_WIN%" unzip -progress -u %TEAMCITY_JDK_WIN_ZIP% -d "%TEAMCITY_JAVA_INSTALL_PATH%"
IF NOT ERRORLEVEL 1 (
ECHO JDK unpacked into '%TEAMCITY_JAVA_INSTALL_PATH%'
GOTO end
)
:: try JRE
ECHO Attempt to download JRE from '%TEAMCITY_JRE_WIN_ZIP%'
"%TEAMCITY_BOOTSRAPPER_WIN%" unzip -progress -u %TEAMCITY_JRE_WIN_ZIP% -d "%TEAMCITY_JAVA_INSTALL_PATH%"
IF NOT ERRORLEVEL 1 (
ECHO JRE unpacked into '%TEAMCITY_JAVA_INSTALL_PATH%'
GOTO end
)
:: try JRE from SUN
ECHO Attempt to download JDK from Sun...
"%TEAMCITY_BOOTSRAPPER_WIN%" get -progress -u %SUN_JRE_WIN_INSTALLER% -d "sun-jre-win.exe"
IF NOT ERRORLEVEL 1 (
ECHO Installing JRE...
sun-jre-win.exe /s /v/qn
IF NOT ERRORLEVEL 1 (
DEL /F sun-jre-win.exe
ECHO JRE successfully installed
GOTO end
)
)
SET ERRORLEVEL=2
GOTO end
:end

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WorkingDirectory</key>
<string>/agent/home/directory</string>
<key>Debug</key>
<false/>
<key>Label</key>
<string>jetbrains.teamcity.BuildAgent</string>
<key>OnDemand</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>LowPriorityBackgroundIO</key>
<false/>
<key>LowPriorityIO</key>
<false/>
<key>ProcessType</key>
<string>Interactive</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>--login</string>
<string>-c</string>
<string>bin/agent.sh run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>logs/launchd.err.log</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
</dict>
</plist>

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WorkingDirectory</key>
<string>####WORKDIR</string>
<key>Debug</key>
<false/>
<key>Label</key>
<string>jetbrains.teamcity.BuildAgentUpgrade</string>
<key>OnDemand</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>####ARZ</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>logs/launchd.upgrade.err.log</string>
<key>StandardOutPath</key>
<string>logs/launchd.upgrade.out.log</string>
</dict>
</plist>

View file

@ -1,53 +0,0 @@
#!/bin/sh
# This script requires 'load' or 'unload' parameter
old_cwd=`pwd`
cd `dirname $0`
cd ..
INSTALL_DIR=`pwd`
mkdir logs >/dev/null 2>&1
cd bin
## Fix attributes for service launcher
chmod +x ../launcher/bin/*
chmod +x ./*
exit1() {
cd "$old_cwd"
exit $1
}
case "$1" in
upgrade)
launchctl load jetbrains.teamcity.BuildAgentUpgrade.plist
;;
upgradeend)
launchctl unload jetbrains.teamcity.BuildAgentUpgrade.plist
;;
load|unload)
PLIST=jetbrains.teamcity.BuildAgent.plist
## Update WorkingDirectory in plist file:
/usr/libexec/PlistBuddy -c "Set :WorkingDirectory $INSTALL_DIR" $PLIST
## fix path to java
sed -i -e "s/wrapper.java.command=.*/wrapper.java.command=java/" ../launcher/conf/wrapper.conf
## Process service load/unload
launchctl $1 jetbrains.teamcity.BuildAgent.plist
;;
*)
echo "JetBrains TeamCity Build Agent Mac launchctl starter"
echo "Usage: "
echo " $0 load - to start build agent deamon"
echo " $0 unload - to stop build agent deamon"
echo " "
;;
esac
exit1 0

View file

@ -1 +0,0 @@
..\launcher\bin\TeamCityAgentService-windows-x86-32.exe -i ../conf/wrapper.conf

View file

@ -1 +0,0 @@
..\launcher\bin\TeamCityAgentService-windows-x86-32.exe -t ../conf/wrapper.conf

View file

@ -1 +0,0 @@
..\launcher\bin\TeamCityAgentService-windows-x86-32.exe -p ../conf/wrapper.conf

View file

@ -1 +0,0 @@
..\launcher\bin\TeamCityAgentService-windows-x86-32.exe -r ../conf/wrapper.conf

View file

@ -1,82 +0,0 @@
:: ---------------------------------------------------------------------
:: TeamCity build agent automatic uninstallation script
:: ---------------------------------------------------------------------
:: %1 path to Agent folder
:: ---------------------------------------------------------------------
@ECHO OFF
FOR /F "tokens=*" %%i in ("%1") DO SET AGENT_UNINSTALLATION_HOME=%%~i
IF "%AGENT_UNINSTALLATION_HOME%"=="" GOTO print_usage
SET LEFT_JRE=FALSE
IF /i "%2%" EQU "LEFT_JRE" (
SET LEFT_JRE=TRUE
)
SET ERRORLEVEL=
:: Check the folder exist
IF NOT EXIST "%AGENT_UNINSTALLATION_HOME%" (
ECHO Could not find "%AGENT_UNINSTALLATION_HOME%". Skip the operation.
SET ERRORLEVEL=
GOTO end
)
PUSHD .
IF EXIST "%AGENT_UNINSTALLATION_HOME%\bin" (
CD /d "%AGENT_UNINSTALLATION_HOME%\bin"
ECHO Stopping the Agent...
IF EXIST "%AGENT_UNINSTALLATION_HOME%\bin\agent.bat" (
CALL agent.bat stop force
ECHO Waiting the Agent is shutdown completely...
:: timeout is implemented using ping because standard timeout utility does not work in non interactive mode
ping 127.0.0.1 -n 15 >NUL
) ELSE (
ECHO Could not find "%AGENT_UNINSTALLATION_HOME%\bin\agent.bat". Skip Agent shutdown
)
ECHO Uninstalling TeamCity Build Agent Service...
IF EXIST "%AGENT_UNINSTALLATION_HOME%\bin\service.uninstall.bat" (
CALL service.uninstall.bat
) ELSE (
ECHO Could not find "%AGENT_UNINSTALLATION_HOME%\bin\service.uninstall.bat". Skip the Service uninstalling
)
POPD
GOTO remove_agent_files
)
ECHO Could not find "%AGENT_UNINSTALLATION_HOME%\bin". Skip the Agent shutdown and Windows Service uninstalling.
:remove_agent_files
ECHO Cleaning TeamCity Build Agent directory...
::do not touch 'JRE' if exists
IF EXIST "%AGENT_UNINSTALLATION_HOME%\jre" (
IF "%LEFT_JRE%"=="TRUE" (
SET ERRORLEVEL=
::Directories
FOR /F "tokens=*" %%i in ('dir "%AGENT_UNINSTALLATION_HOME%" /X /B /a:d') DO (
IF /i "%%i" NEQ "JRE" (
RMDIR /S /Q "%AGENT_UNINSTALLATION_HOME%\%%i">NUL 2>&1
)
)
::Files
FOR /F "tokens=*" %%i in ('dir "%AGENT_UNINSTALLATION_HOME%" /X /B /a:-d') DO (
DEL "%AGENT_UNINSTALLATION_HOME%\%%i" /F /Q>NUL 2>&1
)
) ELSE (
SET ERRORLEVEL=
RMDIR /S /Q "%AGENT_UNINSTALLATION_HOME%"
)
) ELSE (
SET ERRORLEVEL=
RMDIR /S /Q "%AGENT_UNINSTALLATION_HOME%"
)
::IF "%ERRORLEVEL%"=="0" GOTO end
::ECHO Could not remove the Agent's folder[%ERRORLEVEL%].
GOTO end
:print_usage
ECHO "Usage: uninstall.bat <path_to_agent_folder>"
SET ERRORLEVEL=1
:end
SET ERRORLEVEL=0

View file

@ -1,52 +0,0 @@
## TeamCity build agent configuration file
######################################
# Required Agent Properties #
######################################
## The address of the TeamCity server. The same as is used to open TeamCity web interface in the browser.
## Example: serverUrl=https://buildserver.mydomain.com:8111
serverUrl=http://localhost:8111/
## The unique name of the agent used to identify this agent on the TeamCity server
## Use blank name to let server generate it.
## By default, this name would be created from the build agent's host name
name=
## Container directory to create default checkout directories for the build configurations.
## TeamCity agent assumes ownership of the directory and will delete unknown directories inside.
workDir=../work
## Container directory for the temporary directories.
## TeamCity agent assumes ownership of the directory. The directory may be cleaned between the builds.
tempDir=../temp
## Container directory for agent state files and caches.
## TeamCity agent assumes ownership of the directory and can delete content inside.
systemDir=../system
######################################
# Optional Agent Properties #
######################################
## A token which is used to identify this agent on the TeamCity server for agent authorization purposes.
## It is automatically generated and saved back on the first agent connection to the server.
authorizationToken=
######################################
# Default Build Properties #
######################################
## All properties starting with "system.name" will be passed to the build script as "name"
## All properties starting with "env.name" will be set as environment variable "name" for the build process
## Note that value should be properly escaped. (use "\\" to represent single backslash ("\"))
## More on file structure: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
# Build Script Properties
#system.exampleProperty=example Value
# Environment Variables
#env.exampleEnvVar=example Env Value

View file

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Authors: Chris Taylor, Ceki Gulcu. -->
<!-- A configuration element consists of optional renderer
elements,appender elements, categories and an optional root
element. -->
<!ELEMENT log4j:configuration (renderer*, appender*,category*,root?)>
<!-- The disable attribute takes a priority value such that all -->
<!-- logging statements with a priority equal or below this value are -->
<!-- disabled. -->
<!-- The disableOverride attribute allows the user to override any -->
<!-- BasicConfigurator.disable invocations made from within the -->
<!-- application. -->
<!-- By default, disableOverride is "null", meaning that we -->
<!-- do not touch the disable flag. -->
<!-- Setting the "debug" or "configDebug" attributes enable the printing -->
<!-- of internal log4j logging statements. -->
<!-- The "debug" and "configDebug" attributes are equivalent although -->
<!-- the latter is deprecated and should no longer be used. -->
<!-- By default, debug and configDebug attributes are "null", meaning -->
<!-- that we not touch internal log4j logging settings. -->
<!ATTLIST log4j:configuration
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
disable (debug|info|warn|error|fatal|null) "null"
disableOverride (true|false|null) "null"
debug (true|false|null) "null"
configDebug (true|false|null) "null"
>
<!-- DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED -->
<!-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -->
<!-- DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED -->
<!-- Use "log4j:configuration" above instead of the "configuration" -->
<!-- element. -->
<!-- DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED -->
<!-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING -->
<!-- DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED -->
<!ELEMENT configuration (renderer*, appender*,category*,root?)>
<!ATTLIST configuration
disable (debug|info|warn|error|fatal|null) "null"
disableOverride (true|false|null) "null"
configDebug (true|false|null) "null"
>
<!-- renderer elements allow the user to customize the conversion of -->
<!-- message objects to String. -->
<!ELEMENT renderer EMPTY>
<!ATTLIST renderer
renderedClass CDATA #REQUIRED
renderingClass CDATA #REQUIRED
>
<!-- Appenders must have a name and a class. -->
<!-- Appenders may contain an error handler, a layout, optional parameters -->
<!-- and filters. They may also reference (or include) other appenders. -->
<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
<!ATTLIST appender
name ID #REQUIRED
class CDATA #REQUIRED
>
<!ELEMENT layout (param*)>
<!ATTLIST layout
class CDATA #REQUIRED
>
<!ELEMENT filter (param*)>
<!ATTLIST filter
class CDATA #REQUIRED
>
<!-- ErrorHandlers can be of any class. They can admit any number of -->
<!-- parameters. -->
<!ELEMENT errorHandler (param*)>
<!ATTLIST errorHandler
class CDATA #REQUIRED
>
<!ELEMENT param EMPTY>
<!ATTLIST param
name CDATA #REQUIRED
value CDATA #REQUIRED
>
<!-- The priority class is org.apache.log4j.Priority by default -->
<!ELEMENT priority (param*)>
<!ATTLIST priority
class CDATA #IMPLIED
value CDATA #REQUIRED
>
<!-- If no priority element is specified, then the configurator MUST not -->
<!-- touch the priority of the named category. -->
<!ELEMENT category (param*, priority?, appender-ref*)>
<!ATTLIST category
class CDATA #IMPLIED
name CDATA #REQUIRED
additivity (true|false) "true"
>
<!ELEMENT appender-ref EMPTY>
<!ATTLIST appender-ref
ref IDREF #REQUIRED
>
<!-- If no priority element is specified, then the configurator MUST not -->
<!-- touch the priority of root. -->
<!-- The root category always exists and cannot be subclassed. -->
<!ELEMENT root (param*, priority?, appender-ref*)>
<!-- ==================================================================== -->
<!-- A logging event -->
<!-- ==================================================================== -->
<!ELEMENT log4j:eventSet (log4j:event*)>
<!ATTLIST log4j:eventSet
includesLocationInfo (true|false) "true"
>
<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
log4j:locationInfo?) >
<!-- The timestamp format is application dependent. -->
<!ATTLIST log4j:event
category CDATA #REQUIRED
priority CDATA #REQUIRED
thread CDATA #REQUIRED
timestamp CDATA #REQUIRED
>
<!ELEMENT log4j:message (#PCDATA)>
<!ELEMENT log4j:NDC (#PCDATA)>
<!ELEMENT log4j:throwable (#PCDATA)>
<!ELEMENT log4j:locationInfo EMPTY>
<!ATTLIST log4j:locationInfo
class CDATA #REQUIRED
method CDATA #REQUIRED
file CDATA #REQUIRED
line CDATA #REQUIRED
>

View file

@ -1,163 +0,0 @@
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE log4j:configuration SYSTEM "./log4j.dtd">
<!--
To enable debug logging remove XML comments in the lines below that are marked with "DELETE THIS LINE FOR ENABLING DEBUG LOGGING" text.
The file can be modified without application restart, but some changes can still require restart to take effect.
You might also need to increase the number of files to store to prevent logs from quick rotation
<param name="maxBackupIndex" value="20"/>
-->
<log4j:configuration>
<appender name="CONSOLE-INFO" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.out"/>
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMax" value="INFO"/>
</filter>
</appender>
<appender name="CONSOLE-WARN" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err"/>
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN"/>
</filter>
</appender>
<appender name="ROLL" class="jetbrains.buildServer.util.TCRollingFileAppender">
<param name="file" value="${teamcity_logs}/teamcity-agent.log"/>
<param name="maxBackupIndex" value="3"/>
<!--REPLACE PREVIOUS LINE WITH UNCOMMENTED LINE TO STORE MORE LOGS-->
<!-- <param name="maxBackupIndex" value="20"/> -->
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
<filter class="jetbrains.buildServer.log.CategoryFilter">
<param name="DenyCategory" value="jetbrains.buildServer.VCS"/>
</filter>
<filter class="jetbrains.buildServer.log.CategoryFilter">
<param name="DenyCategory" value="javasvn.output"/>
</filter>
<filter class="jetbrains.buildServer.log.CategoryFilter">
<param name="DenyCategory" value="jetbrains.buildServer.plugins.spring.SpringPluginLoader$TeamCityPlugin*"/>
<param name="MaxDenyLevel" value="INFO"/>
</filter>
</appender>
<appender name="SVN.LOG" class="jetbrains.buildServer.util.TCRollingFileAppender">
<param name="file" value="${teamcity_logs}/teamcity-svn.log"/>
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
</appender>
<appender name="ROLL.VCS" class="jetbrains.buildServer.util.TCRollingFileAppender">
<param name="file" value="${teamcity_logs}/teamcity-vcs.log"/>
<param name="maxBackupIndex" value="2"/>
<!--REPLACE PREVIOUS LINE WITH UNCOMMENTED LINE TO STORE MORE LOGS-->
<!-- <param name="maxBackupIndex" value="20"/> -->
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG"/>
</filter>
</appender>
<appender name="ROLL.XMLRPC" class="jetbrains.buildServer.util.TCRollingFileAppender">
<param name="file" value="${teamcity_logs}/teamcity-xmlrpc.log"/>
<param name="maxBackupIndex" value="3"/>
<!--REPLACE PREVIOUS LINE WITH UNCOMMENTED LINE TO STORE MORE LOGS-->
<!-- <param name="maxBackupIndex" value="20"/> -->
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %30.30c - %m%n"/>
</layout>
</appender>
<appender name="ROLL.BUILD" class="jetbrains.buildServer.util.TCRollingFileAppender">
<param name="file" value="${teamcity_logs}/teamcity-build.log"/>
<param name="maxBackupIndex" value="1"/>
<!--REPLACE PREVIOUS LINE WITH UNCOMMENTED LINE TO STORE MORE LOGS-->
<!-- <param name="maxBackupIndex" value="20"/> -->
<layout class="jetbrains.buildServer.log.MessagesFilterLayout">
<param name="ConversionPattern" value="[%d] %6p - %m%n"/>
</layout>
</appender>
<!--================================================================-->
<category name="jetbrains.buildServer.VCS">
<priority value="INFO"/>
<appender-ref ref="ROLL.VCS"/>
</category>
<category name="jetbrains.buildServer">
<!--DELETE THIS LINE FOR ENABLING DEBUG LOGGING--> <!--
<priority value="DEBUG"/>
--> <!--DELETE THIS LINE FOR ENABLING DEBUG LOGGING-->
<appender-ref ref="ROLL"/>
</category>
<category name="org.springframework">
<priority value="ERROR"/>
<appender-ref ref="ROLL"/>
</category>
<category name="jetbrains.buildServer.AGENT.registration">
<appender-ref ref="CONSOLE-INFO"/>
</category>
<category name="teamcity.out" additivity="false">
<appender-ref ref="ROLL.BUILD"/>
</category>
<category name="teamcity.err" additivity="false">
<appender-ref ref="ROLL.BUILD"/>
</category>
<category name="jetbrains.buildServer.XMLRPC">
<!--<priority value="DEBUG"/>-->
<appender-ref ref="ROLL.XMLRPC"/>
</category>
<category name="javasvn.output">
<!--<priority value="DEBUG"/>-->
<appender-ref ref="SVN.LOG"/>
</category>
<category name="httpclient.wire.header" additivity="false">
<priority value="ERROR"/>
<appender-ref ref="ROLL"/>
</category>
<category name="httpclient.wire.content" additivity="false">
<priority value="ERROR"/>
<appender-ref ref="ROLL"/>
</category>
<category name="org.apache.commons.httpclient" additivity="false">
<priority value="ERROR"/>
<appender-ref ref="ROLL"/>
</category>
<root>
<priority value="INFO"/>
<appender-ref ref="CONSOLE-WARN"/>
</root>
</log4j:configuration>

View file

@ -1,23 +0,0 @@
This directory contains examples of agent startup scripts for z/OS.
The scripts are provided by Teradata (http://www.teradata.com/).
These scripts should be placed into the agent installation directory (not
under "bin" folder, because its content is removed during agent upgrade).
The scripts are exemplary and thus may require additional tuning to work in
specific environment.
* start.sh - this script must be used to start agent, instead of default agent.sh script
* restart.sh - this script is used to restart agent after the upgrade
Note that initially, before starting the agent, scripts in the "bin" directory
must be converted to IBM-1047 encoding.
Both scripts set _BPX_SHAREAS environment variable to NO. This is
required for the agent upgrade procedure to work properly.
Also scripts set TEAMCITY_AGENT_START_CMD environment variable. This is
required, because under z/OS agent default shell scripts must be in
IBM-1047 encoding. The command specified in TEAMCITY_AGENT_START_CMD
variable will be invoked right after the upgrade of the agent files. The
purpose of this command is to prepare shell scripts and start the agent.

View file

@ -1,19 +0,0 @@
#!/bin/sh
#
# This script was created and contributed by Teradata
#******************************************************************************
# This script should be installed in the TeamCity agent installation folder
#This script is used by the upgrade process to re-start the agent
echo Custom Start
# make sure we are in the correct folder
cd `dirname $0`
#After the upgrade the agent.sh file is overlaid with an ascii version
#We must re-convert it back to ebcdic
iconv -f ISO8859-1 -t IBM-1047 update/bin/agent.sh > bin/agent.sh
iconv -f ISO8859-1 -t IBM-1047 update/bin/findJava.sh > bin/findJava.sh
#start the agent
agent.sh start

View file

@ -1,24 +0,0 @@
#!/bin/sh
#
# This script was created and contributed by Teradata
#******************************************************************************
# This script should be installed in the TeamCity agent installation folder
# make sure we are in the correct folder
cd `dirname $0`
# set up java
export JRE_HOME=<path to Java installation directory>
export JAVA_HOME=<path to Java installation directory>
# This is used when the agent does an upgrade
export TEAMCITY_AGENT_START_CMD=$PWD/restart.sh
# The agent processes must run in pure unix mode
export _BPX_SHAREAS="NO"
#optional custom path statement
#export PATH=$PATH:$PWD/buildbin
# start the agent
bin/agent.sh $*

View file

@ -1,54 +0,0 @@
Copyright (c) 1999, 2006 Tanuki Software, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of the Java Service Wrapper and associated
documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license,
and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Portions of the Software have been derived from source code
developed by Silver Egg Technology under the following license:
BEGIN Silver Egg Techology License -----------------------------------
Copyright (c) 2001 Silver Egg Technology
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sub-license, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
END Silver Egg Techology License -------------------------------------

View file

@ -1,124 +0,0 @@
#********************************************************************
# Java Service Wrapper Properties for TeamCity Agent Launcher
#********************************************************************
#####################################################################
###
### The path should point to 'java' program.
###
#####################################################################
wrapper.java.command=java
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
# Java Classpath
wrapper.java.classpath.1=../launcher/lib/wrapper.jar
wrapper.java.classpath.2=../launcher/lib/launcher.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../launcher/lib
wrapper.java.library.path.2=../launcher/bin
# TeamCity agent launcher parameters
#Preventing launcher exit on x64 when user logs off
wrapper.java.additional.1=-Xrs
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=16
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=64
###########################################################
### TeamCity agent JVM parameters
###
### NOTE: There should be no gaps in parameters numbers, if
### NOTE: you change parameters, you need to update numbering
###
##########################################################
# Application parameters.
wrapper.app.parameter.1=jetbrains.buildServer.agent.StandAloneLauncher
wrapper.app.parameter.2=-ea
wrapper.app.parameter.3=-Xmx512m
# The next line can be removed (and the rest of the parameter names MUST BE renumbered) to prevent memory dumps on OutOfMemoryErrors
wrapper.app.parameter.4=-XX:+HeapDumpOnOutOfMemoryError
# Preventing process exiting on user log off
wrapper.app.parameter.5=-Xrs
# Uncomment the next line (insert the number instead of "N" and renumber the rest of the lines) to improve JVM performance
# wrapper.app.parameter.N=-server
wrapper.app.parameter.6=-Dlog4j.configuration=file:../conf/teamcity-agent-log4j.xml
wrapper.app.parameter.7=-Dteamcity_logs=../logs/
wrapper.app.parameter.8=jetbrains.buildServer.agent.AgentMain
# TeamCity agent parameters
wrapper.app.parameter.9=-file
wrapper.app.parameter.10=../conf/buildAgent.properties
wrapper.working.dir=../../bin
wrapper.ping.timeout=0
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See Java Service Wrapper documentation for formats)
wrapper.console.format=PM
# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
wrapper.logfile=../logs/wrapper.log
# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=10m
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=10
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=TeamCity Build Agent
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=TCBuildAgent
# Display name of the service
wrapper.ntservice.displayname=TeamCity Build Agent
# Description of the service
wrapper.ntservice.description=TeamCity Build Agent Service
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=true

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more