about summary refs log tree commit diff stats
path: root/core/scripts/setup-iso.sh
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2017-08-02 01:04:50 +0100
committerSilvino Silva <silvino@bk.ru>2017-08-02 01:04:50 +0100
commitb1b5779493352c72cced0251625d0b850ebac5b8 (patch)
tree0f40548a2b5c8eaf9bd99423e21b8baf63b83d65 /core/scripts/setup-iso.sh
parented23bb3344ec5be2893db8d8d838c38c9f2baacd (diff)
parent65167272a3ba52dc4d032a1c60a9ff030408047d (diff)
downloaddoc-b1b5779493352c72cced0251625d0b850ebac5b8.tar.gz
new release 0.3.1
Diffstat (limited to 'core/scripts/setup-iso.sh')
-rw-r--r--core/scripts/setup-iso.sh50
1 files changed, 35 insertions, 15 deletions
diff --git a/core/scripts/setup-iso.sh b/core/scripts/setup-iso.sh
index 93858d6..e208378 100644
--- a/core/scripts/setup-iso.sh
+++ b/core/scripts/setup-iso.sh
@@ -1,17 +1,5 @@
 #!/bin/sh
 
-# Absolute path to this script, e.g. /home/user/bin/foo.sh
-SCRIPT=$(readlink -f "$0")
-# Absolute path this script is in, thus /home/user/bin
-SCRIPTPATH=$(dirname "$SCRIPT")
-
-DIR=$(dirname "$SCRIPTPATH");
-DIR_LOCAL="$(dirname $(dirname ${DIR}))/local";
-
-ISO_URL="https://serverop.de/crux/crux-3.2/iso/crux-3.2.iso"
-ISO_FILE="${DIR_LOCAL}/crux-3.2.iso"
-
-
 # First we define the function
 ConfirmOrExit ()
 {
@@ -31,9 +19,26 @@ ConfirmOrExit ()
     echo "You entered $CONFIRM. Continuing ..."
 }
 
-echo "1.1.1 Path/to crux-3.2.iso:"
-echo $ISO_FILE
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f "$0")
+# Absolute path this script is in, thus /home/user/bin
+SCRIPTPATH=$(dirname "$SCRIPT")
+
+DIR=$(dirname "$SCRIPTPATH");
+DIR_LOCAL="$(dirname $(dirname ${DIR}))/local";
+
+ISO_URL="https://serverop.de/crux/crux-3.3/iso/crux-3.3.iso"
+MD5_URL="https://serverop.de/crux/crux-3.3/iso/crux-3.3.md5"
+
+ISO_FILE="${DIR_LOCAL}/crux-3.3.iso"
+MD5_FILE="${DIR_LOCAL}/crux-3.3.md5"
+
+echo "1.1.1 Paths to iso and md5 files:"
+echo "dir: ${DIR_LOCAL}"
+echo "iso url: ${ISO_URL}"
+echo "md5 url: ${MD5_URL}"
 ConfirmOrExit
+mkdir -p ${DIR_LOCAL}
 
 #prepare_iso() {
 
@@ -42,7 +47,22 @@ ConfirmOrExit
         echo "File $ISO_FILE exists."
     else
         echo "File $ISO_FILE does not exist."
-        cd $ISO_PATH && { curl -k -O $ISO_URL ; cd -; }
+        cd $DIR_LOCAL && { curl -k -O $ISO_URL ; cd -; }
+    fi
+
+    if [ -f $MD5_FILE ];
+    then
+        echo "File ${MD5_FILE} exists."
+    else
+        echo "File ${MD5_FILE} does not exist."
+        cd ${DIR_LOCAL} && { curl -k -O ${MD5_URL} ; cd -; }
+    fi
+
+    if  cd ${DIR_LOCAL} && md5sum -c ${MD5_FILE} ;
+    then
+        echo "Valid iso md5sum"
+    else
+        echo "Invalid iso md5sum"
     fi
 
 #}