Check for install results at the end of script

This commit is contained in:
hwdsl2 2016-01-17 14:55:43 -06:00
parent 4ab84f14aa
commit be2695732d
2 changed files with 16 additions and 12 deletions

View File

@ -106,6 +106,11 @@ tar xvzf "$SWAN_FILE" && rm -f "$SWAN_FILE"
cd "libreswan-${SWAN_VER}" || { echo "Failed to enter Libreswan source directory. Aborting."; exit 1; }
make programs && make install
# Restart services
/usr/sbin/service ipsec restart
/usr/sbin/service xl2tpd restart
# Check if Libreswan install was successful
/usr/local/sbin/ipsec --version 2>/dev/null | grep -qs "${SWAN_VER}"
if [ "$?" != "0" ]; then
echo
@ -115,9 +120,6 @@ if [ "$?" != "0" ]; then
exit 1
fi
service ipsec restart
service xl2tpd restart
echo
echo "Congratulations! Libreswan ${SWAN_VER} was installed successfully!"

View File

@ -113,7 +113,7 @@ yum -y install nss-devel nspr-devel pkgconfig pam-devel \
fipscheck-devel unbound-devel gmp gmp-devel xmlto
yum -y install ppp xl2tpd
# Installed Libevent 2. Use backported version for CentOS 6.
# Installed Libevent2. Use backported version for CentOS 6.
if grep -qs "release 6" /etc/redhat-release; then
LE2_URL="https://people.redhat.com/pwouters/libreswan-rhel6"
RPM1="libevent2-2.0.21-1.el6.x86_64.rpm"
@ -136,6 +136,16 @@ tar xvzf "$SWAN_FILE" && rm -f "$SWAN_FILE"
cd "libreswan-${SWAN_VER}" || { echo "Failed to enter Libreswan source directory. Aborting."; exit 1; }
make programs && make install
# Restore SELinux contexts
restorecon /etc/ipsec.d/*db 2>/dev/null
restorecon /usr/local/sbin -Rv 2>/dev/null
restorecon /usr/local/libexec/ipsec -Rv 2>/dev/null
# Restart services
/sbin/service ipsec restart
/sbin/service xl2tpd restart
# Check if Libreswan install was successful
/usr/local/sbin/ipsec --version 2>/dev/null | grep -qs "${SWAN_VER}"
if [ "$?" != "0" ]; then
echo
@ -145,14 +155,6 @@ if [ "$?" != "0" ]; then
exit 1
fi
# Restore SELinux contexts
restorecon /etc/ipsec.d/*db 2>/dev/null
restorecon /usr/local/sbin -Rv 2>/dev/null
restorecon /usr/local/libexec/ipsec -Rv 2>/dev/null
service ipsec restart
service xl2tpd restart
echo
echo "Congratulations! Libreswan ${SWAN_VER} was installed successfully!"