2 START_TIME
=$
(date -u +"%H:%M")
4 UPLOAD_START_TIME
="N/A"
7 export LANG
=en_US.ISO8859-1
8 export SP
=$
(dirname $0)
10 source $SP/setup initial
13 #-- Update sources -----------------------------------------------------------
14 printi
"Starting $LANG nightly build on $CFG_NAME..."
17 printe
"Updating sources FAILED! ABORTING SCRIPT!"
19 STOP_TIME
=$
(date -u +"%H:%M")
21 mail_start
"FAILED COMPLETELY"
23 mail_write
"Updating sources FAILED! Please see attached log."
25 mail_send
"-a$LOG_BASE/update.log"
32 #-- Build packages -----------------------------------------------------------
35 for package
in $CFG_PACKAGES; do
36 printe
"package $package[(ws:.:)1]-$package[(ws:.:)3]"
37 zsh
$SP/pkg
/$package[(ws
:.
:)1]-$package[(ws
:.
:)3]
39 printe
"Build of package '"$package[(ws
:.
:)1]-$package[(ws
:.
:)3]"' FAILED."
40 failed
=( $failed $package[(ws
:.
:)1]-$package[(ws
:.
:)3] )
42 printi
"Build of package '"$package[(ws
:.
:)1]-$package[(ws
:.
:)3]"' completed successfully."
43 succeeded
=( $succeeded $package[(ws
:.
:)1]-$package[(ws
:.
:)3] )
47 #-- Cleanup ------------------------------------------------------------------
52 #-- Compress log files -------------------------------------------------------
53 printi
"Compressing log files..."
58 md5sum $file.bz2
>$file.bz2.md5
62 STOP_TIME
=$
(date -u +"%H:%M")
64 #-- Fix permissions ----------------------------------------------------------
65 chmod -R o-wx
,g
+wr Archive
/
66 find Archive
/ -type d |
xargs chmod a
+s
,g
+rwx
,o
+x
68 #-- Upload (backup and distribution) -----------------------------------------
69 printi
"Uploading archives..."
70 if [ "$CFG_UPLOAD_ENABLE" = "yes" ]; then
71 UPLOAD_START_TIME
=$
(date -u +"%H:%M")
72 if [ "$CFG_BACKUP_ENABLE" = "yes" ]; then
73 rsync
-avz -e "ssh -i $CFG_BS_KEY" Archive
/ $CFG_BS_USER@
$CFG_BS:$CFG_BS_DIRECTORY
75 rsync
-avz -e "ssh -i $CFG_DS_KEY" Archive
/ $CFG_DS_USER@
$CFG_DS:$CFG_DS_DIRECTORY
76 UPLOAD_STOP_TIME
=$
(date -u +"%H:%M")
79 #-- Generate report ----------------------------------------------------------
80 if [ "$CFG_MAIL_ENABLE" = "yes" ]; then
81 if [ -z $failed ]; then
82 RESULT
="completed successfully"
83 elif [ -z $succeeded ]; then
84 RESULT
="FAILED COMPLETELY"
86 RESULT
="FAILED PARTLY"
92 if [ ! -z $failed ]; then
94 mail_write
"The following packages FAILED to build completely:"
95 for package
in $failed; do
97 bzcat
$LOG_BASE/$package.log.bz2 |
tail -100 - >/tmp
/_aros_build_log_
$package
98 ATTACH
=( $ATTACH -a/tmp
/_aros_build_log_
$package )
101 mail_write
"Please see the attached shortened logs or the full logs at"
102 mail_write
"http://www.aros.org/downloads/nightly/$VERSION/logs/ for details."
104 if [ ! -z $succeeded ]; then
106 mail_write
"The following packages were built successfully:"
107 for package
in $succeeded; do
108 mail_write
"$package"
111 mail_write
"The following archives were created:"
112 mail_write
"$( find $ARCHIVE_BASE -type f -not -path '*/logs/*' -not -name '*.md5' | xargs -n 1 basename )"
114 mail_write
"The archives will be available for download from http://www.aros.org/download.php."
119 if [ ! -z $failed ]; then
120 rm -rf /tmp
/_aros_build_log_
*
125 #-- Remove uploaded files ----------------------------------------------------
126 if [[ "$CFG_UPLOAD_ENABLE" = "yes" && "$CFG_UPLOAD_PRUNE" = "yes" ]]; then
127 # This is the old way.
129 # The rm below is UNSAFE. If ARCHIVE_ROOT is undefined somehow, bye-bye
130 # to everything the build user can delete, from / on down.
131 #rm -rf $(ARCHIVE_ROOT)/*