Added check to see if snap is installed

keyword-vs-text-changes
Dev Dua 2018-05-15 09:59:54 +05:30
parent f8cbe7e825
commit 43feaa7407
1 changed files with 13 additions and 6 deletions

View File

@ -105,11 +105,18 @@ install_docker(){
ERROR=$?
if [ $ERROR -ne 0 ]; then
echoerror "Could not install docker via convenience script (Error Code: $ERROR)."
echo "[HELK-INSTALLATION-INFO] Trying to docker install via snap.."
snap install docker >> $LOGFILE 2>&1
ERROR=$?
if [ $ERROR -ne 0 ]; then
echoerror "Could not install docker via snap (Error Code: $ERROR)."
if [ -x "$(command -v snap)" ]; then
SNAP_VERSION=$(snap version | grep -w 'snap' | awk '{print $2}')
echo "[HELK-INSTALLATION-INFO] Snap v$SNAP_VERSION is available. Trying to install docker via snap.."
snap install docker >> $LOGFILE 2>&1
ERROR=$?
if [ $ERROR -ne 0 ]; then
echoerror "Could not install docker via snap (Error Code: $ERROR)."
exit 1
fi
echo "[HELK-INSTALLATION-INFO] Docker successfully installed via snap."
else
echo "[HELK-INSTALLATION-INFO] Docker could not be installed. Check /var/log/helk-install.log for details."
exit 1
fi
fi