2 START_TIME
=$
(date -u +"%H:%M")
4 UPLOAD_START_TIME
="N/A"
7 export SP
=$
(dirname $0)
9 source $SP/setup initial
12 #-- Update sources -----------------------------------------------------------
13 printi
"Starting nightly build on $CFG_NAME..."
16 printe
"Updating sources FAILED! ABORTING SCRIPT!"
18 STOP_TIME
=$
(date -u +"%H:%M")
20 mail_start
"FAILED COMPLETELY"
22 mail_write
"Updating sources FAILED! Please see attached log."
24 mail_send
"-a$LOG_BASE/update.log"
31 #-- Build packages -----------------------------------------------------------
34 for package
in $CFG_PACKAGES; do
37 printe
"Build of package '"$package"' FAILED."
38 failed
=( $failed $package )
40 printi
"Build of package '"$package"' completed successfully."
41 succeeded
=( $succeeded $package )
45 #-- Cleanup ------------------------------------------------------------------
50 #-- Compress log files -------------------------------------------------------
51 printi
"Compressing log files..."
56 md5sum $file.bz2
>$file.bz2.md5
60 STOP_TIME
=$
(date -u +"%H:%M")
62 #-- Fix permissions ----------------------------------------------------------
63 chmod -R o-wx
,g
+wr Archive
/
64 find Archive
/ -type d |
xargs chmod a
+s
,g
+rwx
,o
+x
66 #-- Upload (backup and distribution) -----------------------------------------
67 if [ "$CFG_UPLOAD_ENABLE" = "yes" ]; then
68 UPLOAD_START_TIME
=$
(date -u +"%H:%M")
69 rsync
-avz -e "ssh -i $CFG_BS_KEY" Archive
/ $CFG_BS_USER@
$CFG_BS:$CFG_BS_DIRECTORY
70 rsync
-avz -e "ssh -i $CFG_DS_KEY" Archive
/ $CFG_DS_USER@
$CFG_DS:$CFG_DS_DIRECTORY
71 UPLOAD_STOP_TIME
=$
(date -u +"%H:%M")
74 #-- Generate report ----------------------------------------------------------
75 if [ "$CFG_MAIL_ENABLE" = "yes" ]; then
76 if [ -z $failed ]; then
77 RESULT
="completed successfully"
78 elif [ -z $succeeded ]; then
79 RESULT
="FAILED COMPLETELY"
81 RESULT
="FAILED PARTLY"
87 if [ ! -z $failed ]; then
89 mail_write
"The following packages FAILED to build completely:"
90 for package
in $failed; do
92 bzcat
$LOG_BASE/$package.log.bz2 |
tail -100 - >/tmp
/_aros_build_log_
$package
93 ATTACH
=( $ATTACH -a/tmp
/_aros_build_log_
$package )
96 mail_write
"Please see the attached shortened logs or the full logs at"
97 mail_write
"http://www.aros.org/downloads/nightly/$VERSION/logs/ for details."
99 if [ ! -z $succeeded ]; then
101 mail_write
"The following packages were built successfully:"
102 for package
in $succeeded; do
103 mail_write
"$package"
106 mail_write
"The following archives were created:"
107 mail_write
"$( find $ARCHIVE_BASE -type f -not -path '*/logs/*' -not -name '*.md5' | xargs -n 1 basename )"
109 mail_write
"The archives will be available for download from http://www.aros.org/download.php."
114 if [ ! -z $failed ]; then
115 rm -rf /tmp
/_aros_build_log_
*
120 #-- Remove uploaded files ----------------------------------------------------
121 if [[ "$CFG_UPLOAD_ENABLE" = "yes" && "$CFG_UPLOAD_PRUNE" = "yes" ]]; then
122 # This is the old way.
124 # The rm below is UNSAFE. If ARCHIVE_ROOT is undefined somehow, bye-bye
125 # to everything the build user can delete, from / on down.
126 #rm -rf $(ARCHIVE_ROOT)/*