Numerous updates:

* Exclude some files from the stage3 tarball to be installed in the chroot.
  This reduces the number of etc-updates that need to be process.

* Manually eselect profile.  This is needed now because /etc/portage/make.profile
  is excluded above.

* Use m4 and a template (in file) to create /etc/fstab instead of using sed.

* Add a "software" target.  This is mainly used for development.
This commit is contained in:
Albert Hopkins 2018-12-08 16:12:33 -08:00
parent 9d3ca3fa55
commit b798561898
2 changed files with 25 additions and 15 deletions

View File

@ -53,6 +53,7 @@ appliance_package_files := $(wildcard appliances/$(APPLIANCE)/package.*)
portage_package_files = $(patsubst appliances/$(APPLIANCE)/package.%,$(CHROOT)/etc/portage/package.%/01$(APPLIANCE),$(appliance_package_files)) portage_package_files = $(patsubst appliances/$(APPLIANCE)/package.%,$(CHROOT)/etc/portage/package.%/01$(APPLIANCE),$(appliance_package_files))
appliance_make_conf = $(wildcard appliances/$(APPLIANCE)/make.conf) appliance_make_conf = $(wildcard appliances/$(APPLIANCE)/make.conf)
portage_make_conf_local = $(CHROOT)/etc/portage/make.conf.local portage_make_conf_local = $(CHROOT)/etc/portage/make.conf.local
appliance_profile := default/linux/amd64/17.0/systemd
# Allow appliance to override variables # Allow appliance to override variables
-include appliances/$(APPLIANCE)/$(APPLIANCE).cfg -include appliances/$(APPLIANCE)/$(APPLIANCE).cfg
@ -115,19 +116,18 @@ $(PORTAGE_DIR):
$(CHROOT)/etc/portage/%: configs/portage/% $(CHROOT)/etc/portage/%: configs/portage/%
COPY --recursive $< /etc/portage/ COPY --recursive $< /etc/portage/
$(PREPROOT): $(STAGE3) $(PORTAGE_DIR) configs/fstab $(etc_portage) $(portage_package_files) $(CHROOT)/etc/fstab: configs/fstab.in
mkdir -p $(VA_PKGDIR) $(DISTDIR)
COPY configs/fstab /etc/fstab
ifeq ($(VIRTIO),YES) ifeq ($(VIRTIO),YES)
sed -i 's/sda/vda/' $(CHROOT)/etc/fstab $(M4) -DDRIVE=sda $< > $@
else
$(M4) -DDRIVE=vda $< > $@
endif endif
ifneq ($(SWAP_SIZE),0)
$(PREPROOT): $(STAGE3) $(PORTAGE_DIR) $(CHROOT)/etc/fstab $(etc_portage) $(portage_package_files)
mkdir -p $(VA_PKGDIR) $(DISTDIR)
@print Creating swap file: `basename $(SWAP_FILE)` @print Creating swap file: `basename $(SWAP_FILE)`
dd if=/dev/zero of=$(SWAP_FILE) bs=1M count=$(SWAP_SIZE) dd if=/dev/zero of=$(SWAP_FILE) bs=1M count=$(SWAP_SIZE)
/sbin/mkswap $(SWAP_FILE) /sbin/mkswap $(SWAP_FILE)
else
sed -i '/swap/d' $(CHROOT)/etc/fstab
endif
rm -f $(CHROOT)/etc/resolv.conf rm -f $(CHROOT)/etc/resolv.conf
COPY -L /etc/resolv.conf /etc/resolv.conf COPY -L /etc/resolv.conf /etc/resolv.conf
touch $(PREPROOT) touch $(PREPROOT)
@ -140,14 +140,14 @@ sync_stage3:
fetch-stage3 --specialty=systemd --outfile=stage3-$(VA_ARCH).tar.bz2 $(VA_ARCH) fetch-stage3 --specialty=systemd --outfile=stage3-$(VA_ARCH).tar.bz2 $(VA_ARCH)
$(STAGE3): stage3-$(VA_ARCH).tar.bz2 $(STAGE3): stage3-$(VA_ARCH).tar.bz2 configs/stage3-tarball-excludes
mkdir -p $(CHROOT) mkdir -p $(CHROOT)
ifdef stage4-exists ifdef stage4-exists
@print Using stage4 tarball: `basename $(STAGE4_TARBALL)` @print Using stage4 tarball: `basename $(STAGE4_TARBALL)`
tar xpf "$(STAGE4_TARBALL)" -C $(CHROOT) tar xpf "$(STAGE4_TARBALL)" -C $(CHROOT)
else else
@print Using stage3 tarball @print Using stage3 tarball
tar xpf stage3-$(VA_ARCH).tar.bz2 -C $(CHROOT) tar xpf stage3-$(VA_ARCH).tar.bz2 -C $(CHROOT) --exclude-from=configs/stage3-tarball-excludes
endif endif
rm -f $(CHROOT)/etc/localtime rm -f $(CHROOT)/etc/localtime
touch $(STAGE3) touch $(STAGE3)
@ -156,12 +156,21 @@ $(CHROOT)/etc/portage/package.%/01$(APPLIANCE): appliances/$(APPLIANCE)/package.
mkdir -p `dirname $@` mkdir -p `dirname $@`
cp $< $@ cp $< $@
$(CHROOT)/etc/portage/make.conf: configs/make.conf.$(VA_ARCH)
COPY configs/make.conf.$(VA_ARCH) /etc/portage/make.conf
$(portage_make_conf_local): $(appliance_make_conf) $(portage_make_conf_local): $(appliance_make_conf)
COPY $< /etc/portage/make.conf.local || touch $@ COPY $< /etc/portage/make.conf.local || touch $@
$(COMPILE_OPTIONS): $(STAGE3) $(PORTAGE_DIR) configs/make.conf.$(VA_ARCH) configs/locale.gen $(portage_package_files) $(portage_make_conf_local) $(CHROOT)/var/tmp/profile: $(STAGE3)
COPY configs/make.conf.$(VA_ARCH) /etc/portage/make.conf RUN eselect profile set $(appliance_profile)
COPY configs/locale.gen /etc/locale.gen touch $@
$(CHROOT)/etc/locale.gen: configs/locale.gen
COPY configs/locale.gen $@
$(COMPILE_OPTIONS): $(STAGE3) $(PORTAGE_DIR) $(CHROOT)/etc/portage/make.conf configs/locale.gen $(portage_package_files) $(portage_make_conf_local) $(CHROOT)/var/tmp/profile $(CHROOT)/etc/locale.gen
RUN locale-gen RUN locale-gen
touch $(COMPILE_OPTIONS) touch $(COMPILE_OPTIONS)
@ -214,8 +223,9 @@ endif
ln -nsf /run/systemd/resolve/resolv.conf $(CHROOT)/etc/resolv.conf ln -nsf /run/systemd/resolve/resolv.conf $(CHROOT)/etc/resolv.conf
touch $(GRUB) touch $(GRUB)
software: $(SOFTWARE)
$(SOFTWARE): $(STAGE3) $(SYSTOOLS) configs/eth.network configs/issue $(WORLD) $(SOFTWARE): $(SYSTOOLS) configs/eth.network configs/issue $(COMPILE_OPTIONS) $(WORLD)
@print Building $(APPLIANCE)-specific software @print Building $(APPLIANCE)-specific software
$(MAKE) -C appliances/$(APPLIANCE) preinstall $(MAKE) -C appliances/$(APPLIANCE) preinstall

View File

@ -1,3 +1,3 @@
# <fs> <mountpoint> <type> <opts> <dump/pass> # <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/sda1 / ext4 noatime 1 1 /dev/DRIVE1 / ext4 noatime 1 1
/.swap none swap sw 0 0 /.swap none swap sw 0 0