summaryrefslogtreecommitdiff
path: root/examples/build_gold_image/build.sh
blob: 7400dfe394b9f30c47630fdc4e0e6cadb4ca1ca7 (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
#!/bin/sh

# Centos 6 (64-bit)

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:${PATH}

CHROOT_DIR=rhel6-x64

rm -rf $CHROOT_DIR

mkdir $CHROOT_DIR

mkdir -p $CHROOT_DIR/var/lib/rpm

rpm -v --rebuilddb --root=`pwd`/$CHROOT_DIR

wget http://mirror.centos.org/centos/6.5/os/x86_64/Packages/centos-release-6-5.el6.centos.11.1.x86_64.rpm

rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps centos-release-6-5.el6.centos.11.1.x86_64.rpm 

rm -f centos-release-6-5.el6.centos.11.1.x86_64.rpm

wget http://mirror.centos.org/centos/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6

rpm -v --root=`pwd`/$CHROOT_DIR --import RPM-GPG-KEY-CentOS-6 

rm RPM-GPG-KEY-CentOS-6

yum --installroot=`pwd`/$CHROOT_DIR install -y yum
yum --installroot=`pwd`/$CHROOT_DIR install -y coreutils procps net-tools wget

# rebuild the RPM database with the rpm inside the chroot
chroot $CHROOT_DIR /bin/rpm -v --rebuilddb

cp /etc/resolv.conf $CHROOT_DIR/etc/

cp $CHROOT_DIR/etc/skel/.bashrc $CHROOT_DIR/root
cp $CHROOT_DIR/etc/skel/.bash_profile $CHROOT_DIR/root
cp $CHROOT_DIR/etc/skel/.bash_logout $CHROOT_DIR/root

cat >> $CHROOT_DIR/root/.bash_profile <<EOF
export PATH=\$PATH:/usr/sbin:/usr/bin:/sbin:/bin
EOF

# development stuff

wget http://mirror.switch.ch/ftp/mirror/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps epel-release-6-8.noarch.rpm 

rm epel-release-6-8.noarch.rpm

wget http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6

rpm -v --root=`pwd`/$CHROOT_DIR --import RPM-GPG-KEY-EPEL-6

rm RPM-GPG-KEY-CentOS-6

yum --installroot=`pwd`/$CHROOT_DIR install -y make gcc gcc-c++ rpm-build tar ccache distcc git