Commit 3a9c0136 authored by Holger Levsen's avatar Holger Levsen

use common functions. runs all scripts as copies from /tmp, so the source...

use common functions. runs all scripts as copies from /tmp, so the source scripts can be updated while running.
parent e9d10b50
#!/bin/bash
# Copyright 2012,2013 Holger Levsen <holger@layer-acht.org>
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# $1 = base distro
# $2 = extra component
# $3 = upgrade distro
......@@ -19,22 +22,6 @@ SLEEP=$(shuf -i 1-10 -n 1)
echo "Sleeping $SLEEP seconds to randomize start times and parallel runs."
sleep $SLEEP
#
# default settings
#
set -x
set -e
export LC_ALL=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export SCRIPT_HEADER="#!/bin/bash
set -x
set -e
export DEBIAN_FRONTEND=noninteractive
export LC_ALL=C
export http_proxy=$http_proxy"
export CHROOT_TARGET=$(mktemp -d -p /chroots/ chroot-installation-$1.XXXXXXXXX)
export TMPFILE=$(mktemp -u)
export CTMPFILE=$CHROOT_TARGET/$TMPFILE
......
......@@ -4,23 +4,12 @@
# Copyright 2013 Antonio Terceiro <terceiro@debian.org>
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# $1 = base distro
# $2 $3 ... = command to run inside a clean chroot running the distro in $1
set -e
export LC_ALL=C
# Defaults for the jenkins.debian.net environment
if [ -z "$MIRROR" ]; then
export MIRROR=http://ftp.de.debian.org/debian
fi
if [ -z "$http_proxy" ]; then
export http_proxy="http://localhost:3128"
fi
if [ -z "$CHROOT_BASE" ]; then
export CHROOT_BASE=/chroots
fi
if [ $# -lt 2 ]; then
echo "usage: $0 DISTRO [backports] CMD [ARG1 ARG2 ...]"
exit 1
......@@ -48,13 +37,6 @@ fi
export CURDIR=$(pwd)
export SCRIPT_HEADER="#!/bin/bash
set -x
set -e
export DEBIAN_FRONTEND=noninteractive
export LC_ALL=C
export http_proxy=$http_proxy"
bootstrap() {
mkdir -p "$CHROOT_TARGET/etc/dpkg/dpkg.cfg.d"
echo force-unsafe-io > "$CHROOT_TARGET/etc/dpkg/dpkg.cfg.d/02dpkg-unsafe-io"
......
#!/bin/bash
# Copyright 2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
common_cleanup(){
echo "Cleaned up $TTT, finished running $0"
rm -f $TTT
}
common_init() {
# check whether this script has been started from /tmp already
if [ "${0:0:5}" != "/tmp/" ] ; then
# mktemp some place for us...
TTT=$(mktemp --tmpdir=/tmp)
# prepare cleanup
trap common_cleanup INT TERM EXIT
# cp $0 to /tmp and run it from there
cp $0 $TTT
chmod +x $TTT
# run ourself with the same parameter as we are running
# but run a copy from /tmp so that the source can be updated
# (Running shell scripts fail weirdly when overwritten when running,
# this hack makes it possible to overwrite long running scripts
# anytime...)
echo "Start running \"$0\" as \"$TTT\" with arguments \"$@\""
$TTT "$@"
exit 0 # auto cleanup on trap
else
# default settings used for the jenkins.debian.net environment
if [ -z "$LC_ALL" ]; then
export LC_ALL=C
fi
if [ -z "$MIRROR" ]; then
export MIRROR=http://ftp.de.debian.org/debian
fi
if [ -z "$http_proxy" ]; then
export http_proxy="http://localhost:3128"
fi
if [ -z "$CHROOT_BASE" ]; then
export CHROOT_BASE=/chroots
fi
if [ -z "$SCHROOT_BASE" ]; then
export SCHROOT_BASE=/schroots
fi
# use these settings in the scripts in the (s)chroots too
export SCRIPT_HEADER="#!/bin/bash
set -e
set -x
export DEBIAN_FRONTEND=noninteractive
export LC_ALL=$LC_ALL
export http_proxy=$http_proxy
export MIRROR=$MIRROR"
# be more verbose
export
set -e
set -x
fi
}
#!/bin/bash
# Copyright 2012-2013 Holger Levsen <holger@layer-acht.org>
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
#
# default settings
#
set -x
set -e
export LC_ALL=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
init_workspace() {
#
......
#!/bin/bash
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# Copyright 2012,2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
#
# default settings
#
#set -x
set -e
export LC_ALL=C
export http_proxy="http://localhost:3128"
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
#
# define some variables
......
#!/bin/bash
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# Copyright 2012,2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
#
# default settings
#
set -x
set -e
export LC_ALL=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
init_workspace() {
#
......
#!/bin/bash
# Copyright 2012, 2013 Holger Levsen <holger@layer-acht.org>
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# convert param to variables
if [ "$1" == "" ] ; then
echo "need at least one URL to act on"
echo '# $1 = URL'
exit 1
fi
#
# convert params to variables
#
URL=$1
#
# default settings
#
#set -x
set -e
export LC_ALL=C
export http_proxy="http://localhost:3128"
TMPFILE=$(mktemp)
curl $URL > $TMPFILE
if [ $(grep -c failed $TMPFILE 2>/dev/null ) -gt 1 ] ; then
......
......@@ -3,6 +3,9 @@
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# $1 = vnc-display, each job should have a unique one, so jobs can run in parallel
# $2 = name
# $3 = disksize in GB
......@@ -19,16 +22,6 @@ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ] ; then
exit 1
fi
#
# default settings
#
set -x
set -e
export LC_ALL=C
export MIRROR=http://ftp.de.debian.org/debian
export http_proxy="http://localhost:3128"
export
#
# init
#
......
#!/bin/bash
# Copyright 2012-2013 Holger Levsen <holger@layer-acht.org>
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
#
# default settings
#
export LC_ALL=C
set -e
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
check_for_mounted_chroots() {
CHROOT_PATTERN="/chroots/${1}-*"
......@@ -47,7 +44,6 @@ report_filetype_usage() {
rm $OUTPUT
}
report_squid_usage() {
REPORT=/var/www/calamaris/calamaris.txt
if [ -z $1 ] ; then
......
......@@ -2,37 +2,22 @@
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# Copyright 2013 Antonio Terceiro <terceiro@debian.org>
# Copyright 2014 Joachim Breitner <nomeata@debian.org>
# released under the GPLv=2
# $2 = schroot name
# $1 = base distro
# $2 $3 ... = extra packages to install
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# bootstraps a new chroot for schroot, and then moves it into the right location
set -e
export LC_ALL=C
# Defaults for the jenkins.debian.net environment
if [ -z "$MIRROR" ]; then
export MIRROR=http://ftp.de.debian.org/debian
fi
if [ -z "$http_proxy" ]; then
# export http_proxy="http://localhost:3128"
:
fi
if [ -z "$CHROOT_BASE" ]; then
export CHROOT_BASE=/chroots
fi
if [ -z "$SCHROOT_BASE" ]; then
export SCHROOT_BASE=/schroots
fi
# $1 = schroot name
# $2 = base distro
# $3 $4 ... = extra packages to install
if [ $# -lt 2 ]; then
echo "usage: $0 DISTRO [backports] CMD [ARG1 ARG2 ...]"
echo "usage: $0 TARGET DISTRO [backports] CMD [ARG1 ARG2 ...]"
exit 1
fi
TARGET="$1"
shift
DISTRO="$1"
......
#!/bin/bash
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# Copyright 2012,2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# convert params to variables
if [ "$1" == "" ] ; then
echo "need at least one URL to act on"
echo '# $1 = URL'
exit 1
fi
#
# convert params to variables
#
URL=$1
PATTERNS=$2
#
# default settings
#
#set -x
set -e
export LC_ALL=C
export http_proxy="http://localhost:3128"
#
# Don't use --continue on first run
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment