From dev-return-191886-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Sun Jul 1 20:44:41 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BDADF180654 for ; Sun, 1 Jul 2018 20:44:40 +0200 (CEST) Received: (qmail 61824 invoked by uid 500); 1 Jul 2018 18:44:39 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 61810 invoked by uid 99); 1 Jul 2018 18:44:39 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2018 18:44:39 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id CB3F63A005B for ; Sun, 1 Jul 2018 18:44:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1834798 - in /tomcat/trunk/bin: makebase.bat makebase.sh Date: Sun, 01 Jul 2018 18:44:38 -0000 To: dev@tomcat.apache.org From: isapir@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180701184438.CB3F63A005B@svn01-us-west.apache.org> Author: isapir Date: Sun Jul 1 18:44:38 2018 New Revision: 1834798 URL: http://svn.apache.org/viewvc?rev=1834798&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62500 Added scripts to create CATALINA_BASE directory Added: tomcat/trunk/bin/makebase.bat tomcat/trunk/bin/makebase.sh Added: tomcat/trunk/bin/makebase.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/makebase.bat?rev=1834798&view=auto ============================================================================== --- tomcat/trunk/bin/makebase.bat (added) +++ tomcat/trunk/bin/makebase.bat Sun Jul 1 18:44:38 2018 @@ -0,0 +1,63 @@ +:: Licensed to the Apache Software Foundation (ASF) under one or more +:: contributor license agreements. See the NOTICE file distributed with +:: this work for additional information regarding copyright ownership. +:: The ASF licenses this file to You under the Apache License, Version 2.0 +:: (the "License"); you may not use this file except in compliance with +:: the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +:: This script creates the directory structure required for running Tomcat +:: in a separate directory by pointing %CATALINA_BASE% to it. It copies the +:: conf directory from %CATALINA_HOME%, and creates empty directories for +:: logs, temp, and work. +:: +:: If the file %CATALINA_HOME%/bin/setenv.sh exists then it is copied to +:: the target directory as well. + +@echo off + +:: first arg is the target directory +set BASE_TGT=%1 + +if %BASE_TGT%.==. ( + :: target directory not provided; exit + echo "Usage: makebase " + goto :EOF +) + +set CURR_DIR=%~dp0 +set HOME_DIR=%CURR_DIR%..\ + +if exist %BASE_TGT% ( + :: target directory exists + echo directory exists + + :: exit if target directory is not empty + for /F %%i in ('dir /b "%BASE_TGT%\*.*"') do ( + echo target directory is not empty + goto :EOF + ) +) else ( + :: create the target directory + mkdir %BASE_TGT% +) + +:: create empty directories for bin, logs, temp, and work +mkdir %BASE_TGT%\bin %BASE_TGT%\logs %BASE_TGT%\temp %BASE_TGT%\work + +:: copy conf directory +robocopy %HOME_DIR%\conf %BASE_TGT%\conf > nul + +:: copy setenv.bat if exists +robocopy %HOME_DIR%\bin %BASE_TGT%\bin setenv.bat > nul + +echo created CATALINA_BASE directory at $BASE_TGT + +:EOF Added: tomcat/trunk/bin/makebase.sh URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/makebase.sh?rev=1834798&view=auto ============================================================================== --- tomcat/trunk/bin/makebase.sh (added) +++ tomcat/trunk/bin/makebase.sh Sun Jul 1 18:44:38 2018 @@ -0,0 +1,64 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script creates the directory structure required for running Tomcat +# in a separate directory by pointing $CATALINA_BASE to it. It copies the +# conf directory from $CATALINA_HOME, and creates empty directories for +# bin, logs, temp, and work. +# +# If the file $CATALINA_HOME/bin/setenv.sh exists then it is copied to +# the target directory as well. + +# first arg is the target directory +BASE_TGT=$1 + +if [ -z ${BASE_TGT} ]; then + # target directory not provided; exit + echo "Usage: makebase " + exit 1 +fi + +HOME_DIR="$(dirname $(dirname $0))" + +if [ -d ${BASE_TGT} ]; then + # target directory exists + echo directory exists + + # exit if target directory is not empty + [ "$(ls -A ${BASE_TGT})" ] && \ + echo "target directory is not empty" && \ + exit 1 +else + # create the target directory + mkdir -p ${BASE_TGT} +fi + +for dir in bin logs temp work; +do + # copy directory with permissions and delete contents if any + cp -a "${HOME_DIR}/${dir}" "${BASE_TGT}/${dir}" + rm -fr "${BASE_TGT}/${dir}"/* +done + +# copy conf directory recursively and preserve permissions +cp -a "${HOME_DIR}/conf" "${BASE_TGT}/" + +# copy setenv.sh if exists +[ -f "${HOME_DIR}/bin/setenv.sh" ] && \ + cp -p "${HOME_DIR}/bin/setenv.sh" "${BASE_TGT}/bin/" + +echo created CATALINA_BASE directory at $BASE_TGT --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org