Proper error handling
This commit is contained in:
parent
cbccff8cc8
commit
de2e1bf79c
1 changed files with 29 additions and 9 deletions
38
setup_env.sh
38
setup_env.sh
|
@ -4,39 +4,59 @@ function status_update {
|
|||
echo "### $1 ###"
|
||||
}
|
||||
|
||||
function fail {
|
||||
echo "An error has occured. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
function gitclone {
|
||||
if [ -d "$2" ] ; then
|
||||
if [ -d "$2/.git" ] ; then
|
||||
git -C "$2" pull || fail
|
||||
else
|
||||
>&2 echo "Directory "$2" is present and not git. Aborting."
|
||||
fail
|
||||
fi
|
||||
else
|
||||
git clone "$1" "$2" || fail
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||
cd "$base_dir"
|
||||
|
||||
# First, clone Francesco's eh_frame_check
|
||||
status_update "Cloning eh_frame_check"
|
||||
git clone https://github.com/francesco-zappa-nardelli/eh_frame_check/
|
||||
gitclone \
|
||||
https://github.com/francesco-zappa-nardelli/eh_frame_check/ eh_frame_check
|
||||
|
||||
# Then, clone glibc
|
||||
status_update "Cloning glibc"
|
||||
git clone git://sourceware.org/git/glibc.git glibc
|
||||
gitclone git://sourceware.org/git/glibc.git glibc
|
||||
|
||||
# Install a virtualenv with required pip packages
|
||||
status_update "Installing python virtualenv"
|
||||
virtualenv -p python3 venv
|
||||
virtualenv -p python3 venv || fail
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements.txt || fail
|
||||
|
||||
# Compiling glibc
|
||||
status_update "Compiling base glibc"
|
||||
(
|
||||
mkdir -p glibc/build/install
|
||||
cd glibc/build
|
||||
../configure --prefix=install
|
||||
make
|
||||
)
|
||||
../configure --prefix=install || exit 1
|
||||
make || exit 1
|
||||
) || fail
|
||||
|
||||
# Compiling testsuite
|
||||
status_update "Compiling glibc testsuite"
|
||||
status_update "Feel free to go and drink some coffee now. This will take some time."
|
||||
(
|
||||
cd glibc/build
|
||||
make check
|
||||
)
|
||||
make check || exit 1
|
||||
) || fail
|
||||
|
||||
# Done!
|
||||
status_update "All set!"
|
||||
|
|
Loading…
Reference in a new issue