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

@ -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!"