summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/build_gold_image/build_fedora23.sh83
1 files changed, 83 insertions, 0 deletions
diff --git a/examples/build_gold_image/build_fedora23.sh b/examples/build_gold_image/build_fedora23.sh
new file mode 100755
index 0000000..8b8be74
--- /dev/null
+++ b/examples/build_gold_image/build_fedora23.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# Fedora 23
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:${PATH}
+
+ARCH=$1
+
+if test "x$ARCH" = "x"; then
+ echo "One argument expected (architecture)" 1>&2
+ exit 1
+fi
+
+case $ARCH in
+ i686)
+ PACKAGE_ARCH=i386
+ ARCH_SWITCH=linux32
+ ;;
+
+ x86_64)
+ PACKAGE_ARCH=x86_64
+ ARCH_SWITCH=
+ ;;
+
+ *)
+ echo "Unsupported architecture '$ARCH'" 1>&2
+ exit 1
+esac
+
+CHROOT_DIR=fed23-${ARCH}
+
+rm -rf $CHROOT_DIR
+
+mkdir $CHROOT_DIR
+
+mkdir -p $CHROOT_DIR/var/lib/rpm
+
+rpm -v --rebuilddb --root=`pwd`/$CHROOT_DIR
+
+wget http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/23/Server/${PACKAGE_ARCH}/os/Packages/f/fedora-release-23-1.noarch.rpm
+wget http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/23/Server/${PACKAGE_ARCH}/os/Packages/f/fedora-repos-23-1.noarch.rpm
+
+rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps fedora-release-23-1.noarch.rpm fedora-repos-23-1.noarch.rpm
+
+rm -f fedora-release-23-1.noarch.rpm
+rm -f fedora-repos-23-1.noarch.rpm
+
+wget -O RPM_PGP-KEY-Fedora-23 https://getfedora.org/static/34EC9CBA.txt
+
+rpm -v --root=`pwd`/$CHROOT_DIR --import RPM_PGP-KEY-Fedora-23
+
+rm RPM_PGP-KEY-Fedora-23
+
+${ARCH_SWITCH} yum --installroot=`pwd`/$CHROOT_DIR install -y yum
+${ARCH_SWITCH} yum --installroot=`pwd`/$CHROOT_DIR install -y dnf
+
+${ARCH_SWITCH} yum --installroot=`pwd`/$CHROOT_DIR install -y coreutils procps net-tools wget
+
+# rebuild the RPM database with the rpm inside the chroot
+${ARCH_SWITCH} chroot $CHROOT_DIR /bin/rpm -v --rebuilddb
+
+mknod -m 666 $CHROOT_DIR/dev/null c 1 3
+mknod -m 666 $CHROOT_DIR/dev/zero c 1 5
+mknod -m 666 $CHROOT_DIR/dev/random c 1 8
+mknod -m 666 $CHROOT_DIR/dev/urandom c 1 9
+mknod -m 666 $CHROOT_DIR/dev/tty c 5 0
+
+cp /etc/resolv.conf $CHROOT_DIR/etc/
+
+${ARCH_SWITCH} chroot ${CHROOT_DIR} dnf -y update
+
+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
+export PS1='[fedora23:\u@\h \W]\$ '
+EOF
+
+# development stuff
+
+${ARCH_SWITCH} chroot ${CHROOT_DIR} dnf install -y make gcc gcc-c++ rpm-build tar ccache distcc