forked from untangle/ngfw_pkgtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease-constants.sh
executable file
·51 lines (42 loc) · 1.3 KB
/
release-constants.sh
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
49
50
51
# constants
[ -z "$REPOSITORY" ] && echo "REPOSITORY has to be set" && exit 1
PKGTOOLS=$(dirname $0)
PKGTOOLS_VERSION=$(git rev-parse --short HEAD)
MUTT_CONF_FILE=$PKGTOOLS/mutt.conf
RECIPIENT="[email protected]"
SYNC_RECIPIENT="[email protected]"
REMOTE_USER="root"
REMOTE_SERVER="updates.untangle.com"
SSH_COMMAND="ssh -t ${REMOTE_USER}@${REMOTE_SERVER}"
if [ $(hostname) != "pkgs" ] ; then
REMOTE_PKGTOOLS=$(mktemp -d /tmp/pkgtools.XXXXXXXXXXXXXXX)
fi
REPREPRO_BASE_DIR="/var/www/public/$REPOSITORY"
REPREPRO_DIST_DIR="${REPREPRO_BASE_DIR}/dists"
REPREPRO_CONF_DIR="${REPREPRO_BASE_DIR}/conf"
REPREPRO_DISTRIBUTIONS_FILE="${REPREPRO_CONF_DIR}/distributions"
REPREPRO_COMMAND="./reprepro-untangle.sh -V -b ${REPREPRO_BASE_DIR} ${EXTRA_ARGS}"
# functions
repreproLocal() {
echo "Running local command '$@'"
$PKGTOOLS/${REPREPRO_COMMAND} "$@"
}
remoteCommand() {
echo "Running remote command: '$@'"
case "$@" in
*"${REMOTE_PKGTOOLS}"*)
$SSH_COMMAND "$@" ;;
*)
$SSH_COMMAND "cd ${REMOTE_PKGTOOLS} && $@" ;;
esac
}
repreproRemote() {
remoteCommand ${REPREPRO_COMMAND} "$@"
}
copyRemotePkgtools() {
removeRemotePkgtools
rsync -aH $PKGTOOLS/ ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_PKGTOOLS}/
}
removeRemotePkgtools() {
remoteCommand "rm -fr ${REMOTE_PKGTOOLS}"
}