2012-10-26 01:12:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source /etc/catalyst/catalyst.conf
|
|
|
|
|
|
|
|
mydate=`date +%Y%m%d`
|
|
|
|
|
|
|
|
undo_grsec() {
|
2013-05-09 21:10:48 +00:00
|
|
|
[[ -d /proc/sys/kernel/grsecurity ]] || return
|
2012-10-26 01:12:08 +00:00
|
|
|
for i in /proc/sys/kernel/grsecurity/chroot_* ; do
|
|
|
|
echo 0 > $i
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_confs() {
|
|
|
|
local arch=$1
|
|
|
|
local flavor=$2
|
|
|
|
|
|
|
|
for s in 1 2 3; do
|
2013-05-09 21:10:48 +00:00
|
|
|
|
|
|
|
local cstage=stage${s}
|
|
|
|
local p=$(( s - 1 ))
|
|
|
|
[[ $p == 0 ]] && p=3
|
|
|
|
local pstage=stage${p}
|
|
|
|
|
|
|
|
local parch="${arch}"
|
|
|
|
[[ "${arch}" == "i686" ]] && parch="x86"
|
|
|
|
|
|
|
|
local tarch="${arch}"
|
|
|
|
[[ "${arch}" == "amd64" ]] && tarch="x86_64"
|
|
|
|
|
|
|
|
cat stage-all.conf.template | \
|
2013-02-03 14:45:30 +00:00
|
|
|
sed -e "s:\(^version_stamp.*$\):\1-${mydate}:" \
|
2013-05-09 21:10:48 +00:00
|
|
|
-e "s:CSTAGE:${cstage}:g" \
|
|
|
|
-e "s:PSTAGE:${pstage}:g" \
|
|
|
|
-e "s:SARCH:${arch}:g" \
|
|
|
|
-e "s:PARCH:${parch}:g" \
|
|
|
|
-e "s:TARCH:${tarch}:g" \
|
|
|
|
-e "s:FLAVOR:${flavor}:g" \
|
|
|
|
-e "s:MYCATALYST:$(pwd):g" \
|
|
|
|
> stage${s}-${arch}-uclibc-${flavor}.conf
|
2012-10-26 01:12:08 +00:00
|
|
|
done
|
2013-05-09 21:10:48 +00:00
|
|
|
|
|
|
|
sed -i "/^chost/d" stage3-${arch}-uclibc-${flavor}.conf
|
2012-10-26 01:12:08 +00:00
|
|
|
}
|
|
|
|
|
2012-12-28 18:08:36 +00:00
|
|
|
banner() {
|
2012-12-31 09:59:17 +00:00
|
|
|
cat << EOF | tee -a zzz.log > stage$1-$2-uclibc-$3.log
|
|
|
|
|
|
|
|
************************************************************************
|
|
|
|
* stage$1-$2-uclibc-$3
|
|
|
|
************************************************************************"
|
|
|
|
|
|
|
|
EOF
|
2012-12-28 18:08:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-26 01:12:08 +00:00
|
|
|
do_stages() {
|
|
|
|
local arch=$1
|
|
|
|
local flavor=$2
|
|
|
|
|
|
|
|
for s in 1 2 3; do
|
2014-06-27 16:27:54 +00:00
|
|
|
local tgpath="${storedir}/builds/uclibc/${flavor}/${arch}"
|
2012-10-26 01:12:08 +00:00
|
|
|
local target="stage${s}-${arch}-uclibc-${flavor}-${mydate}.tar.bz2"
|
|
|
|
local tglink="stage${s}-${arch}-uclibc-${flavor}.tar.bz2"
|
|
|
|
|
|
|
|
if [[ ! -f "${tgpath}/${tglink}" ]]; then
|
|
|
|
touch stage${s}-${arch}-uclibc-${flavor}.log
|
|
|
|
echo "!!! ${target} at ${tgpath} doesn't exit" \
|
|
|
|
| tee -a zzz.log \
|
|
|
|
> stage${s}-${arch}-uclibc-${flavor}.err
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2013-06-14 13:29:05 +00:00
|
|
|
banner ${s} ${arch} ${flavor}
|
|
|
|
catalyst -f stage${s}-${arch}-uclibc-${flavor}.conf \
|
|
|
|
| tee -a zzz.log \
|
|
|
|
> stage${s}-${arch}-uclibc-${flavor}.log \
|
|
|
|
2> stage${s}-${arch}-uclibc-${flavor}.err
|
2012-10-26 01:12:08 +00:00
|
|
|
|
|
|
|
if [[ -f "${tgpath}/${target}" ]]; then
|
|
|
|
rm -f "${tgpath}/${tglink}"
|
|
|
|
ln -s ${target} "${tgpath}/${tglink}"
|
|
|
|
else
|
|
|
|
echo "!!! ${target} was not generated" \
|
|
|
|
| tee -a zzz.log \
|
|
|
|
>stage${s}-${arch}-uclibc-${flavor}.err
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main() {
|
|
|
|
>zzz.log
|
|
|
|
|
|
|
|
undo_grsec
|
|
|
|
|
2013-06-14 13:29:05 +00:00
|
|
|
catalyst -s current | tee -a zzz.log >snapshot.log 2>snapshot.err
|
2012-10-26 01:12:08 +00:00
|
|
|
|
|
|
|
for arch in amd64 i686; do
|
|
|
|
for flavor in hardened vanilla; do
|
|
|
|
prepare_confs ${arch} ${flavor}
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for arch in amd64 i686; do
|
|
|
|
for flavor in hardened vanilla; do
|
2013-06-14 13:29:05 +00:00
|
|
|
do_stages ${arch} ${flavor}
|
2012-10-26 01:12:08 +00:00
|
|
|
ret=$?
|
|
|
|
if [[ $? == 1 ]]; then
|
2014-06-27 16:27:54 +00:00
|
|
|
echo "FAILURE at ${arch} ${flavor} " | tee zzz.log
|
2012-10-26 01:12:08 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main $1 &
|