summaryrefslogtreecommitdiffstats
path: root/tools/nightly-composes
blob: 6ecc9e9c81443e5fa03f44fe4a35ae024408ae5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash

TOPDIR=/var/tmp

STATEFILE=$TOPDIR/nightlylivecdstatefile
# WARNING: MirrorManager must always give this mirror to the host running this script
STATEPATH=http://infrastructure.fedoraproject.org/pub/fedora/linux/development/13/x86_64/os/repodata/repomd.xml

getdatehash() {
     DUMP=$(wget --no-cache -S $1 -O /dev/null 2>&1)
     echo "$DUMP" | grep -q "HTTP/1.1 200 OK"
     if [ $? -eq 0 ]; then
         DATE=$(echo "$DUMP"|grep '^  Last-Modified'|sha1sum |awk {'print $1'})
     else
         echo "ERROR: $STATEPATH failed."
         exit 1
     fi
}
getdatehash $STATEPATH

if [ -f $STATEFILE ]; then
     OLDDATE=$(cat $STATEFILE)
     if [ "$OLDDATE" == "$DATE" ]; then
         # No change, exit
         exit 0
     fi
fi

# Save date hash
echo "$DATE" > $STATEFILE
echo "Saving date hash: $DATE"

# Check for running livecd-creator and abort if it is running
if ps -ef |grep -v grep |grep -q livecd-creator; then
     echo "ERROR: Another livecd-creator is still running.  Aborting."
     exit 255
fi

if [ ! -d $TOPDIR/spin-kickstarts/ ]; then
     cd $TOPDIR
     git clone http://git.fedorahosted.org/git/spin-kickstarts.git
fi

# pull any git updates to kickstarts

cd $TOPDIR/spin-kickstarts/
git reset --hard
git pull

if [ ! -d $TOPDIR/nightly-composes ]; then
	mkdir -p $TOPDIR/nightly-composes
fi

DATE=`date +%Y%m%d.%H`

# remove the previous days compose
find $TOPDIR/nightly-composes/ -name '*.iso' -exec rm -f '{}' \;

# loop though the valid spins
for i in `echo desktop design-suite xfce broffice.org kde electronic-lab games lxde soas security`
do

   cd $TOPDIR/nightly-composes/

   echo $i

   if [ ! -d $TOPDIR/nightly-composes/$i ]; then
  	mkdir -p $TOPDIR/nightly-composes/$i
   fi
   if [ ! -d $TOPDIR/nightly-composes/$i/logs ]; then
  	mkdir -p $TOPDIR/nightly-composes/$i/logs
	touch $TOPDIR/nightly-composes/$i/logs/SIZEHISTORY-i386
	touch $TOPDIR/nightly-composes/$i/logs/SIZEHISTORY-x86_64
   fi

   cd $i

   # compose f13 not rawhide for now.
   sed -i 's/rawhide/fedora-13/g' $TOPDIR/spin-kickstarts/*.ks

   # debrand
   # Note this is not needed for 'official' test spins
   #sed -i 's/^-fedora-logos/fedora-logos/' $TOPDIR/spin-kickstarts/fedora-livecd-$i.ks
   #sed -i 's/^generic-logos//' $TOPDIR/spin-kickstarts/fedora-livecd-$i.ks

   echo "INFO: $i i386 live image compose starting"
   setarch i386 livecd-creator -c $TOPDIR/spin-kickstarts/fedora-live*-$i.ks -f $i-i386-$DATE > logs/$DATE-i386.log 2>&1
   if [ $? -ne 0 ]; then
        echo "ERROR: $i i386 live image failed to compose on $DATE"
	mv logs/$DATE-i386.log logs/$DATE-FAILED-i386.log
   else
        du $TOPDIR/nightly-composes/$i/$i-i386-$DATE.iso >> logs/SIZEHISTORY-i386
        tail -2 logs/SIZEHISTORY-i386
	rm -f CHECKSUM-i386
	sha256sum $i-i386-$DATE.iso > CHECKSUM-i386
        cat CHECKSUM-i386
        echo "INFO: $i i386 live image compose finished OK"
   fi

   echo "INFO: $i x86_64 live image compose starting"
   # Need to shorten the electronic-lab label to the 32 char limit
   if [ "$i" = "electronic-lab" ]; then
	livecd-creator -c $TOPDIR/spin-kickstarts/fedora-live*-$i.ks -f e-lab-x86_64-$DATE    > logs/$DATE-x86_64.log 2>&1
   else
   	livecd-creator -c $TOPDIR/spin-kickstarts/fedora-live*-$i.ks -f $i-x86_64-$DATE    > logs/$DATE-x86_64.log 2>&1
   fi
   if [ $? -ne 0 ]; then
        echo "ERROR: $i x86_64 live image failed to compose on $DATE"
	mv logs/$DATE-x86_64.log logs/$DATE-FAILED-x86_64.log
   else
        if [ "$i" = "electronic-lab" ]; then
             du $TOPDIR/nightly-composes/$i/e-lab-x86_64-$DATE.iso >> logs/SIZEHISTORY-x86_64
             tail -2 logs/SIZEHISTORY-x86_64
	     rm -f CHECKSUM-x86_64
	     sha256sum e-lab-x86_64-$DATE.iso > CHECKSUM-x86_64
             cat CHECKSUM-x86_64
        else
             du $TOPDIR/nightly-composes/$i/$i-x86_64-$DATE.iso >> logs/SIZEHISTORY-x86_64
             tail -2 logs/SIZEHISTORY-x86_64
	     rm -f CHECKSUM-x86_64
	     sha256sum $i-x86_64-$DATE.iso > CHECKSUM-x86_64
             cat CHECKSUM-x86_64
        fi
        echo "INFO: $i x86_64 live image compose finished OK"
   fi

   # remove old resize image
   #rm -f /tmp/resize-image-*
done

# do aos spin
echo "INFO: aos i386 live image compose starting"
cd $TOPDIR/nightly-composes/aos/
setarch i386 livecd-creator -c $TOPDIR/spin-kickstarts/fedora-aos.ks -f aos-i386-$DATE > logs/$DATE-i386.log 2>&1
if [ $? -ne 0 ]; then
        echo "ERROR: aos i386 live image failed to compose on $DATE"
	mv logs/$DATE-i386.log logs/$DATE-FAILED-i386.log
else
        du $TOPDIR/nightly-composes/aos/aos-i386-$DATE.iso >> logs/SIZEHISTORY-i386
        tail -2 logs/SIZEHISTORY-i386
	rm -f CHECKSUM-i386
	sha256sum aos-i386-$DATE.iso > CHECKSUM-i386
	cat CHECKSUM-i386
        echo "INFO: aos i386 live image compose finished OK"
fi

echo "INFO: aos x86_64 live image compose starting"
livecd-creator -c $TOPDIR/spin-kickstarts/fedora-aos.ks -f aos-x86_64-$DATE    > logs/$DATE-x86_64.log 2>&1
if [ $? -ne 0 ]; then
        echo "ERROR: aos x86_64 live image failed to compose on $DATE"
	mv logs/$DATE-x86_64.log logs/$DATE-FAILED-x86_64.log
else
        du $TOPDIR/nightly-composes/aos/aos-x86_64-$DATE.iso >> logs/SIZEHISTORY-x86_64
        tail -2 logs/SIZEHISTORY-x86_64 
	rm -f CHECKSUM-x86_64
	sha256sum aos-x86_64-$DATE.iso > CHECKSUM-x86_64
        cat CHECKSUM-x86_64
        echo "INFO: aos x86_64 live image compose finished OK"
fi