summaryrefslogtreecommitdiffstats
path: root/scripts/buildinstall
blob: 88707b9f2ccb3338d4a8df62b0f7bf5f29d7e059 (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
#!/bin/bash

if [ ! -d $1/RedHat/RPMS ]; then
    echo $1 is not a Red Hat image >&2
    exit 1
fi

p=`cd $1; /bin/pwd`

BUILDINSTDIR=$p/buildinstall.tree.$$

rm -rf $BUILDINSTDIR
mkdir -p $BUILDINSTDIR

UPD_INSTROOT=./upd-instroot
MK_IMAGES=./mk-images

BUILDARCH=`rpm -qp --qf "%{ARCH}" $p/RedHat/RPMS/anaconda-runtime-[0-9]*`

if [ ! -f $UPD_INSTROOT ]; then
    cd $BUILDINSTDIR
    rpm2cpio $p/RedHat/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd ./usr/lib/anaconda-runtime/upd-instroot usr/lib/anaconda-runtime/upd-instroot
    mv usr/lib/anaconda-runtime/upd-instroot .
    rm -rf usr
else
    cp -a $UPD_INSTROOT $BUILDINSTDIR/upd-instroot
fi
UPD_INSTROOT=$BUILDINSTDIR/upd-instroot

if [ ! -f $MK_IMAGES ]; then
    cd $BUILDINSTDIR
    rpm2cpio $p/RedHat/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd ./usr/lib/anaconda-runtime/mk-images* usr/lib/anaconda-runtime/mk-images*
    mv usr/lib/anaconda-runtime/mk-images* .
    rm -rf usr
else
    cp $MK_IMAGES* $BUILDINSTDIR/
fi
MK_IMAGES=$BUILDINSTDIR/mk-images

echo "Building images..."
$UPD_INSTROOT $p/RedHat/RPMS $p/image-template $p/RedHat/instimage

# XXX hack - msw
if [ $BUILDARCH = "sparc" ]; then
    BUILDARCH=sparc64
fi

if [ -x /usr/bin/runroot ]; then
    runroot dist-7.0 --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $p/RedHat/RPMS $p $p/image-template $BUILDARCH"
else
    $MK_IMAGES $p/RedHat/RPMS $p $p/image-template $BUILDARCH
fi

#rm -rf $BUILDINSTDIR
#rm -rf $p/image-template $p/RedHat/instimage/usr/lib/anaconda-runtime