summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_schedule_on_demand.sh
blob: f7e3af3566dfa8cd467e2def3e2f39b9be83e868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

# Copyright 2014 Holger Levsen <holger@layer-acht.org>
#         © 2015 Mattia Rizzolo <mattia@mapreri.org>
# released under the GPLv=2

DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"

# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh

set +x
ARTIFACTS=0
NOTIFY=''
if [ "$1" = "--notify" ] ; then
	NOTIFY=true
	shift
elif [ "$1" = "--artifacts" ] ; then
	ARTIFACTS=1
	NOTIFY=true
fi
SUITE="$1"
shift
if [ "$SUITE" = "sid" ] ; then
	echo "WARNING: sid has been renamed to unstable."
	SUITE=unstable
fi

if [ ! -z "$SUDO_USER" ] ; then
	REQUESTER="$SUDO_USER"
else
	echo "Looks like you logged into this host as the jenkins user without sudoing to it. How can that be possible?!?!"
	REQUESTER="$USER"
fi

CANDIDATES="$@"
if [ ${#} -gt 50 ] && [ "$NOTIFY" = "true" ] ; then
	echo
	figlet "No."
	echo "Do not schedule more than 50 packages with notification. If you really really need to spam the IRC channel this much, use a loop to achieve that. Exiting."
	echo
	exit 1
fi

# finally
schedule_packages $CANDIDATES