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 printi
"Uploading archives..."
68 if [ "$CFG_UPLOAD_ENABLE" = "yes" ]; then
69 UPLOAD_START_TIME
=$
(date -u +"%H:%M")
70 if [ "$CFG_BACKUP_ENABLE" = "yes" ]; then
71 rsync
-avz -e "ssh -i $CFG_BS_KEY" Archive
/ $CFG_BS_USER@
$CFG_BS:$CFG_BS_DIRECTORY
73 rsync
-avz -e "ssh -i $CFG_DS_KEY" Archive
/ $CFG_DS_USER@
$CFG_DS:$CFG_DS_DIRECTORY
74 UPLOAD_STOP_TIME
=$
(date -u +"%H:%M")
77 #-- Generate report ----------------------------------------------------------
78 if [ "$CFG_MAIL_ENABLE" = "yes" ]; then
79 if [ -z $failed ]; then
80 RESULT
="completed successfully"
81 elif [ -z $succeeded ]; then
82 RESULT
="FAILED COMPLETELY"
84 RESULT
="FAILED PARTLY"
90 if [ ! -z $failed ]; then
92 mail_write
"The following packages FAILED to build completely:"
93 for package
in $failed; do
95 bzcat
$LOG_BASE/$package.log.bz2 |
tail -100 - >/tmp
/_aros_build_log_
$package
96 ATTACH
=( $ATTACH -a/tmp
/_aros_build_log_
$package )
99 mail_write
"Please see the attached shortened logs or the full logs at"
100 mail_write
"http://www.aros.org/downloads/nightly/$VERSION/logs/ for details."
102 if [ ! -z $succeeded ]; then
104 mail_write
"The following packages were built successfully:"
105 for package
in $succeeded; do
106 mail_write
"$package"
109 mail_write
"The following archives were created:"
110 mail_write
"$( find $ARCHIVE_BASE -type f -not -path '*/logs/*' -not -name '*.md5' | xargs -n 1 basename )"
112 mail_write
"The archives will be available for download from http://www.aros.org/download.php."
117 if [ ! -z $failed ]; then
118 rm -rf /tmp
/_aros_build_log_
*
123 #-- Remove uploaded files ----------------------------------------------------
124 if [[ "$CFG_UPLOAD_ENABLE" = "yes" && "$CFG_UPLOAD_PRUNE" = "yes" ]]; then
125 # This is the old way.
127 # The rm below is UNSAFE. If ARCHIVE_ROOT is undefined somehow, bye-bye
128 # to everything the build user can delete, from / on down.
129 #rm -rf $(ARCHIVE_ROOT)/*