3 BASEDIR
="/build/nightly"
4 LOCKFILE
="/tmp/.nightly-builds.lock"
6 UPLOAD_DIR
="${BASEDIR}/upload"
7 UPLOAD_TO
="pakfire@git.ipfire.org:/pub/nightly"
8 RSYNC_ARGS
="--bwlimit=1M"
10 export MAKETUNING
="-j2"
12 extract_installer_from_iso
() {
15 local tmpdir
="$(mktemp -d)"
16 mkdir
-p "${dir}/images"
19 for file in ${dir}/*.iso
; do
20 if mount
-o loop
,ro
"${file}" "${tmpdir}"; then
22 for f
in vmlinuz instroot
; do
23 cp -f "${tmpdir}/boot/isolinux/${f}" "${dir}/images"
37 # Check if this actually source of IPFire 2
38 [ -x "${dir}/make.sh" ] ||
return 1
42 local branch
="$(git config build.branch)"
43 [ -z "${branch}" ] && branch
="master"
45 local commit_old
="$(git rev-parse HEAD)"
48 # If the branch was not updated, we won't build
49 local commit_new
="$(git rev-parse origin/${branch})"
50 [ "${commit_old}" = "${commit_new}" ] && return 2
52 # Checkout the latest commit
53 git
reset --hard "${commit_new}"
55 #local now="$(date -u +"%Y-%m-%d-%H:%M")"
56 local now
="$(git log --format="%cI
" -1 "${commit_new}")"
58 local targets
="$(git config build.targets)"
59 [ -z "${targets}" ] && targets
="i586"
62 for target
in ${targets}; do
63 local build_path
="${UPLOAD_DIR}/${branch}/${now}-${commit_new:0:8}"
64 local build
="${build_path}/${target}"
67 .
/make.sh
--target="${target}" clean
69 # Download the toolchain if required
70 .
/make.sh
--target="${target}" gettoolchain ||
continue
72 # Download all sources
73 .
/make.sh
--target="${target}" downloadsrc ||
continue
77 .
/make.sh
--target="${target}" build |
tee "${build}/build.log"
78 local ret
=${PIPESTATUS[0]}
81 if [ "${ret}" = "0" ]; then
82 mv -v *.iso
*.img.gz
*.
tar.bz2
*.md5 packages
/ "${build}"
83 extract_installer_from_iso
"${build}"
84 touch "${build}/.success"
92 .
/make.sh
--target="${target}" clean
93 rm -rf "${build_path}"
100 mkdir
-p "${UPLOAD_DIR}"
102 rsync
-avHz --progress ${RSYNC_ARGS} \
103 "${UPLOAD_DIR}/" "${UPLOAD_TO}"
119 # Don't start again if the script is already running
128 for repo
in $
(find ${BASEDIR} -maxdepth 2 -type d
-name ".git"); do
129 [ -d "${repo}" ] ||
continue
131 build
"$(dirname ${repo})"