tools-musl: pull out code in run scripts
This commit is contained in:
parent
1b1c6c367c
commit
54ad5b197e
4 changed files with 65 additions and 159 deletions
62
tools-musl/common.sh
Normal file
62
tools-musl/common.sh
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /etc/catalyst/catalyst.conf
|
||||||
|
|
||||||
|
mydate=`date +%Y%m%d`
|
||||||
|
|
||||||
|
|
||||||
|
undo_grsec() {
|
||||||
|
[[ -d /proc/sys/kernel/grsecurity ]] || return
|
||||||
|
for i in /proc/sys/kernel/grsecurity/chroot_* ; do
|
||||||
|
echo 0 > $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
banner() {
|
||||||
|
cat << EOF | tee -a zzz.log > stage$1-$2-musl-$3.log
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* stage$1-$2-musl-$3
|
||||||
|
************************************************************************"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
do_stages() {
|
||||||
|
local arch=$1
|
||||||
|
local flavor=$2
|
||||||
|
|
||||||
|
for s in 1 2 3; do
|
||||||
|
local tgpath="${storedir}/builds/musl/${flavor}/${arch}"
|
||||||
|
local target="stage${s}-${arch}-musl-${flavor}-${mydate}.tar.bz2"
|
||||||
|
local tglink="stage${s}-${arch}-musl-${flavor}.tar.bz2"
|
||||||
|
|
||||||
|
if [[ ! -f "${tgpath}/${tglink}" ]]; then
|
||||||
|
touch stage${s}-${arch}-musl-${flavor}.log
|
||||||
|
echo "!!! ${tglink} at ${tgpath} doesn't exist" \
|
||||||
|
| tee -a zzz.log \
|
||||||
|
> stage${s}-${arch}-musl-${flavor}.err
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
banner ${s} ${arch} ${flavor}
|
||||||
|
catalyst -f stage${s}-${arch}-musl-${flavor}.conf \
|
||||||
|
| tee -a zzz.log \
|
||||||
|
> stage${s}-${arch}-musl-${flavor}.log \
|
||||||
|
2> stage${s}-${arch}-musl-${flavor}.err
|
||||||
|
|
||||||
|
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}-musl-${flavor}.err
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/catalyst/catalyst.conf
|
source common.sh
|
||||||
|
|
||||||
mydate=`date +%Y%m%d`
|
|
||||||
|
|
||||||
prepare_confs() {
|
prepare_confs() {
|
||||||
local arch=$1
|
local arch=$1
|
||||||
|
@ -42,54 +40,6 @@ prepare_confs() {
|
||||||
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
banner() {
|
|
||||||
cat << EOF | tee -a zzz.log > stage$1-$2-musl-$3.log
|
|
||||||
|
|
||||||
************************************************************************
|
|
||||||
* stage$1-$2-musl-$3
|
|
||||||
************************************************************************"
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
do_stages() {
|
|
||||||
local arch=$1
|
|
||||||
local flavor=$2
|
|
||||||
|
|
||||||
for s in 1 2 3; do
|
|
||||||
local tgpath="${storedir}/builds/musl/${flavor}/${arch}"
|
|
||||||
local target="stage${s}-${arch}-musl-${flavor}-${mydate}.tar.bz2"
|
|
||||||
local tglink="stage${s}-${arch}-musl-${flavor}.tar.bz2"
|
|
||||||
|
|
||||||
if [[ ! -f "${tgpath}/${tglink}" ]]; then
|
|
||||||
touch stage${s}-${arch}-musl-${flavor}.log
|
|
||||||
echo "!!! ${target} at ${tgpath} doesn't exit" \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
banner ${s} ${arch} ${flavor}
|
|
||||||
catalyst -f stage${s}-${arch}-musl-${flavor}.conf \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.log \
|
|
||||||
2> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
|
|
||||||
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}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
>zzz.log
|
>zzz.log
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/catalyst/catalyst.conf
|
source common.sh
|
||||||
|
|
||||||
mydate=`date +%Y%m%d`
|
|
||||||
|
|
||||||
prepare_confs() {
|
prepare_confs() {
|
||||||
local arch=$1
|
local arch=$1
|
||||||
|
@ -34,53 +32,6 @@ prepare_confs() {
|
||||||
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
banner() {
|
|
||||||
cat << EOF | tee -a zzz.log > stage$1-$2-musl-$3.log
|
|
||||||
|
|
||||||
************************************************************************
|
|
||||||
* stage$1-$2-musl-$3
|
|
||||||
************************************************************************"
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
do_stages() {
|
|
||||||
local arch=$1
|
|
||||||
local flavor=$2
|
|
||||||
|
|
||||||
for s in 1 2 3; do
|
|
||||||
local tgpath="${storedir}/builds/musl/${flavor}/${arch}"
|
|
||||||
local target="stage${s}-${arch}-musl-${flavor}-${mydate}.tar.bz2"
|
|
||||||
local tglink="stage${s}-${arch}-musl-${flavor}.tar.bz2"
|
|
||||||
|
|
||||||
if [[ ! -f "${tgpath}/${tglink}" ]]; then
|
|
||||||
touch stage${s}-${arch}-musl-${flavor}.log
|
|
||||||
echo "!!! ${target} at ${tgpath} doesn't exit" \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
banner ${s} ${arch} ${flavor}
|
|
||||||
catalyst -f stage${s}-${arch}-musl-${flavor}.conf \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.log \
|
|
||||||
2> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
|
|
||||||
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}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/catalyst/catalyst.conf
|
source common.sh
|
||||||
|
|
||||||
mydate=`date +%Y%m%d`
|
|
||||||
|
|
||||||
undo_grsec() {
|
|
||||||
[[ -d /proc/sys/kernel/grsecurity ]] || return
|
|
||||||
for i in /proc/sys/kernel/grsecurity/chroot_* ; do
|
|
||||||
echo 0 > $i
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare_confs() {
|
prepare_confs() {
|
||||||
local arch=$1
|
local arch=$1
|
||||||
|
@ -43,54 +34,6 @@ prepare_confs() {
|
||||||
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
banner() {
|
|
||||||
cat << EOF | tee -a zzz.log > stage$1-$2-musl-$3.log
|
|
||||||
|
|
||||||
************************************************************************
|
|
||||||
* stage$1-$2-musl-$3
|
|
||||||
************************************************************************"
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
do_stages() {
|
|
||||||
local arch=$1
|
|
||||||
local flavor=$2
|
|
||||||
|
|
||||||
for s in 1 2 3; do
|
|
||||||
local tgpath="${storedir}/builds/musl/${flavor}/${arch}"
|
|
||||||
local target="stage${s}-${arch}-musl-${flavor}-${mydate}.tar.bz2"
|
|
||||||
local tglink="stage${s}-${arch}-musl-${flavor}.tar.bz2"
|
|
||||||
|
|
||||||
if [[ ! -f "${tgpath}/${tglink}" ]]; then
|
|
||||||
touch stage${s}-${arch}-musl-${flavor}.log
|
|
||||||
echo "!!! ${tglink} at ${tgpath} doesn't exist" \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
banner ${s} ${arch} ${flavor}
|
|
||||||
catalyst -f stage${s}-${arch}-musl-${flavor}.conf \
|
|
||||||
| tee -a zzz.log \
|
|
||||||
> stage${s}-${arch}-musl-${flavor}.log \
|
|
||||||
2> stage${s}-${arch}-musl-${flavor}.err
|
|
||||||
|
|
||||||
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}-musl-${flavor}.err
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
>zzz.log
|
>zzz.log
|
||||||
|
|
Loading…
Add table
Reference in a new issue