diff --git a/Makefile b/Makefile index 40b4bb4..0da3f06 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ xzimages: $(addsuffix .img.xz,$(platforms)) images: $(addsuffix .img,$(platforms)) yaml: $(addsuffix .yaml,$(platforms)) +ifeq ($(shell id -u),0) +as_root = +else +as_root = fakemachine -v $(CURDIR) -- env --chdir $(CURDIR) +endif + target_platforms: @echo $(platforms) @@ -122,7 +128,7 @@ raspi_4_bullseye.yaml: raspi_base_bullseye.yaml %.img: %.yaml touch $(@:.img=.log) - time nice vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@) + time nice $(as_root) vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@) chmod 0644 $@ $(@,.img=.log) _ck_root: diff --git a/README.md b/README.md index c65fb37..471ec71 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,12 @@ Debian Buster (10) or higher system: * debootstrap * time * kpartx +* fakemachine (optional, only available on amd64) To install these (as root): ```shell apt install -y vmdb2 dosfstools qemu-utils qemu-user-static debootstrap binfmt-support time kpartx + apt install -y fakemachine ``` Do note that –at least currently– vmdb2 uses some syntax that is available @@ -50,8 +52,10 @@ little as possible in a parametrized way. The master recipe is [raspi_master.yaml](raspi_master.yaml). A Makefile is supplied to drive the build of the recipes into images. -Some portions of building the image will require root privileges, thus -you'll need to execute *make* below as root. +If `fakemachine` is installed, it can be run as an unprivileged user. +Otherwise, because some steps of building the image require root privileges, +you'll need to execute `make` as root. + The argument to `make` is constructed as follows: `raspi__.`