From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH v2] Improvement of backup iso script Date: Mon, 02 Jan 2017 19:17:58 +0000 Message-ID: <1483384678.13949.333.camel@ipfire.org> In-Reply-To: <1483370228-1118-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1311566124885873020==" List-Id: --===============1311566124885873020== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Thank you very much for your fixes. Merged. -Michael On Mon, 2017-01-02 at 16:17 +0100, Jonatan Schlag wrote: > 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 > --- >  src/scripts/backupiso | 24 ++++++++++++++++++++---- >  1 file changed, 20 insertions(+), 4 deletions(-) > > diff --git a/src/scripts/backupiso b/src/scripts/backupiso > index 014e8e9..1a682d0 100644 > --- a/src/scripts/backupiso > +++ b/src/scripts/backupiso > @@ -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 --===============1311566124885873020== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC Q2dBR0JRSllhcWRtQUFvSkVJQjU4UDl2a0FrSDZZQVAvaVVmZ2w5dG55MVFUaVhLbGZhRk14UUMK TU55N1hZTGhQb2FISkRQQlFSK1BDNUZkeURnU1d3OEVTQ25UMkVCR2hYbnduVUM3M05mUUZxdktW SWFJaVBzegpPTGpXSXA3SzlncUR4MWF0alcvaTRCL2h3NlVuUmY3c1FvRURkNXdtWGdHQWFVUUFR M1pQVWRzbXN3SFdvaXVNCjhCVEJQTk5zaWNiNWk0bEJBS3R5NTd0aVp3RUVWUjN1dE5Obzh5M2tO cEtIb1ZSaHZNS0EwUkorcEVRSHhLM1cKL1ZsWlYxZUUrbTdRNmRlYXIweUw1VlpaS24wZzFYa0dy SVBNYm9vNHZ4VVgra2FpRVpEYTBHc2hFc3MrRU5zZQpXYVlMTmtkNzJzazJGUFBwL1NlY0htKzJU NGRIQURIa25CZHN0aUVRL2JGYkZjZ0tKcUJvYzlRMHpRUlVzU0dIClhyMk1jRnhJSTh6dTZDczdB Skd6aUdjQUhkejI1OW9oaTN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