Author: tomekr Date: Thu Mar 26 07:21:30 2015 New Revision: 1669279 URL: http://svn.apache.org/r1669279 Log: SLING-4517 Update debian packaging to use crankstart.
Added: sling/trunk/contrib/launchpad/debian/README.md sling/trunk/contrib/launchpad/debian/src/deb/control/postrm sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling sling/trunk/contrib/launchpad/debian/src/root_fs/opt/ sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/ sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/ sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/sling-common.sh sling/trunk/contrib/sling-s3/crank-s3.d/05-credentials.txt Removed: sling/trunk/contrib/launchpad/debian/README.txt sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling.sample Modified: sling/trunk/contrib/launchpad/debian/pom.xml sling/trunk/contrib/launchpad/debian/src/deb/control/control sling/trunk/contrib/launchpad/debian/src/deb/control/postinst sling/trunk/contrib/launchpad/debian/src/deb/control/prerm sling/trunk/contrib/launchpad/debian/src/root_fs/etc/init.d/sling sling/trunk/contrib/launchpad/debian/src/root_fs/etc/logrotate.d/sling sling/trunk/contrib/sling-s3/Makefile sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb Added: sling/trunk/contrib/launchpad/debian/README.md URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/README.md?rev=1669279&view=auto ============================================================================== --- sling/trunk/contrib/launchpad/debian/README.md (added) +++ sling/trunk/contrib/launchpad/debian/README.md Thu Mar 26 07:21:30 2015 @@ -0,0 +1,33 @@ +Apache Sling debian/ubuntu packaging +==================================== + +This is a work in progress .deb packaging for Sling. +It provides basic init.d start/stop logrotate & sample sling config. The goal is to provide a generic yet configurable sling package to eliminate the need to build sling for in-house deployments. + +To run this, and install using dpkg/apt commands, review /etc/default.sling +config and run + "service sling start" + +Components used are: +* [Sling crankstart](https://github.com/apache/sling/tree/trunk/contrib/crankstart) +* [Sling-s3](https://github.com/apache/sling/tree/trunk/contrib/sling-s3) + +Supported run modes are: + + crank - tar files for nodes and data + crank-s3 - tar files for nodes, s3 for data + crank-mongo - mongo for nodes and data + crank-s3-mongo - mongo for nodes, s3 for data + +Each of these are supported by building crank files using the sling-s3 module to aggregate configuration templates into usable configurations. + +* SLING_EXEC=/opt/sling - Location for all binaries & scripts. +* SLING_CFG=/etc/sling - Tree of config file templates from which final.crantstart files are built. Editing any of these config templates triggers a rebuild of the target/crank* files. +* SLING_DEFAULTS=/etc/default/sling - Defaults file for location & path setup and to override any of the crank settings. +* SLING_DATA=/var/lib/sling - Local sling data dir. +* SLING_LOG_DIR=/var/log/sling - Sling log data. + +TODO: +* Support clustered configurations. + + Modified: sling/trunk/contrib/launchpad/debian/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/pom.xml?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/pom.xml (original) +++ sling/trunk/contrib/launchpad/debian/pom.xml Thu Mar 26 07:21:30 2015 @@ -17,9 +17,9 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> -<project - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -28,7 +28,7 @@ under the License. <version>22</version> <relativePath>../../../parent/pom.xml</relativePath> </parent> - <artifactId>sling-lauchpad</artifactId> + <artifactId>sling-server</artifactId> <packaging>jar</packaging> <version>8-SNAPSHOT</version> <name>Apache Sling Launchpad Debian Package Builder</name> @@ -45,14 +45,87 @@ under the License. <!-- jdeb plugin version for debian package --> - <jdeb.version>1.0.1</jdeb.version> + <jdeb.version>1.4</jdeb.version> <launchpad.artifact>org.apache.sling.launchpad</launchpad.artifact> <launchpad.version>8-SNAPSHOT</launchpad.version> <launchpad.classifier>standalone</launchpad.classifier> + <slingInstallDir>/opt/sling</slingInstallDir> + <slingConfigDir>/etc/sling</slingConfigDir> + <slingS3Dir>${basedir/../../sling-s3}</slingS3Dir> </properties> <build> <plugins> <plugin> + <!-- Copy sling-s3 info local workdir --> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-sling-s3</id> + <phase>generate-sources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/${slingConfigDir}</outputDirectory> + <overwrite>true</overwrite> + <resources> + <resource> + <directory>${slingS3Dir}</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <!-- Use exec plugin to call make sling-s3 targets --> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <!-- make all in the Maven compile phase --> + <id>fix-exec-permissions</id> + <phase>process-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <workingDirectory>${project.build.directory}/${slingConfigDir}</workingDirectory> + <executable>chmod</executable> + <arguments> + <argument>-R</argument> + <argument>775</argument> + <argument>scripts</argument> + </arguments> + </configuration> + </execution> + <execution> + <!-- make all in the Maven compile phase --> + <id>build-config</id> + <phase>generate-resources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + > <environmentVariables> + <OUTPUT> + ${project.build.directory}/contrib + </OUTPUT> + </environmentVariables> + <workingDirectory>${project.build.directory}/${slingConfigDir}</workingDirectory> + <executable>make</executable> + <arguments> + <argument>update-bundles</argument> + <argument>install-deps</argument> + <argument>all</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> <artifactId>jdeb</artifactId> <groupId>org.vafer</groupId> <version>${jdeb.version}</version> @@ -63,24 +136,72 @@ under the License. <goal>jdeb</goal> </goals> <configuration> + <classifier>all</classifier> <dataSet> + <!-- etc/{default,logrotate.d}/sling - conf files --> <data> - <src>${project.build.directory}/${launchpad.artifact}-${project.version}-${launchpad.classifier}.jar</src> - <type>file</type> + <src>${project.basedir}/src/root_fs/etc</src> + <type>directory</type> + <excludes>**/.svn/,**/init.d/</excludes> + <conffile>true</conffile> <mapper> <type>perm</type> - <prefix>/opt/sling/${project.parent.artifactId}</prefix> + <prefix>/etc</prefix> </mapper> </data> + <!-- all other root_fs --> <data> <src>${project.basedir}/src/root_fs/</src> <type>directory</type> - <excludes>**/.svn/</excludes> + <excludes>**/.svn/,**/etc/default/,**/etc/logrotate.d/</excludes> <mapper> + <filemode>775</filemode> <type>perm</type> <prefix>/</prefix> </mapper> </data> + <!-- etc/sling/crank-*.d/ conf files --> + <data> + <src>${project.build.directory}/${slingConfigDir}</src> + <type>directory</type> + <conffile>true</conffile> + <excludes>**/.svn/,**/contrib/,**/scripts/,**/target/</excludes> + <mapper> + <type>perm</type> + <prefix>${slingConfigDir}</prefix> + </mapper> + </data> + <!-- crank target files, etc - non-conf files, as they are generated --> + <data> + <src>${project.build.directory}/${slingConfigDir}</src> + <type>directory</type> + <includes>**/target/*</includes> + <mapper> + <filemode>775</filemode> + <type>perm</type> + <prefix>${slingConfigDir}</prefix> + </mapper> + </data> + <!-- sling-s3 scripts & other binaries --> + <data> + <src>${project.build.directory}/${slingConfigDir}</src> + <type>directory</type> + <includes>**/contrib/*,**/scripts/*</includes> + <mapper> + <filemode>775</filemode> + <type>perm</type> + <prefix>${slingInstallDir}</prefix> + </mapper> + </data> + <!-- dependencies --> + <data> + <src>${project.build.directory}/contrib</src> + <type>directory</type> + <mapper> + <type>perm</type> + <prefix>${slingInstallDir}/contrib</prefix> + </mapper> + </data> </dataSet> </configuration> </execution> @@ -98,7 +219,6 @@ under the License. <phase>process-resources</phase> <configuration> <outputDirectory>${project.build.directory}</outputDirectory> - <includeArtifactIds>${launchpad.artifact}</includeArtifactIds> <excludeTransitive>true</excludeTransitive> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> @@ -108,14 +228,6 @@ under the License. </plugin> </plugins> </build> - <dependencies> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>${launchpad.artifact}</artifactId> - <version>${launchpad.version}</version> - <classifier>${launchpad.classifier}</classifier> - </dependency> - </dependencies> <reporting> <plugins> <plugin> @@ -143,4 +255,4 @@ under the License. </snapshots> </repository> </repositories> -</project> \ No newline at end of file +</project> Modified: sling/trunk/contrib/launchpad/debian/src/deb/control/control URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/deb/control/control?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/deb/control/control (original) +++ sling/trunk/contrib/launchpad/debian/src/deb/control/control Thu Mar 26 07:21:30 2015 @@ -4,6 +4,6 @@ Section: misc Priority: optional Architecture: all Maintainer: Bruce Edge <bruce.e...@nextissuemedia.com> -Depends: oracle-java7-installer +Depends: oracle-java7-installer, make Description: [[description]] Distribution: development Modified: sling/trunk/contrib/launchpad/debian/src/deb/control/postinst URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/deb/control/postinst?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/deb/control/postinst (original) +++ sling/trunk/contrib/launchpad/debian/src/deb/control/postinst Thu Mar 26 07:21:30 2015 @@ -19,39 +19,31 @@ echo $0 $* [ "$DEBUG" ] && set -x - - -SLING_DEFAULTS=/etc/default/sling -if [ ! -e $SLING_DEFAULTS ] ; then - cp $SLING_DEFAULTS.sample $SLING_DEFAULTS +SLING_COMMON=/opt/sling/scripts/sling-common.sh +if [ -r $SLING_COMMON ] ; then + . $SLING_COMMON +else + log_failure_msg "Missing $SLING_COMMON file, cannot read env settings." + exit -1 fi -. $SLING_DEFAULTS -chmod +x /etc/init.d/sling +SLING_USER=${SLING_USER:-sling} +SLING_GROUP=${SLING_GROUP:-sling} -# Check for sling user -if ! getent passwd | grep -q sling ; then - useradd --home-dir $SLING_HOME --gid adm $SLING_USER -fi -# Make data dir -SLING_DATA=/var/lib/sling -if [ ! -d $SLING_DATA ] ; then - echo Create $SLING_DATA - mkdir -p $SLING_DATA - chown -R $SLING_USER:adm $SLING_DATA +# Check for sling user and group +if ! getent group | grep -q $SLING_USER ; then + groupadd --system $SLING_GROUP fi - -# Make log dir -if [ ! -d $SLING_LOG_DIR ] ; then - echo Create $SLING_LOG_DIR - mkdir -p $SLING_LOG_DIR - chown -R $SLING_USER:adm $SLING_LOG_DIR +if ! getent passwd | grep -q $SLING_GROUP ; then + useradd --home-dir $SLING_EXEC --gid $SLING_GROUP $SLING_USER fi +check_sling_permissions force + update-rc.d sling defaults +# Only restart if already running if service sling status; then service sling restart fi - Added: sling/trunk/contrib/launchpad/debian/src/deb/control/postrm URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/deb/control/postrm?rev=1669279&view=auto ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/deb/control/postrm (added) +++ sling/trunk/contrib/launchpad/debian/src/deb/control/postrm Thu Mar 26 07:21:30 2015 @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# 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. + +echo $0 $* +[ "$DEBUG" ] && set -x + +if [ remove = "$1" ]; then + update-rc.d -f sling remove + + # Run cleanup script created by prerm + CLEANUP=/tmp/sling-cleanup.sh + [ -e ${CLEANUP} ] && sh ${CLEANUP} $@ +fi Modified: sling/trunk/contrib/launchpad/debian/src/deb/control/prerm URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/deb/control/prerm?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/deb/control/prerm (original) +++ sling/trunk/contrib/launchpad/debian/src/deb/control/prerm Thu Mar 26 07:21:30 2015 @@ -25,8 +25,18 @@ if [ remove = "$1" ]; then service sling stop fi rm -f $SLING_DEFAULTS - if [ "$SLING_DATA" ] && [ -d $SLING_DATA ] ; then - echo Not Purging $SLING_DATA - # rm -rf $SLING_DATA - fi + + # Generate a cleanup script to purge all generated files + # Note: validate all deletions! + cat >/tmp/sling-cleanup.sh <<-EOT + #!/bin/bash + echo Purging sling generated files + [ "$DEBUG" ] && set -x + [ "${SLING_EXEC}" ] && [ -d ${SLING_EXEC} ] && rm -rf ${SLING_EXEC} + [ -d ${SLING_CFG}/target ] && rm -rf ${SLING_CFG}/target + [ "${SLING_LOG_DIR}" ] && [ -d ${SLING_LOG_DIR} ] && rm -rf ${SLING_LOG_DIR} + # Purge deletes data as well + rm -f $0 +EOT + fi Added: sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling?rev=1669279&view=auto ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling (added) +++ sling/trunk/contrib/launchpad/debian/src/root_fs/etc/default/sling Thu Mar 26 07:21:30 2015 @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# 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. +set -a + +# Identification +SLING_USER=sling +SLING_GROUP=sling + +# sling defaults +# Note, init script uses : +# $JAVA_ARGS $JAVA_DEBUG_ARGS -jar $SLING_JAR $SLING_DEFAULT_ARGS + +# +# All configuration items are setup in /etc/sling/* +# The files are processed aggregated using /etc/sling/Makefile to generate +# the configuration specific start modes. +# The final mode of execution is determined by the RUNMODE setting below. +# + +########################################################################## +# +# SET RUNMODE HERE +# +# This must be set before sling will run as one needs to make the choice +# of storage configurations before running for the first time +# +# Runtime startup mode options: +# crank - tar files for nodes and data +# crank-s3 - tar files for nodes, s3 for data +# crank-mongo - mongo for nodes and data +# crank-s3-mongo - mongo for nodes, s3 for data +# +# key: +# node store - for node properties and tree structure +# data store - for binaries +# +RUNMODE="" +# +########################################################################## + +# +# Base locations - override default settings in crankfiles. +# +SLING_EXEC=/opt/sling +SLING_CFG=/etc/sling +SLING_DEFAULTS=/etc/default/sling +SLING_DATA=/var/lib/sling +SLING_LOG_DIR=/var/log/sling + +START_LOG_FILE=$SLING_LOG_DIR/startup.log + +# Define where to load dependencies from +M2REPO="${SLING_EXEC}/contrib" +SLING_SCRIPTS=${SLING_EXEC}/scripts +CRANKSTART_ENV=${SLING_SCRIPTS}/crankstart.sh + +# Bump RAM allowance +JAVA_ARGS="-Xmx384M " + +# Uncomment for debugging: +JAVA_ARGS+=" -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n" + +# +# crank file overrides +# +JAVA_ARGS+=" -Dport=8090" +JAVA_ARGS+=" -Dsling.home=${SLING_DATA}" +JAVA_ARGS+=" -Dlog.file=/var/log/sling/sling.log" + +# Allow gogo shell to run in noninteractive env: +# From: http://apache-felix.18485.x6.nabble.com/Gogo-shell-on-standard-input-output-streams-td4845969.html#a4845970 +JAVA_ARGS+=" -Dgosh.args=--nointeractive" + +set +a Modified: sling/trunk/contrib/launchpad/debian/src/root_fs/etc/init.d/sling URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/root_fs/etc/init.d/sling?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/root_fs/etc/init.d/sling (original) +++ sling/trunk/contrib/launchpad/debian/src/root_fs/etc/init.d/sling Thu Mar 26 07:21:30 2015 @@ -16,79 +16,93 @@ # specific language governing permissions and limitations # under the License. -# -# Usage -# -function usage () { - echo "Purpose: Stop/Start sling" - echo "Usage : $0 { stop | start }" -} - -NAME=sling - -PID=/var/run/${NAME}.pid - -[ "$DEBUG" ] && set -x +### BEGIN INIT INFO +# Provides: sling +# Required-Start: $remote_fs $syslog $named +# Required-Stop: $remote_fs $syslog $named +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start sling at boot time +# Description: Enable service provided by sling. +### END INIT INFO . /etc/profile - +export FANCYTTY=true +. /lib/lsb/init-functions export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin +SLING_COMMON=/opt/sling/scripts/sling-common.sh +if [ -r $SLING_COMMON ] ; then + . $SLING_COMMON +else + log_failure_msg "Missing $SLING_COMMON file, cannot read env settings." + exit -1 +fi -SLING_DEFAULTS=/etc/default/sling -[ -r $SLING_DEFAULTS ] && . $SLING_DEFAULTS - -SLING_JAR=$(find $SLING_HOME -name \*-standalone.jar) +PID=/var/run/sling.pid +DAEMON=$(which java) -running() -{ - local PID=$(cat "$1" 2>/dev/null) || return 1 - kill -0 "$PID" 2>/dev/null +function usage () { + log_warning_msg "Purpose: Stop/Start sling" + log_warning_msg "Usage : $0 { stop | start | restart }" } -status() -{ - if running "$PID" - then - echo "OK" - else - echo "FAILED" - fi +function rebuild_config () { + log_progress_msg "Rebuild configuration" + cd ${SLING_CFG} + make -e target/${RUNMODE}.txt } -# -# Stop current sling instance -# function stop () { - start-stop-daemon --stop --pidfile $PID --chdir $SLING_HOME --startas "./$NAME" --signal TERM + killproc -p $PID $DAEMON TERM } -# -# Start batch job scheduler -# function start () { - if start-stop-daemon --start \ - --chdir "$SLING_HOME" \ - --chuid $SLING_USER \ - --pidfile "$PID" \ - --make-pidfile \ - --startas $(which java) \ - -- \ - $JAVA_ARGS $JAVA_DEBUG_ARGS \ - -jar $SLING_JAR $SLING_DEFAULT_ARGS \ - >>$LOG_FILE 2>&1 & - then - sleep 3s - status - fi + if [ ! "${RUNMODE}" ] ; then + log_warning_msg "RUNMODE is not set in ${SLING_DEFAULTS}" + fi + + check_sling_permissions + + # Get MVN_OPTS from crankstart env file. + [ -r $CRANKSTART_ENV ] && . $CRANKSTART_ENV + CRANKSTART_JAR=${M2REPO}/crankstart.jar + + # Update crankstart file if needed + log_daemon_msg "Starting sling serices" + rebuild_config + + log_progress_msg "Start sling daemon" + if start-stop-daemon --start \ + --chdir "$SLING_EXEC" \ + --chuid $SLING_USER \ + --pidfile "$PID" \ + --make-pidfile \ + --background \ + --verbose \ + --no-close \ + --exec $(which java) \ + --start \ + -- \ + ${JAVA_ARGS} \ + ${MVN_OPTS} \ + -jar ${CRANKSTART_JAR} \ + ${SLING_CFG}/target/${RUNMODE}.txt \ + >$START_LOG_FILE 2>&1 + then + sleep 3 + status_of_proc -p $PID $DAEMON + fi + log_end_msg $? } if test -z "$1"; then - usage - exit + usage + exit fi -case $1 in + +case $1 in start) start ;; @@ -96,24 +110,19 @@ case $1 in stop ;; restart) - stop - while ps --pid $(cat $PID) >/dev/null ; do - sleep 1 - done + if [ -f $PID ] ; then + stop + while pidofproc -p $PID $DAEMON > /dev/null ; do + sleep 1 + done + fi start - ;; + ;; status) - if [ $(status) == "OK" ] ; then - exit 0 - else - exit 1 - fi + status_of_proc -p $PID $DAEMON ;; *) echo "Unknown parameter: $1" usage ;; - esac - - -# end_of_file +esac Modified: sling/trunk/contrib/launchpad/debian/src/root_fs/etc/logrotate.d/sling URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/root_fs/etc/logrotate.d/sling?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/root_fs/etc/logrotate.d/sling (original) +++ sling/trunk/contrib/launchpad/debian/src/root_fs/etc/logrotate.d/sling Thu Mar 26 07:21:30 2015 @@ -1,6 +1,6 @@ -/var/log/sling/sling-start.log { - rotate 5 - size 4M +/var/log/sling/startup.log { + rotate + size 10M copytruncate daily compress Added: sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/sling-common.sh URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/sling-common.sh?rev=1669279&view=auto ============================================================================== --- sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/sling-common.sh (added) +++ sling/trunk/contrib/launchpad/debian/src/root_fs/opt/sling/scripts/sling-common.sh Thu Mar 26 07:21:30 2015 @@ -0,0 +1,62 @@ +# +#Copyright (c) 2002-08 Chris Lawrence +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions +#are met: +#1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +#2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +#3. Neither the name of the author nor the names of other contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +#THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +#IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +#ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE +#LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +#CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +#SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +#BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +#OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +#EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +SLING_DEFAULTS=/etc/default/sling +[ "$DEBUG" ] && set -x +if [ -r $SLING_DEFAULTS ] ; then + . $SLING_DEFAULTS +else + echo "Missing $SLING_DEFAULTS file, cannot read env settings." 1>&2 + exit -1 +fi + +# Make sure premissions & directoreis are OK. +# $1 = force sets all permissions +function check_sling_permissions() { + + chmod +x /etc/init.d/sling + + for d in SLING_DATA SLING_EXEC SLING_CFG SLING_LOG_DIR ; do + eval n=\$$d + if [ ! "${n}" ] ; then + log_failure_msg "Missing $d" + exit -1 + fi + if [ ! -d ${n} ] ; then + echo "Fix type of ${n}" + rm -rf ${n} + install --directory --owner=${SLING_USER} --group=${SLING_GROUP} ${n} + else + if [ "$(stat -c '%U' ${n})" != "${SLING_USER}" ] || [ "$1" = "force" ]; then + [ "$1" == "force" ] || echo "Update ownership of ${n}" + chown -R ${SLING_USER}:${SLING_GROUP} ${n} + fi + fi + done +} Modified: sling/trunk/contrib/sling-s3/Makefile URL: http://svn.apache.org/viewvc/sling/trunk/contrib/sling-s3/Makefile?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/sling-s3/Makefile (original) +++ sling/trunk/contrib/sling-s3/Makefile Thu Mar 26 07:21:30 2015 @@ -39,7 +39,7 @@ contrib/crankstart.jar: wget http://central.maven.org/maven2/org/apache/sling/org.apache.sling.crankstart.launcher/1.0.0/org.apache.sling.crankstart.launcher-1.0.0.jar -O contrib/crankstart.jar update-bundles: - rm crank.d/*-sling-startlevel-*.txt + rm -f crank.d/*-sling-startlevel-*.txt $(BUNDLES) install-deps: contrib/crankstart.jar Added: sling/trunk/contrib/sling-s3/crank-s3.d/05-credentials.txt URL: http://svn.apache.org/viewvc/sling/trunk/contrib/sling-s3/crank-s3.d/05-credentials.txt?rev=1669279&view=auto ============================================================================== --- sling/trunk/contrib/sling-s3/crank-s3.d/05-credentials.txt (added) +++ sling/trunk/contrib/sling-s3/crank-s3.d/05-credentials.txt Thu Mar 26 07:21:30 2015 @@ -0,0 +1,5 @@ +# defaults s3AccessKey ... +# defaults s3SecretKey ... +# defaults s3Bucket ... +# defaults s3Region ... +# defaults s3EndPoint ... Modified: sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb URL: http://svn.apache.org/viewvc/sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb?rev=1669279&r1=1669278&r2=1669279&view=diff ============================================================================== --- sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb (original) +++ sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb Thu Mar 26 07:21:30 2015 @@ -1,11 +1,32 @@ #!/usr/bin/env ruby +# +# Copy all rependencies from crank files on command line +# Optionally copy also to output folder +# output folder can e specified but OUTPUT in the enviroment, or --output as a command line arg +# the local maven repo can also be overridden by LOCAL_REPO or --local +# the remote maven repo can also be overridden by REMOTE_REPO or --remote +# require 'fileutils' +require 'optparse' DEP_PLUGIN = 'org.apache.maven.plugins:maven-dependency-plugin:2.10' -SNAPSHOT_REPO = 'https://repository.apache.org/content/repositories/snapshots' -LOCAL_REPO = '~/.m2/repository' + +# Env defaults +$remote_repo = ENV.fetch("REMOTE_REPO",'https://repository.apache.org/content/repositories/snapshots') +$local_repo = ENV.fetch("LOCAL_REPO",'~/.m2/repository') # If set, copy artifacts to OUTPUT location, default is ~/.m2 only -OUTPUT = ENV["OUTPUT"] +$output = ENV["OUTPUT"] + +# Override from command line +OptionParser.new do |opt| + opt.on('-o', '--output OUTPUT, copy to OUTPUT location') { |o| $output = o } + opt.on('-l', '--local repo location') { |o| $local_repo = o } + opt.on('-r', '--remote repo location') { |o| $remote_repo = o } + opt.on('-v', '--verbose') { $verbose = true } +end.parse! + +puts "local_repo=#{$local_repo}" if $verbose +puts "output=#{$output}" if $verbose def run cmd output = "" @@ -17,7 +38,9 @@ def run cmd end def dep_get groupId, artifactId, version - result = run "mvn #{DEP_PLUGIN}:get -DremoteRepositories=#{SNAPSHOT_REPO} -Dartifact=#{groupId}:#{artifactId}:#{version} -Dtransitive=false" + cmd = "mvn #{DEP_PLUGIN}:get -Dmaven.repo.local=#{$local_repo} -DremoteRepositories=#{$remote_repo} -Dartifact=#{groupId}:#{artifactId}:#{version} -Dtransitive=false" + puts cmd if $verbose + result = run cmd result.include? 'BUILD SUCCESS' end @@ -27,23 +50,29 @@ def download groupId, artifactId, versio repo_dir = "#{groupId.gsub('.', '/')}/#{artifactId}/#{version}" jar_name = "#{artifactId}-#{version}.jar" - repo_file = File.expand_path("#{LOCAL_REPO}/#{repo_dir}/#{jar_name}") - puts "Retreiving #{repo_file}" - if File.exists?(repo_file) - puts "(/) Already downloaded" - elsif dep_get groupId, artifactId, version - puts "(/) Downloaded" + repo_file = File.expand_path("#{$local_repo}/#{repo_dir}/#{jar_name}") + if !$output.nil? + output_dir = File.expand_path("#{$output}/#{repo_dir}") + output_file = File.expand_path("#{output_dir}/#{jar_name}") + end + puts "Retreiving #{repo_file}" if $verbose + if File.exists?(repo_file) or ( !$output.nil? and File.exists?(output_file) ) + puts "(/) Already downloaded" if $verbose else - abort "(X) Error" + dep_get groupId, artifactId, version + if !File.exists?(repo_file) + abort "(X) Error downloading #{repo_file}" + else + puts "(/) Downloaded" if $verbose + end end - if !OUTPUT.nil? - output_dir = File.expand_path("#{OUTPUT}/#{repo_dir}") + if !$output.nil? and !File.exists?(output_file) FileUtils.rm_rf output_dir FileUtils.mkdir_p output_dir if !File.exists?(repo_file) - abort "(X) Missing " + abort "(X) Missing #{repo_file}" else - puts "(/) #{repo_file} -> #{output_dir}" + puts "(/) #{repo_file} -> #{output_dir}" if $verbose FileUtils.cp repo_file, output_dir end end