]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Improvement of backup iso script
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Mon, 2 Jan 2017 15:17:08 +0000 (16:17 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 2 Jan 2017 19:12:14 +0000 (19:12 +0000)
The backup iso script did not check the arch of the host. On x86_64 host
the wrong iso was downloaded.

Furthermore, there were some if clauses which could cause trouble which
I also tried to improve.
(For example: -e is valid if we have a directory or a file, but we want
to check for a file only )

Fixes: 11258
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/backupiso

index 014e8e980f43648627c5360bd5763874114dba86..1a682d01645428f599fbc81e7befad93fcb05a9b 100644 (file)
@@ -1,9 +1,25 @@
 #!/bin/sh
+arch=$(uname -m)
+
+case $arch in
+       "i?86")
+               arch="i586"
+               echo "Your arch is $arch"
+               ;;
+       "x86_64")
+               arch="x86_64"
+               echo "Your arch is $arch"
+               ;;
+       *)
+               echo "Arch is not supported"
+               exit 1
+               ;;
+esac
 
 COREVER=$(cat /opt/pakfire/db/core/mine)
 # FIXME: edit this lines before release
 URL="http://download.ipfire.org/releases/ipfire-2.x/2.19-core$COREVER/"
-ISO="ipfire-2.19.i586-full-core$COREVER.iso"
+ISO="ipfire-2.19.$arch-full-core$COREVER.iso"
 
 if [ -z $1 ]; then
        echo usage: $0 backup-file
@@ -15,7 +31,7 @@ TS=$1
 mkdir -p /var/tmp/backupiso
 cd /var/tmp/backupiso
 
-if [ ! -e ${ISO} ]
+if [ ! -f ${ISO} ]
 then
        echo "Fetching ${URL}${ISO}"
        wget --quiet -c ${URL}${ISO}
@@ -26,7 +42,7 @@ wget --quiet -O ${ISO}.md5 ${URL}${ISO}.md5
 
 echo "Checking md5 of ${ISO}"
 md5sum --status -c ${ISO}.md5
-if [ $? -eq 0 -o $? -eq 24 ]
+if [ $? -eq 0 ] || [ $? -eq 24 ]
 then
        echo "md5 is OK"
 else
@@ -35,7 +51,7 @@ else
        wget --quiet -O ${ISO} ${URL}${ISO}
        echo "Checking again md5 of ${ISO}"
        md5sum --status -c ${ISO}.md5
-       if [ $? -eq 0 -o $? -eq 24 ]
+       if [ $? -eq 0 ] || [ $? -eq 24 ]
        then
                echo "md5 is OK"
        else