-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkins-swarm-prestart.nutci.linux-tmpfs.sh
executable file
·48 lines (39 loc) · 1.55 KB
/
jenkins-swarm-prestart.nutci.linux-tmpfs.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
#!/bin/sh
# Jenkins Swarm Client integration for NUT CI farm
# Copyright (C)
# 2021-2022 by Jim Klimov <jimklimov+nut@gmail.com>
# License: MIT
# Intended to be symlinked as
# .../jenkins-`hostname`/jenkins-swarm-prestart.sh
# and to run from that directory as current
set -e
SCRIPTDIR="`dirname "$0"`"
SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`"
cd "$SCRIPTDIR"
mkdir -p "${HOME}/.ccache"
mkdir -p "${HOME}/.gitcache-dynamatrix"
mkdir -p "${HOME}/.gitcache-dynamatrix@tmp"
[ -n "$TMPDIR" ] && [ -d "$TMPDIR" ] || TMPDIR=/dev/shm
[ -n "$TMPDIR" ] && [ -d "$TMPDIR" ] || TMPDIR=/tmp
if [ -d "$TMPDIR" ] ; then
#WSDIR="`mktemp -d "$TMPDIR/jenkins-nutci.XXXXXX"`"
WSDIR="$TMPDIR/jenkins-nutci"
mkdir -p "$WSDIR"
rm -rf workspace
ln -srf "$WSDIR" ./workspace 2>/dev/null \
|| ln -sf "$WSDIR" ./workspace
fi
if [ -d ./workspace/.gitcache-dynamatrix ] || [ -L ./workspace/.gitcache-dynamatrix ] || [ -h ./workspace/.gitcache-dynamatrix ] ;
then :
else
rm -f ./workspace/.gitcache-dynamatrix
ln -srf "${HOME}/.gitcache-dynamatrix" ./workspace/.gitcache-dynamatrix 2>/dev/null \
|| ln -sf "${HOME}/.gitcache-dynamatrix" ./workspace/.gitcache-dynamatrix
fi
if [ -d "./workspace/.gitcache-dynamatrix@tmp" ] || [ -L "./workspace/.gitcache-dynamatrix@tmp" ] || [ -h "./workspace/.gitcache-dynamatrix@tmp" ] ;
then :
else
rm -f "./workspace/.gitcache-dynamatrix@tmp"
ln -srf "${HOME}/.gitcache-dynamatrix@tmp" "./workspace/.gitcache-dynamatrix@tmp" 2>/dev/null \
|| ln -sf "${HOME}/.gitcache-dynamatrix@tmp" "./workspace/.gitcache-dynamatrix@tmp"
fi