-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredhat-7.x-cdtool
executable file
·144 lines (124 loc) · 3.94 KB
/
redhat-7.x-cdtool
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
#!/bin/sh -x
#
# cdtool - The behind-the-scenes magic glue that happens before a CD is made
#
# Michael Jennings <[email protected]>
# 21 July 2000
#
# $Id: redhat-7.x-cdtool,v 1.28 2003/12/31 11:53:50 mej Exp $
#
umask 022
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PYTHONPATH=/usr/lib/anaconda
export PYTHONPATH
if [ "x$1" = "x-i" ]; then
IMAGE=1
shift
else
IMAGE=0
fi
V_VER=`cut -d' ' -f2 /etc/vermillion`
RH_VER=`cut -d' ' -f5 /etc/redhat-release`
trap 'exit -1' 1 2 15
if [ "x$MEZZANINE_BUILDDIR" != "x" ]; then
BUILDDIR=$MEZZANINE_BUILDDIR
else
BUILDDIR=$PWD/build.mezz
fi
CD1=vermillion-${V_VER}-cd1
CD2=vermillion-${V_VER}-cd2
CD=vermillion-${V_VER}-cd
EXTRAS=vermillion-${V_VER}-extras
NET=vermillion-${V_VER}-net
RH_GOOP_DIR=/usr/lib/anaconda-runtime
RH_KERNEL_GOOP=$RH_GOOP_DIR/buildinstall
RH_PKGLIST_GOOP=$RH_GOOP_DIR/genhdlist
RH_SPLIT_GOOP=$RH_GOOP_DIR/pkgorder
# Make sure we have the anaconda goop
if [ ! -d $RH_GOOP_DIR ]; then
echo "You must have the Anaconda runtime package installed!"
exit -1
fi
if [ $IMAGE -eq 1 ]; then
cd $BUILDDIR
if [ -d $NET.new ]; then
rm -rf $NET.new
fi
cp -a $NET $NET.new
# Update the install image, boot images, etc. with the new kernel
cd $NET.new
$RH_KERNEL_GOOP `pwd`
rm -rf RedHat/instimage image-template
# Generate the diff
cd $BUILDDIR
diff -x CVS -x .cvsignore -x '*.rpm' -ur $NET $NET.new >$NET.patch 2>&1
#${EDITOR:-vi} $NET.patch
# Make sure there's nothing new popping up unexpectedly.
ONLY=`grep '^Only' $NET.patch | sed 's/: /\//' | awk '{print $3}'`
if [ -n "$ONLY" ]; then
echo "The following files were found only in one tree:"
echo $ONLY
echo
echo "This is probably a problem. Correct it, then hit Enter to continue."
read
fi
# Copy over all the changed files
rm -f $NET.sh
grep '^Binary' $NET.patch | awk '{print "cp -af "$5" "$3}' > $NET.sh
sh $NET.sh
for i in RedHat/base dosutils images ; do
test -d $NET/$i && (cd $NET ; tar --exclude CVS -cf - $i) | (cd $CD1 ; tar -xf -)
done
fi
# Generate the hdlist for network-based installs
cd $BUILDDIR/$NET
$RH_PKGLIST_GOOP `pwd`
cd $BUILDDIR
$RH_SPLIT_GOOP $NET i386 > $NET/vermillion-${V_VER}-packages.list
NUM=1
rm -f ${CD}*/RedHat/RPMS/*.rpm
for i in `cat $NET/vermillion-${V_VER}-packages.list` ; do
for j in $NET/RedHat/RPMS/$i* ; do
ln -f $j $CD$NUM/RedHat/RPMS/
done
SIZE=`du -ks $CD$NUM | cut -f1`
if [ $SIZE -gt 665000 ]; then
rm -f $CD$NUM/RedHat/RPMS/$i*
NUM=$(($NUM + 1))
for j in $NET/RedHat/RPMS/$i* ; do
ln -f $j $CD$NUM/RedHat/RPMS/
done
fi
done
# Regenerate the package list ($CD1/RedHat/base/hdlist) from $CD1/RedHat/base/comps
$RH_PKGLIST_GOOP --fileorder $NET/vermillion-${V_VER}-packages.list --withnumbers $BUILDDIR/$CD*
# Create ISO files
cd $BUILDDIR
for i in 1 2 3 4 5 6 7 ; do
test -d $CD$i || break
if [ -f $CD$i/dosutils/autoboot/cdboot.img ]; then
CDIMG="--boot dosutils/autoboot/cdboot.img"
elif [ -f $BUILDDIR/$CD$i/images/boot.img ]; then
CDIMG="--boot images/boot.img"
else
CDIMG=""
fi
mediatool -i vermillion-os-${V_VER}-cd$i.iso -D vermillion-${V_VER}-cd$i $CDIMG
done
test -d vermillion-${V_VER}-extras && mediatool -i vermillion-extras-${V_VER}.iso -D vermillion-${V_VER}-extras
if [ ! -x /usr/bin/genbasedir ]; then
echo "apt not found. Not generating repository list."
else
cd $NET/RedHat
rm -f RPMS.all && ln -s RPMS RPMS.all
rm -f SRPMS.all && ln -s ../../vermillion-7.3.1-www/SRPMS SRPMS.all
rm -f base/hdlist.all && ln -s hdlist base/hdlist.all
genbasedir -s --default-key=vermillion --progress --bz2only --bloat --flat $BUILDDIR/$NET/RedHat all
#gpg -s -u vermillion base/hashfile
cd $BUILDDIR
fi
if [ ! -x /usr/bin/yum-arch ]; then
echo "yum not found. Not generating headers."
else
yum-arch -cz $BUILDDIR/vermillion-7.3.1-www/RPMS
fi