Set version to 2.9rc1.
[people/pmueller/ipfire-2.x.git] / src / scripts / backupiso
CommitLineData
f4459fc9
DG
1#!/bin/sh
2
aba23e91 3COREVER=`cat /opt/pakfire/db/core/mine`
f4459fc9 4# FIXME: edit this lines before release
ffb19dad 5URL=http://download.ipfire.org/iso/
c2cc3cf1 6ISO=ipfire-2.9rc1.i586-full-core$COREVER.iso
f4459fc9
DG
7
8if [ -z "$1" ]; then
9 echo usage: $0 backup-file
10 exit
11fi
12
13TS=$1
14
15mkdir -p /var/tmp/backupiso
16cd /var/tmp/backupiso
17
18echo "Fetching ${URL}${ISO}"
19wget --quiet -c ${URL}${ISO}
20echo "Fetching ${URL}md5sums.txt"
f6281b9a 21wget --quiet -O ${ISO}.md5 ${URL}${ISO}.md5
f4459fc9
DG
22
23echo "Checking md5 of ${ISO}"
f6281b9a 24md5sum --status -c ${ISO}.md5
f4459fc9
DG
25RETVAR="$?"
26if [ $RETVAR -eq 0 -o $RETVAR -eq 24 ]
27 then
28 echo "md5 is OK"
29 else
30 echo "md5 mismatch"
31 echo "Fetching again ${URL}${ISO}"
32 wget --quiet -O ${ISO} ${URL}${ISO}
33fi
34
35echo "Remastering iso"
36mkdir -p backupiso.tmp.${TS}
37mount -o loop ${ISO} backupiso.tmp.${TS}
38cp -pr backupiso.tmp.${TS} backupiso.${TS}
39umount backupiso.tmp.${TS}
40rm -r backupiso.tmp.${TS}
41
f6281b9a 42echo "RESTORE_FILE=${TS}.ipf" >> backupiso.${TS}/boot/unattended.conf
f4459fc9
DG
43cp /var/ipfire/backup/${TS}.ipf backupiso.${TS}
44
45echo "Running mkisofs"
46mkisofs -J -r -V "ipfire backup ${TS}" \
47 -b boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \
48 -c boot/isolinux/boot.catalog backupiso.${TS} > `basename ${ISO} .iso`-${TS}.iso
49
50echo "Cleaning up"
51rm -rf backupiso.${TS}