aboutsummaryrefslogtreecommitdiff
path: root/scripts/auto-build/prep-auto-build-upload
blob: 8cbc4b67a36d0fc66e8b128d5a2fa0985b05a248 (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
#!/bin/sh

# prepare a directory per date for the auto-builders to upload to

HOSTNAME=$(hostname)
SYSTEM=$(uname -s)
DATE=$(date +%Y-%m-%d)
TIME=$(date +%H.%M.%S)
SCRIPT=$(echo $0| sed 's|.*/\(.*\)|\1|g')
LOGFILE=/home/pd/logs/${DATE}_${TIME}_-_${SCRIPT}_-_${SYSTEM}.txt

#BUILD_ROOT="/var/www/auto-build"

prep_project()
{
	 PROJECT=$1
	 BUILD_ROOT="$2"
	 TODAYS_ROOT="${BUILD_ROOT}/${DATE}"
	 chown -R root.root "${BUILD_ROOT}"        >> $LOGFILE 2>&1
	 mkdir "${TODAYS_ROOT}"                    >> $LOGFILE 2>&1
	 mkdir "${TODAYS_ROOT}/logs"               >> $LOGFILE 2>&1
	 chown -R nobody.nogroup "${TODAYS_ROOT}"  >> $LOGFILE 2>&1
	 
	 rm -f -- ${BUILD_ROOT}/latest             >> $LOGFILE 2>&1
	 ln -s ${TODAYS_ROOT} ${BUILD_ROOT}/latest >> $LOGFILE 2>&1
	 
	 chown -R ${PROJECT}.${PROJECT} /home/${PROJECT}/  >> $LOGFILE 2>&1
	 chmod -R u+rw /home/${PROJECT}/                   >> $LOGFILE 2>&1
}


prep_project pd /var/www/auto-build
prep_project arduino /var/www/arduino