| 1 |
# basefiles/Makefile (c) 2011 Michael Goetze <mgoetze@mgoetze.net>
|
| 2 |
#
|
| 3 |
# Usage example: sudo make SQUEEZE64.tar.xz
|
| 4 |
#
|
| 5 |
# This Makefile can build .tar.xz and .tar.gz basefiles for:
|
| 6 |
# Debian GNU/Linux 6.0 (SQUEEZE32, SQUEEZE64)
|
| 7 |
# Ubuntu 10.04 (LUCID32, LUCID64)
|
| 8 |
# CentOS 5 (CENTOS5_32, CENTOS5_64)
|
| 9 |
#
|
| 10 |
# Packages you might want to install to use this Makefile:
|
| 11 |
# debootstrap, rinse, xz-utils
|
| 12 |
|
| 13 |
ifndef BASEFILEDIR
|
| 14 |
BASEFILEDIR:=$(shell mktemp -d /tmp/basefiles.XXXXXXXX)
|
| 15 |
endif
|
| 16 |
export BASEFILEDIR
|
| 17 |
MIRROR_DEBIAN=http://cdn.debian.net/debian/
|
| 18 |
MIRROR_UBUNTU=http://ftp.halifax.rwth-aachen.de/ubuntu/
|
| 19 |
#MIRROR_CENTOS=http://mirror.netcologne.de/centos/
|
| 20 |
# For the first stage, set the CentOS mirror in /etc/rinse/rinse.conf
|
| 21 |
# For the second stage, it is not so easy, due to #612164
|
| 22 |
EXCLUDE_SQUEEZE=isc-dhcp-client,isc-dhcp-common,info,tasksel,tasksel-data
|
| 23 |
EXCLUDE_LUCID=dhcp3-client,dhcp3-common
|
| 24 |
RINSEOPT_CENTOS=--distribution centos-5
|
| 25 |
XZ=xz -8
|
| 26 |
GZ=gzip -9
|
| 27 |
|
| 28 |
.PHONY: check cleanup-deb cleanup-rinse all32 all64 all
|
| 29 |
|
| 30 |
check::
|
| 31 |
@if [ `id -u` != 0 ]; then echo "You must be root to create chroots."; exit 1; fi
|
| 32 |
@mknod ${BASEFILEDIR}/test-dev-null c 1 3 || (echo "Cannot create device files on ${BASEFILEDIR}, aborting."; rm -rf ${BASEFILEDIR}; exit 1)
|
| 33 |
@echo test > ${BASEFILEDIR}/test-dev-null || (echo "Cannot use device files on ${BASEFILEDIR}, aborting."; rm -rf ${BASEFILEDIR}; exit 1)
|
| 34 |
@rm -f ${BASEFILEDIR}/test-dev-null
|
| 35 |
|
| 36 |
cleanup-deb::
|
| 37 |
chroot ${BASEFILEDIR} aptitude clean
|
| 38 |
rm ${BASEFILEDIR}/etc/hostname
|
| 39 |
rm ${BASEFILEDIR}/etc/resolv.conf
|
| 40 |
rm ${BASEFILEDIR}/etc/udev/rules.d/70-persistent-net.rules || true
|
| 41 |
rm ${BASEFILEDIR}/var/lib/apt/lists/*_*
|
| 42 |
|
| 43 |
cleanup-rinse::
|
| 44 |
rm ${BASEFILEDIR}/etc/resolv.conf
|
| 45 |
cp ${BASEFILEDIR}/etc/modprobe.d/modprobe.conf.dist ${BASEFILEDIR}/etc/modprobe.conf
|
| 46 |
|
| 47 |
CENTOS5_32.tar.xz: check
|
| 48 |
linux32 rinse --directory ${BASEFILEDIR} ${RINSEOPT_CENTOS} --arch i386
|
| 49 |
$(MAKE) cleanup-rinse
|
| 50 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 51 |
rm -rf ${BASEFILEDIR}
|
| 52 |
|
| 53 |
CENTOS5_32.tar.gz: check
|
| 54 |
linux32 rinse --directory ${BASEFILEDIR} ${RINSEOPT_CENTOS} --arch i386
|
| 55 |
$(MAKE) cleanup-rinse
|
| 56 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 57 |
rm -rf ${BASEFILEDIR}
|
| 58 |
|
| 59 |
CENTOS5_64.tar.xz: check
|
| 60 |
rinse --directory ${BASEFILEDIR} ${RINSEOPT_CENTOS} --arch amd64
|
| 61 |
$(MAKE) cleanup-rinse
|
| 62 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 63 |
rm -rf ${BASEFILEDIR}
|
| 64 |
|
| 65 |
CENTOS5_64.tar.gz: check
|
| 66 |
rinse --directory ${BASEFILEDIR} ${RINSEOPT_CENTOS} --arch amd64
|
| 67 |
$(MAKE) cleanup-rinse
|
| 68 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 69 |
rm -rf ${BASEFILEDIR}
|
| 70 |
|
| 71 |
LUCID32.tar.xz: check
|
| 72 |
debootstrap --arch i386 --exclude=${EXCLUDE_LUCID} lucid ${BASEFILEDIR} ${MIRROR_UBUNTU}
|
| 73 |
$(MAKE) cleanup-deb
|
| 74 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 75 |
rm -rf ${BASEFILEDIR}
|
| 76 |
|
| 77 |
LUCID32.tar.gz: check
|
| 78 |
debootstrap --arch i386 --exclude=${EXCLUDE_LUCID} lucid ${BASEFILEDIR} ${MIRROR_UBUNTU}
|
| 79 |
$(MAKE) cleanup-deb
|
| 80 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 81 |
rm -rf ${BASEFILEDIR}
|
| 82 |
|
| 83 |
LUCID64.tar.xz: check
|
| 84 |
debootstrap --arch amd64 --exclude=${EXCLUDE_LUCID} lucid ${BASEFILEDIR} ${MIRROR_UBUNTU}
|
| 85 |
$(MAKE) cleanup-deb
|
| 86 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 87 |
rm -rf ${BASEFILEDIR}
|
| 88 |
|
| 89 |
LUCID64.tar.gz: check
|
| 90 |
debootstrap --arch amd64 --exclude=${EXCLUDE_LUCID} lucid ${BASEFILEDIR} ${MIRROR_UBUNTU}
|
| 91 |
$(MAKE) cleanup-deb
|
| 92 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 93 |
rm -rf ${BASEFILEDIR}
|
| 94 |
|
| 95 |
SQUEEZE32.tar.xz: check
|
| 96 |
debootstrap --arch i386 --exclude=${EXCLUDE_SQUEEZE} squeeze ${BASEFILEDIR} ${MIRROR_DEBIAN}
|
| 97 |
$(MAKE) cleanup-deb
|
| 98 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 99 |
rm -rf ${BASEFILEDIR}
|
| 100 |
|
| 101 |
SQUEEZE32.tar.gz: check
|
| 102 |
debootstrap --arch i386 --exclude=${EXCLUDE_SQUEEZE} squeeze ${BASEFILEDIR} ${MIRROR_DEBIAN}
|
| 103 |
$(MAKE) cleanup-deb
|
| 104 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 105 |
rm -rf ${BASEFILEDIR}
|
| 106 |
|
| 107 |
SQUEEZE64.tar.xz: check
|
| 108 |
debootstrap --arch amd64 --exclude=${EXCLUDE_SQUEEZE} squeeze ${BASEFILEDIR} ${MIRROR_DEBIAN}
|
| 109 |
$(MAKE) cleanup-deb
|
| 110 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${XZ} > $@
|
| 111 |
rm -rf ${BASEFILEDIR}
|
| 112 |
|
| 113 |
SQUEEZE64.tar.gz: check
|
| 114 |
debootstrap --arch amd64 --exclude=${EXCLUDE_SQUEEZE} squeeze ${BASEFILEDIR} ${MIRROR_DEBIAN}
|
| 115 |
$(MAKE) cleanup-deb
|
| 116 |
tar --one-file-system -C ${BASEFILEDIR} -cf - . | ${GZ} > $@
|
| 117 |
rm -rf ${BASEFILEDIR}
|
| 118 |
|
| 119 |
all32: CENTOS5_32.tar.xz LUCID32.tar.xz SQUEEZE32.tar.xz
|
| 120 |
|
| 121 |
all64: CENTOS5_64.tar.xz LUCID64.tar.xz SQUEEZE64.tar.xz
|
| 122 |
|
| 123 |
all: all32 all64
|