Proper error handling
This commit is contained in:
parent
cbccff8cc8
commit
de2e1bf79c
38
setup_env.sh
38
setup_env.sh
|
@ -4,39 +4,59 @@ function status_update {
|
||||||
echo "### $1 ###"
|
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")")"
|
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
cd "$base_dir"
|
cd "$base_dir"
|
||||||
|
|
||||||
# First, clone Francesco's eh_frame_check
|
# First, clone Francesco's eh_frame_check
|
||||||
status_update "Cloning 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
|
# Then, clone glibc
|
||||||
status_update "Cloning 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
|
# Install a virtualenv with required pip packages
|
||||||
status_update "Installing python virtualenv"
|
status_update "Installing python virtualenv"
|
||||||
virtualenv -p python3 venv
|
virtualenv -p python3 venv || fail
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt || fail
|
||||||
|
|
||||||
# Compiling glibc
|
# Compiling glibc
|
||||||
status_update "Compiling base glibc"
|
status_update "Compiling base glibc"
|
||||||
(
|
(
|
||||||
mkdir -p glibc/build/install
|
mkdir -p glibc/build/install
|
||||||
cd glibc/build
|
cd glibc/build
|
||||||
../configure --prefix=install
|
../configure --prefix=install || exit 1
|
||||||
make
|
make || exit 1
|
||||||
)
|
) || fail
|
||||||
|
|
||||||
# Compiling testsuite
|
# Compiling testsuite
|
||||||
status_update "Compiling glibc testsuite"
|
status_update "Compiling glibc testsuite"
|
||||||
status_update "Feel free to go and drink some coffee now. This will take some time."
|
status_update "Feel free to go and drink some coffee now. This will take some time."
|
||||||
(
|
(
|
||||||
cd glibc/build
|
cd glibc/build
|
||||||
make check
|
make check || exit 1
|
||||||
)
|
) || fail
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
status_update "All set!"
|
status_update "All set!"
|
||||||
|
|
Loading…
Reference in a new issue