virtual-appliance/Makefile

491 lines
17 KiB
Makefile
Raw Normal View History

APPLIANCE ?= base
VABUILDER_OUTPUT := $(CURDIR)
CHROOT := $(VABUILDER_OUTPUT)/build/$(APPLIANCE)
2018-10-27 08:26:16 +02:00
VA_PKGDIR = $(VABUILDER_OUTPUT)/packages
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
DISTDIR = $(CURDIR)/distfiles
2021-02-05 20:45:54 +01:00
REPO_DIR = $(CURDIR)/repos
REPO_NAMES =
KERNEL_DIR = $(CURDIR)/kernel
2021-02-05 20:45:54 +01:00
PORTAGE_DIR = $(REPO_DIR)/gentoo
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
HOSTNAME = $(APPLIANCE)
IMAGES = $(VABUILDER_OUTPUT)/images
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
RAW_IMAGE = $(IMAGES)/$(APPLIANCE).img
QCOW_IMAGE = $(IMAGES)/$(APPLIANCE).qcow
VMDK_IMAGE = $(IMAGES)/$(APPLIANCE).vmdk
VMDK_TYPE = IDE
OVA_IMAGE = $(IMAGES)/$(APPLIANCE).ova
OVA_NUM_CPUS = 1
OVA_MEM_SIZE = 1024
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
XVA_IMAGE = $(IMAGES)/$(APPLIANCE).xva
LST_FILE = $(IMAGES)/$(APPLIANCE)-packages.lst
2015-09-14 13:09:15 +02:00
CHECKSUMS = $(IMAGES)/SHA256SUMS
STAGE3 = $(CHROOT)/var/tmp/stage3
COMPILE_OPTIONS = $(CHROOT)/var/tmp/compile_options
SOFTWARE = $(CHROOT)/var/tmp/software
KERNEL_SRC = $(CHROOT)/var/tmp/kernel_src
KERNEL = $(CHROOT)/var/tmp/kernel
GRUB = $(CHROOT)/var/tmp/grub
PREPROOT = $(CHROOT)/var/tmp/preproot
SYSTOOLS = $(CHROOT)/var/tmp/systools
STAGE4_TARBALL = $(VABUILDER_OUTPUT)/images/$(APPLIANCE).tar.xz
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
VIRTIO = NO
TIMEZONE = UTC
DISK_SIZE = 6.0G
SWAP_SIZE = 30
SWAP_FILE = $(CHROOT)/.swap
2018-10-27 08:24:05 +02:00
VA_ARCH = amd64
KERNEL_CONFIG = configs/kernel.config.$(VA_ARCH)
KERNEL_PATH = $(CHROOT)/usr/src/kernel-path
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
MAKEOPTS = -j5 -l5.64
ENABLE_SSHD = NO
CHANGE_PASSWORD = YES
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
HEADLESS = NO
EXTERNAL_KERNEL = NO
PKGLIST = 0
DASH = NO
LOCALE ?= en_US.utf8
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
M4 = m4
EMERGE = emerge --jobs=$(shell nproc --all)
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
M4_DEFS = -D HOSTNAME=$(HOSTNAME)
M4C = $(M4) $(M4_DEFS)
USEPKG = --usepkg --binpkg-respect-use=y
RSYNC_MIRROR = rsync://rsync.gtlib.gatech.edu/gentoo/
KERNEL_PKG = gentoo-sources
WORLD = appliances/$(APPLIANCE)/world
WORLD_DEFAULT = appliances/default/world
EXTRA_WORLD =
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
# /etc/portage targets
base_etc_portage := $(wildcard configs/portage/*)
etc_portage := $(patsubst configs/portage/%,$(CHROOT)/etc/portage/%,$(base_etc_portage))
default_package_files := $(wildcard appliances/default/package.*)
appliance_package_files := $(wildcard appliances/$(APPLIANCE)/package.*)
portage_default_package_files = $(patsubst appliances/default/package.%,$(CHROOT)/etc/portage/package.%/01default,$(default_package_files))
portage_package_files = $(patsubst appliances/$(APPLIANCE)/package.%,$(CHROOT)/etc/portage/package.%/02$(APPLIANCE),$(appliance_package_files))
2021-02-08 19:12:27 +01:00
default_make_conf = $(wildcard appliances/default/make.conf)
appliance_make_conf = $(wildcard appliances/$(APPLIANCE)/make.conf)
portage_make_conf_local = $(CHROOT)/etc/portage/make.conf.local
appliance_profile := default/linux/amd64/23.0/systemd
# Allow appliance to override variables
-include appliances/default/default.cfg
-include appliances/$(APPLIANCE)/$(APPLIANCE).cfg
# Allow user to override variables
-include $(profile).cfg
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
ifneq ($(profile),)
container = $(profile)-$(APPLIANCE)-build
else
container = $(APPLIANCE)-build
endif
PATH := $(CURDIR)/scripts:$(PATH)
2021-02-05 20:45:54 +01:00
export PATH CHROOT container PORTAGE_DIR REPO_DIR REPO_NAMES VA_PKGDIR DISTDIR VA_ARCH
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
inroot := systemd-nspawn --quiet \
--directory=$(CHROOT) \
--machine=$(container) \
--capability=CAP_NET_ADMIN \
2021-02-05 13:27:21 +01:00
--bind=$(PORTAGE_DIR):/var/db/repos/gentoo \
2021-02-05 20:45:54 +01:00
$(foreach repo,$(REPO_NAMES),--bind=$(REPO_DIR)/$(repo):/var/db/repos/$(repo) ) \
2021-02-05 13:27:21 +01:00
--bind=$(VA_PKGDIR):/var/cache/binpkgs \
--bind=$(DISTDIR):/var/cache/distfiles
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
2018-10-27 08:24:05 +02:00
ifeq ($(VA_ARCH),x86)
inroot := linux32 $(inroot)
endif
stage4-exists := $(wildcard $(STAGE4_TARBALL))
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
COPY_ARGS = --exclude-from=configs/rsync-excludes
ifeq ($(CHANGE_PASSWORD),YES)
ifdef ROOT_PASSWORD
change_password = RUN usermod --password '$(ROOT_PASSWORD)' root
else
change_password = RUN passwd --delete root
endif
endif
gcc_config = $(inroot) gcc-config 1
ifneq ($(shell grep 'CONFIG_MODULES=y' $(KERNEL_CONFIG)), )
KERNEL_MODULES_PREPARE = modules_prepare
endif
export APPLIANCE ACCEPT_KEYWORDS CHROOT EMERGE HEADLESS M4 M4C inroot gcc_config
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
export HOSTNAME MAKEOPTS TIMEZONE USEPKG WORLD
export USEPKG RSYNC_MIRROR
export EXTERNAL_KERNEL KERNEL_PKG KERNEL_PATH KERNEL_CONFIG
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
all: stage4
2010-07-09 05:22:37 +02:00
image: $(RAW_IMAGE)
2010-07-09 05:22:37 +02:00
sync_portage: $(PORTAGE_DIR)
@print Grabbing latest portage
git -C $(PORTAGE_DIR) pull
touch $(PORTAGE_DIR)
2013-08-25 11:24:46 +02:00
$(PORTAGE_DIR):
@print Grabbing the portage tree
2023-05-30 19:45:23 +02:00
git clone --depth=1 https://github.com/gentoo/gentoo.git $(PORTAGE_DIR)
$(CHROOT)/etc/portage/%: configs/portage/%
COPY --recursive $< /etc/portage/
fstab:
@print Create new /etc/fstab
env echo -e "# <fs>\t\t<mountpoint>\t<type>\t<opts>\t<dump/pass>" > $(CHROOT)/etc/fstab
env echo -e "LABEL=ROOT\t/\t\text4\tnoatime\t1 1" >> $(CHROOT)/etc/fstab
env echo -e "/.swap\t\tnone\t\tswap\tsw\t0 0" >> $(CHROOT)/etc/fstab
env echo -e "#LABEL=SWAP\tnone\t\tswap\tsw\t0 0" >> $(CHROOT)/etc/fstab
$(PREPROOT): $(STAGE3) $(PORTAGE_DIR) $(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo)) fstab $(etc_portage) $(portage_default_package_files) $(portage_package_files)
mkdir -p $(VA_PKGDIR) $(DISTDIR)
2018-10-27 20:49:42 +02:00
@print Creating swap file: `basename $(SWAP_FILE)`
dd if=/dev/zero of=$(SWAP_FILE) bs=1M count=$(SWAP_SIZE)
/sbin/mkswap $(SWAP_FILE)
rm -f $(CHROOT)/etc/resolv.conf
COPY -L /etc/resolv.conf /etc/resolv.conf
touch $(PREPROOT)
2021-02-05 12:27:13 +01:00
stage3-$(VA_ARCH).tar.xz:
@print You do not have a stage3 tarball. Consider \"make sync_stage3\"
2013-08-26 23:21:17 +02:00
@exit 1
sync_stage3:
2021-02-05 12:27:13 +01:00
fetch-stage3 --systemd --outfile=stage3-$(VA_ARCH).tar.xz $(VA_ARCH)
2013-08-26 23:21:17 +02:00
2021-02-05 12:27:13 +01:00
$(STAGE3): stage3-$(VA_ARCH).tar.xz configs/stage3-tarball-excludes
2010-11-06 09:41:15 +01:00
mkdir -p $(CHROOT)
ifdef stage4-exists
@print Using stage4 tarball: `basename $(STAGE4_TARBALL)`
tar xpf "$(STAGE4_TARBALL)" -C $(CHROOT)
else
@print Using stage3 tarball
2021-02-05 12:27:13 +01:00
tar xpf stage3-$(VA_ARCH).tar.xz -C $(CHROOT) --exclude-from=configs/stage3-tarball-excludes
endif
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
rm -f $(CHROOT)/etc/localtime
touch $(STAGE3)
2021-02-05 20:45:54 +01:00
sync_repos: $(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo))
@print Updating the repositories
$(foreach repo,$(REPO_NAMES),git -C $(REPO_DIR)/$(repo) pull;touch $(REPO_DIR)/$(repo);)
$(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo)):
@print Grabbing a repository
git clone --depth=1 $(REPO_URI_$(subst $(REPO_DIR)/,,$@)) $@
$(CHROOT)/etc/portage/repos.conf: $(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo))
$(foreach repo,$(REPO_NAMES),\
echo "[$(repo)]" >>$@;\
echo "location = /var/db/repos/$(repo)" >>$@;\
echo "auto-sync = no" >>$@;\
echo "" >>$@;\
)
touch $@
$(CHROOT)/etc/portage/package.%/01default: appliances/default/package.% $(STAGE3)
mkdir -p `dirname $@`
cp $< $@
2021-02-05 20:45:54 +01:00
$(CHROOT)/etc/portage/package.%/02$(APPLIANCE): appliances/$(APPLIANCE)/package.% $(STAGE3)
mkdir -p `dirname $@`
cp $< $@
2021-02-08 19:12:27 +01:00
$(portage_make_conf_local): $(default_make_conf) $(appliance_make_conf)
if [ -f "$(default_make_conf)" ] ; \
2021-02-08 09:46:23 +01:00
then COPY $(default_make_conf) /etc/portage/make.conf.local; \
fi
2021-02-08 19:12:27 +01:00
if [ -f "$(appliance_make_conf)" ] ; \
then cat $(appliance_make_conf) >> $(portage_make_conf_local); \
2021-02-08 09:46:23 +01:00
fi
touch $@
$(CHROOT)/var/tmp/profile: $(STAGE3)
RUN eselect profile set $(appliance_profile)
touch $@
$(KERNEL_PATH): $(STAGE3) $(KERNEL_CONFIG)
ifneq ($(EXTERNAL_KERNEL),YES)
$(eval kernel_ebuild = $(shell basename `RUN portageq best_visible / $(KERNEL_PKG)`))
$(eval kernel_name = $(shell echo $(kernel_ebuild) | sed -e 's/\(..*\)-sources-\(..*\)/linux-\2-\1/' -e 's/\(..*\)-\(r[0-9]*\)-\(..*\)/\1-\3-\2/'))
$(eval kernel_config_checksum = $(shell sha1sum $(KERNEL_CONFIG) | cut -c -40))
echo -n "$(KERNEL_DIR)/$(kernel_name)/$(kernel_config_checksum)" > $@
else
echo "NONE" > $@
endif
$(KERNEL_SRC): $(KERNEL_PATH)
ifneq ($(EXTERNAL_KERNEL),YES)
if [ ! -f $(shell cat $(KERNEL_PATH))/Makefile ] ; then \
RUN $(EMERGE) --oneshot --noreplace $(USEPKG) sys-kernel/$(KERNEL_PKG); \
cp -a $(CHROOT)/usr/src/linux-*/* $(shell cat $(KERNEL_PATH)); \
RUN $(EMERGE) -C sys-kernel/$(KERNEL_PKG); \
cp $(KERNEL_CONFIG) $(shell cat $(KERNEL_PATH))/.config; \
RUN make -C /usr/src/linux MAKEOPTS=$(MAKEOPTS) oldconfig $(KERNEL_MODULES_PREPARE); \
fi
endif
touch $(KERNEL_SRC)
$(COMPILE_OPTIONS): $(STAGE3) $(PORTAGE_DIR) configs/make.conf.$(VA_ARCH) configs/locale.gen $(portage_default_package_files) $(portage_package_files) $(portage_make_conf_local) $(CHROOT)/var/tmp/profile $(CHROOT)/etc/portage/repos.conf $(KERNEL_SRC)
COPY configs/make.conf.$(VA_ARCH) /etc/portage/make.conf
COPY configs/locale.gen /etc/locale.gen
RUN locale-gen
touch $(COMPILE_OPTIONS)
$(KERNEL): $(COMPILE_OPTIONS) $(KERNEL_CONFIG) scripts/build-kernel
ifneq ($(EXTERNAL_KERNEL),YES)
@print Configuring kernel
COPY $(KERNEL_CONFIG) /root/kernel.config
COPY scripts/build-kernel /root/build-kernel
RUN --setenv=KERNEL=$(KERNEL_PKG) \
--setenv=EMERGE="$(EMERGE)" \
--setenv=USEPKG="$(USEPKG)" \
--setenv=MAKEOPTS="$(MAKEOPTS)" \
/root/build-kernel
rm -f $(CHROOT)/root/build-kernel
endif
touch $(KERNEL)
2010-07-09 05:22:37 +02:00
$(SYSTOOLS): $(PREPROOT) $(COMPILE_OPTIONS)
@print Installing standard system tools
systemd-firstboot \
--root=$(CHROOT) \
--setup-machine-id \
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
--timezone=$(TIMEZONE) \
--hostname=$(HOSTNAME) \
--root-password=
RUN eselect locale set $(LOCALE)
ifeq ($(DASH),YES)
2012-12-16 16:49:21 +01:00
if ! test -e "$(STAGE4_TARBALL)"; \
then RUN $(EMERGE) --noreplace $(USEPKG) app-shells/dash; \
Baselayout-2/openrc compatibility and stage4 tarballs. The first major change here is the support of baselayout-2/openrc. So far Gentoo has not released a stage3 tarball with baselayout-2, but I've tested this enough that I feel it works even when doing an upgrade. The baselayout-1 stuff has been converted, however it is recommended to not use this until baselayout-2 is available in Gentoo stage3s as I don't want to support converting, or you can do this: stage4 tarball support. I'm not sure why I didn't support this before. Now not only can stage4 tarballs be build, instead of or in addition to virtual appliance images, but stage4 tarballs can also be used in lieu of a stage3. There is a new "stage4" make target, and also when building the Makefile will first look for stage4/<appliance>-stage4.tar.bz2 and if that exists use it instead of the Gentoo stage3. If you specify stage4 as a target and also already have a stage4, then the Makefile will unpack the stage4 into the chroot, perform updates, and then re-create the stage4 based on the updates (atomically). In addition there is a new Makefile variable, SOFTWARE. The default value is "1" meaning it will call the software target (thereby installing/updatein software), but if you set SOFTWARE=0, then the software phase will not be run. This can allow, for example, to build a VM image from a stage4 without performing software updates, in effect a straight stage4 to image for quick image building. Since most appliances are pretty much based on the "base" appliance, one could imply copy the base stage4 to the new appliance stage4 and start from there, instead of having to start from a vanilla stage3, for example: # cp stage4/base-stage4.tar.bz2 stage4/kde-stage4.tar.bz2 # make APPLIANCE=kde stage4 Will take the already existing base stage4 and simply update it to kde, which will be easier/faster than starting from a stage3. There are still some tweaks that need to be done for the stage4 support. Specifically Makefile targets need to be written with the assumption that they may be called more than once (e.g. updating a stage4 or going from stage4 to image with SOFTWARE=1). For the most part things work according to that assumption, but there are a few things that need to be tweeked, such as the inittab settings if one is building a "headed" image but it's based off a headless stage4. New appliance authors should also write their "preinstall" and "postinstall" targets with the assmption that it may be called more than once.
2011-05-18 02:44:04 +02:00
echo /bin/dash >> $(CHROOT)/etc/shells; \
RUN chsh -s /bin/sh root; \
Baselayout-2/openrc compatibility and stage4 tarballs. The first major change here is the support of baselayout-2/openrc. So far Gentoo has not released a stage3 tarball with baselayout-2, but I've tested this enough that I feel it works even when doing an upgrade. The baselayout-1 stuff has been converted, however it is recommended to not use this until baselayout-2 is available in Gentoo stage3s as I don't want to support converting, or you can do this: stage4 tarball support. I'm not sure why I didn't support this before. Now not only can stage4 tarballs be build, instead of or in addition to virtual appliance images, but stage4 tarballs can also be used in lieu of a stage3. There is a new "stage4" make target, and also when building the Makefile will first look for stage4/<appliance>-stage4.tar.bz2 and if that exists use it instead of the Gentoo stage3. If you specify stage4 as a target and also already have a stage4, then the Makefile will unpack the stage4 into the chroot, perform updates, and then re-create the stage4 based on the updates (atomically). In addition there is a new Makefile variable, SOFTWARE. The default value is "1" meaning it will call the software target (thereby installing/updatein software), but if you set SOFTWARE=0, then the software phase will not be run. This can allow, for example, to build a VM image from a stage4 without performing software updates, in effect a straight stage4 to image for quick image building. Since most appliances are pretty much based on the "base" appliance, one could imply copy the base stage4 to the new appliance stage4 and start from there, instead of having to start from a vanilla stage3, for example: # cp stage4/base-stage4.tar.bz2 stage4/kde-stage4.tar.bz2 # make APPLIANCE=kde stage4 Will take the already existing base stage4 and simply update it to kde, which will be easier/faster than starting from a stage3. There are still some tweaks that need to be done for the stage4 support. Specifically Makefile targets need to be written with the assumption that they may be called more than once (e.g. updating a stage4 or going from stage4 to image with SOFTWARE=1). For the most part things work according to that assumption, but there are a few things that need to be tweeked, such as the inittab settings if one is building a "headed" image but it's based off a headless stage4. New appliance authors should also write their "preinstall" and "postinstall" targets with the assmption that it may be called more than once.
2011-05-18 02:44:04 +02:00
fi
RUN ln -sf dash /bin/sh
endif
touch $(SYSTOOLS)
$(GRUB): $(PREPROOT) configs/grub.cfg $(KERNEL) scripts/grub-headless.sed
ifneq ($(EXTERNAL_KERNEL),YES)
@print Installing Grub
RUN $(EMERGE) -nN $(USEPKG) sys-boot/grub
mkdir -p $(CHROOT)/boot/grub
COPY configs/grub.cfg /boot/grub/grub.cfg
ifeq ($(VIRTIO),YES)
sed -i 's/sda/vda/' $(CHROOT)/boot/grub/grub.cfg
endif
ifeq ($(HEADLESS),YES)
sed -i -f scripts/grub-headless.sed $(CHROOT)/boot/grub/grub.cfg
endif
endif
ln -nsf /run/systemd/resolve/resolv.conf $(CHROOT)/etc/resolv.conf
touch $(GRUB)
2010-07-09 05:22:37 +02:00
software: $(SOFTWARE)
$(SOFTWARE): $(SYSTOOLS) configs/eth.network configs/issue $(COMPILE_OPTIONS) $(WORLD)
@print Building $(APPLIANCE)-specific software
if test -f appliances/default/Makefile; \
then $(MAKE) -C appliances/default preinstall; \
fi
$(MAKE) -C appliances/$(APPLIANCE) preinstall
if test -f $(WORLD_DEFAULT); \
then cat $(WORLD_DEFAULT) >> $(CHROOT)/var/lib/portage/world; \
fi
cat $(WORLD) >> $(CHROOT)/var/lib/portage/world
RUN $(EMERGE) $(USEPKG) --update --newuse --deep @system
@print Running @preserved-rebuild
RUN $(EMERGE) --usepkg=n @preserved-rebuild
COPY configs/issue /etc/issue
RUN $(EMERGE) $(USEPKG) --update --newuse --deep @world $(grub_package)
RUN $(EMERGE) --depclean --with-bdeps=n
RUN --setenv EDITOR=/usr/bin/nano etc-update
COPY configs/eth.network /etc/systemd/network/eth.network
RUN systemctl enable systemd-networkd.service
RUN systemctl enable systemd-resolved.service
ifeq ($(ENABLE_SSHD),YES)
RUN systemctl enable sshd.service
endif
ifeq ($(DASH),YES)
RUN $(EMERGE) --depclean app-shells/bash
endif
if test -f appliances/default/Makefile; \
then $(MAKE) -C appliances/default postinstall; \
fi
$(MAKE) -C appliances/$(APPLIANCE) postinstall
ifneq ($(PKGLIST),0)
echo \# > $(LST_FILE)
echo \# Gentoo Virtual Appliance \"$(APPLIANCE)\" package list >> $(LST_FILE)
echo \# Generated `date -u` >> $(LST_FILE)
echo \# >> $(LST_FILE)
(cd "$(CHROOT)"/var/db/pkg ; /bin/ls -1d */* | grep -v '^virtual/') >> $(LST_FILE)
endif
touch $(SOFTWARE)
2010-07-09 05:22:37 +02:00
$(RAW_IMAGE): $(STAGE4_TARBALL) scripts/grub.shell scripts/motd.sh
@print Installing files to `basename $(RAW_IMAGE)`
qemu-img create -f raw $(RAW_IMAGE).tmp $(DISK_SIZE)
parted -s $(RAW_IMAGE).tmp mklabel msdos
parted -s $(RAW_IMAGE).tmp mkpart primary 1 $(DISK_SIZE)
parted -s $(RAW_IMAGE).tmp set 1 boot on
sync
losetup --show --find --partscan $(RAW_IMAGE).tmp > partitions
mkfs.ext4 -O sparse_super,^has_journal -L ROOT -m 0 `cat partitions`p1
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
mkdir $(CHROOT)
mount -o noatime `cat partitions`p1 $(CHROOT)
tar -xf $(STAGE4_TARBALL) --numeric-owner $(COPY_ARGS) -C $(CHROOT)
motd.sh $(EXTERNAL_KERNEL) $(VIRTIO) $(DISK_SIZE) $(SWAP_SIZE) $(DASH) $(VA_ARCH) > $(CHROOT)/etc/motd
ifneq ($(EXTERNAL_KERNEL),YES)
echo '(hd0) ' `cat partitions` > $(CHROOT)/device-map
cp partitions $(CHROOT)/partitions
RUN /usr/sbin/grub-install --no-floppy --grub-mkdevicemap=device-map --directory=/usr/lib/grub/i386-pc --boot-directory=/boot `cat partitions`
rm $(CHROOT)/device-map $(CHROOT)/partitions
endif
umount $(CHROOT)
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
rmdir $(CHROOT)
sync
losetup --detach `cat partitions`
rm -f partitions device-map
mv $(RAW_IMAGE).tmp $(RAW_IMAGE)
2010-07-09 05:22:37 +02:00
$(QCOW_IMAGE): $(RAW_IMAGE)
@print Creating `basename $(QCOW_IMAGE)`
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
qemu-img convert -f raw -O qcow2 -c $(RAW_IMAGE) $(QCOW_IMAGE).tmp
mv $(QCOW_IMAGE).tmp $(QCOW_IMAGE)
2010-07-09 05:22:37 +02:00
qcow: $(QCOW_IMAGE)
$(XVA_IMAGE): $(RAW_IMAGE)
@print Creating `basename $(XVA_IMAGE)`
xva.py --disk=$(RAW_IMAGE) --is-hvm --memory=256 --vcpus=1 --name=$(APPLIANCE) \
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
--filename=$(XVA_IMAGE).tmp
mv $(XVA_IMAGE).tmp $(XVA_IMAGE)
xva: $(XVA_IMAGE)
2010-07-09 05:22:37 +02:00
$(VMDK_IMAGE): $(RAW_IMAGE)
@print Creating `basename $(VMDK_IMAGE)`
ifeq ($(VMDK_TYPE),SCSI)
qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,hwversion=7 $(RAW_IMAGE) $(VMDK_IMAGE).tmp
else
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
qemu-img convert -f raw -O vmdk $(RAW_IMAGE) $(VMDK_IMAGE).tmp
endif
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
mv $(VMDK_IMAGE).tmp $(VMDK_IMAGE)
2010-07-09 05:22:37 +02:00
vmdk: $(VMDK_IMAGE)
NUM_CPUS := $(OVA_NUM_CPUS)
MEM_SIZE := $(OVA_MEM_SIZE)
export NUM_CPUS MEM_SIZE
$(OVA_IMAGE): $(VMDK_IMAGE)
@print Creating `basename $(OVA_IMAGE)`
cd $(IMAGES) && mkova.sh $(APPLIANCE) /usr/share/open-vmdk/template-hw7.ovf $(VMDK_IMAGE)
ova: $(OVA_IMAGE)
2021-02-05 12:27:13 +01:00
$(STAGE4_TARBALL): $(PORTAGE_DIR) stage3-$(VA_ARCH).tar.xz appliances/$(APPLIANCE) configs/rsync-excludes
$(MAKE) $(STAGE3)
$(MAKE) $(PREPROOT)
$(MAKE) $(SOFTWARE)
$(MAKE) $(KERNEL)
$(MAKE) $(GRUB)
@print Creating stage4 tarball: `basename $(STAGE4_TARBALL)`
$(change_password)
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
mkdir -p $(IMAGES)
tar -acf "$(STAGE4_TARBALL).tmp.xz" --numeric-owner $(COPY_ARGS) -C $(CHROOT) --one-file-system .
mv "$(STAGE4_TARBALL).tmp.xz" "$(STAGE4_TARBALL)"
$(MAKE) clean
Baselayout-2/openrc compatibility and stage4 tarballs. The first major change here is the support of baselayout-2/openrc. So far Gentoo has not released a stage3 tarball with baselayout-2, but I've tested this enough that I feel it works even when doing an upgrade. The baselayout-1 stuff has been converted, however it is recommended to not use this until baselayout-2 is available in Gentoo stage3s as I don't want to support converting, or you can do this: stage4 tarball support. I'm not sure why I didn't support this before. Now not only can stage4 tarballs be build, instead of or in addition to virtual appliance images, but stage4 tarballs can also be used in lieu of a stage3. There is a new "stage4" make target, and also when building the Makefile will first look for stage4/<appliance>-stage4.tar.bz2 and if that exists use it instead of the Gentoo stage3. If you specify stage4 as a target and also already have a stage4, then the Makefile will unpack the stage4 into the chroot, perform updates, and then re-create the stage4 based on the updates (atomically). In addition there is a new Makefile variable, SOFTWARE. The default value is "1" meaning it will call the software target (thereby installing/updatein software), but if you set SOFTWARE=0, then the software phase will not be run. This can allow, for example, to build a VM image from a stage4 without performing software updates, in effect a straight stage4 to image for quick image building. Since most appliances are pretty much based on the "base" appliance, one could imply copy the base stage4 to the new appliance stage4 and start from there, instead of having to start from a vanilla stage3, for example: # cp stage4/base-stage4.tar.bz2 stage4/kde-stage4.tar.bz2 # make APPLIANCE=kde stage4 Will take the already existing base stage4 and simply update it to kde, which will be easier/faster than starting from a stage3. There are still some tweaks that need to be done for the stage4 support. Specifically Makefile targets need to be written with the assumption that they may be called more than once (e.g. updating a stage4 or going from stage4 to image with SOFTWARE=1). For the most part things work according to that assumption, but there are a few things that need to be tweeked, such as the inittab settings if one is building a "headed" image but it's based off a headless stage4. New appliance authors should also write their "preinstall" and "postinstall" targets with the assmption that it may be called more than once.
2011-05-18 02:44:04 +02:00
stage4: $(STAGE4_TARBALL)
Baselayout-2/openrc compatibility and stage4 tarballs. The first major change here is the support of baselayout-2/openrc. So far Gentoo has not released a stage3 tarball with baselayout-2, but I've tested this enough that I feel it works even when doing an upgrade. The baselayout-1 stuff has been converted, however it is recommended to not use this until baselayout-2 is available in Gentoo stage3s as I don't want to support converting, or you can do this: stage4 tarball support. I'm not sure why I didn't support this before. Now not only can stage4 tarballs be build, instead of or in addition to virtual appliance images, but stage4 tarballs can also be used in lieu of a stage3. There is a new "stage4" make target, and also when building the Makefile will first look for stage4/<appliance>-stage4.tar.bz2 and if that exists use it instead of the Gentoo stage3. If you specify stage4 as a target and also already have a stage4, then the Makefile will unpack the stage4 into the chroot, perform updates, and then re-create the stage4 based on the updates (atomically). In addition there is a new Makefile variable, SOFTWARE. The default value is "1" meaning it will call the software target (thereby installing/updatein software), but if you set SOFTWARE=0, then the software phase will not be run. This can allow, for example, to build a VM image from a stage4 without performing software updates, in effect a straight stage4 to image for quick image building. Since most appliances are pretty much based on the "base" appliance, one could imply copy the base stage4 to the new appliance stage4 and start from there, instead of having to start from a vanilla stage3, for example: # cp stage4/base-stage4.tar.bz2 stage4/kde-stage4.tar.bz2 # make APPLIANCE=kde stage4 Will take the already existing base stage4 and simply update it to kde, which will be easier/faster than starting from a stage3. There are still some tweaks that need to be done for the stage4 support. Specifically Makefile targets need to be written with the assumption that they may be called more than once (e.g. updating a stage4 or going from stage4 to image with SOFTWARE=1). For the most part things work according to that assumption, but there are a few things that need to be tweeked, such as the inittab settings if one is building a "headed" image but it's based off a headless stage4. New appliance authors should also write their "preinstall" and "postinstall" targets with the assmption that it may be called more than once.
2011-05-18 02:44:04 +02:00
eclean: $(COMPILE_OPTIONS)
RUN $(EMERGE) $(USEPKG) --oneshot --noreplace app-portage/gentoolkit
RUN eclean-pkg
RUN eclean-dist
RUN $(EMERGE) --depclean app-portage/gentoolkit
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
$(MAKE) clean
2010-07-09 05:22:37 +02:00
2010-11-06 09:41:15 +01:00
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
clean:
rm -f partitions device-map $(IMAGES)/*.tmp
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
rm -rf --one-file-system -- $(CHROOT)
2010-07-09 05:22:37 +02:00
realclean: clean
I learned a lot about Makefiles :D So, basically I re-architeched things a bit: The appliance/Makefile.inc fiels are now appliance/Makefile (again). The main Makefile will call "make -C appliance preinstall" and "postinstall" (and in future "clean"). So I got rid of the ugly make variables/include thing. Some of the main Makefile's variables are exported to the sub-makes. Appliances don't really need $(APPLIANCE) anymore as the appliance directory is their CWD. Added some new targets and smarter targets. I can do more with this, but it's a big improvment from last time. Still learning a lot of Makefile magic (been reading other people's Makefiles). Verified that "make -j3" works (at least on the base appliance) but will kill your hard drive :D Introduced "profiles" Which are files with variables you want to override. The file will be "include"ed by the main Makefile. For example, I have a file, "local.cfg" that looks like this: --- 8< ----------------------------- CHROOT = /var/scratch/marduk/vabuild HEADLESS = YES PRUNE_CRITICAL = NO VIRTIO = YES TIMEZONE = EST5EDT DISK_SIZE = 60.0G SWAP_SIZE = 48 PKGDIR = /var/scratch/packages NBD_DEV = /dev/nbd8 all: qcow --- 8< ------------------------------ Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't specify a PROFILE variable, then it will default to the empty string, which means the main Makefile will attempt to include .cfg So, for example i have: $ ln -s local.cfg .cfg $ make APPLIANCE=kde Don't set PROFILE inside your .cfg file (why would you?). Also, if the [pro]file does not exist, the include fails silently. I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
${RM} $(RAW_IMAGE) $(QCOW_IMAGE) $(VMDK_IMAGE)
2010-11-06 23:46:07 +01:00
distclean:
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
rm -f -- *.qcow *.img *.vmdk
2021-02-05 12:27:13 +01:00
rm -f stage3-*.tar.xz
2013-08-25 11:24:46 +02:00
rm -f portage-snapshot.tar.bz2
2010-11-06 23:46:07 +01:00
appliance-list:
@print 'Available appliances:'
@/bin/ls -1 appliances
checksums:
@print Calculating checksums
2015-09-14 13:09:15 +02:00
$(RM) $(CHECKSUMS)
cd $(IMAGES) && sha256sum --binary * > $(CHECKSUMS).tmp
mv $(CHECKSUMS).tmp $(CHECKSUMS)
shell: $(PREPROOT)
@print 'Entering interactive shell for the $(APPLIANCE) build.'
@print 'Type "exit" or "^D" to leave'
@print
@RUN
@rm -f $(CHROOT)/root/.bash_history
2013-09-17 01:26:48 +02:00
help:
@print 'Help targets (this is not a comprehensive list)'
2013-09-17 01:26:48 +02:00
@echo
@echo 'sync_portage - Download the latest portage snapshot'
@echo 'sync_stage3 - Download the latest stage3 tarball'
@echo 'sync_repos - Download/update the repositories (portage overlays)'
2013-09-17 01:26:48 +02:00
@echo 'stage4 - Build a stage4 tarball'
@echo 'clean - Unmount chroot and clean directory'
2015-03-15 13:56:38 +01:00
@echo 'eclean - Clean outdated packages and distfiles'
2013-09-17 01:26:48 +02:00
@echo 'realclean - Clean and remove image files'
@echo 'shell - Enter a shell in the build environment'
@print 'Images'
2013-09-17 01:26:48 +02:00
@echo 'image - Build a raw VM image from stage4'
@echo 'qcow - Build a qcow VM image from a raw image'
@echo 'vmdk - Build a vmdk image from a raw image'
@echo 'ova - Build a ova image from a vmdk image'
2013-09-17 01:26:48 +02:00
@echo 'xva - Build an xva image from a raw image'
@echo 'appliance-list - List built-in appliances'
@echo 'help - Show this help'
@echo 'Variables'
2013-09-17 01:26:48 +02:00
@echo 'APPLIANCE= - The appliance to build'
@echo 'HOSTNAME= - Hostname to give appliance'
@echo 'TIMEZONE= - Timezone to set for the appliance'
@echo 'CHROOT= - The directory to build the chroot'
@echo 'DISK_SIZE= - Size of the disk image'
@echo 'SWAP_SIZE= - Size of the swap file'
2018-10-27 08:24:05 +02:00
@echo 'VA_ARCH= - Architecture to build for (x86 or amd64)'
2013-09-17 01:26:48 +02:00
@echo 'VIRTIO=YES - Configure the stage2/image to use virtio'
@echo 'EXTERNAL_KERNEL=YES - Do not build a kernel in the image'
@echo 'HEADLESS=YES - Build a headless (serial console) image.'
@echo 'ENABLE_SSHD=YES - Enable sshd to start automatically in the image'
@echo 'VMDK_TYPE=IDE - VMDK image type (IDE or SCSI)'
2013-09-17 01:26:48 +02:00
@echo
@print 'Example to build the base appliance'
@echo 'make APPLIANCE=base HEADLESS=YES VIRTIO=YES stage4 qcow clean'
2013-09-17 01:26:48 +02:00
.PHONY: qcow vmdk ova clean realclean distclean stage4 image stage4 help appliance-list eclean sync_portage sync_stage3 checksums fstab