# Pastebin hdHBMAuP [zyga@faroe fedora29]$ cat Makefile # The set of packages to install inside the base snap seed_packages=filesystem coreutils bash util-linux glibc-minimal-langpack unseed_packages= # The Fedora release we are building the base snap with release=29 # The rest should be unchanged dnf_opts += --setopt=install_weak_deps=False dnf_opts += --setopt=tsflags=nodocs dnf_opts += --assumeyes dnf_opts += --releasever=$(release) dnf_opts += --config=fedora.conf .PHONY: snap snap: dnf_opts += --cacheonly snap: # Install the required packages into the cache directory. # Install the filesystem package first as otherwise the info package just hangs. sudo dnf $(dnf_opts) --installroot=$(CURDIR)/cache install filesystem glibc-minimal-langpack sudo dnf $(dnf_opts) --installroot=$(CURDIR)/cache install $(seed_packages) # Copy the cache directory to the prime directory where we prepare our snap. sudo rsync -a $(CURDIR)/cache/ $(CURDIR)/prime/ # Remove packages we don't want in the base snap. # sudo dnf $(dnf_opts) --installroot=$(CURDIR)/prime remove $(unseed_packages) # Install the /meta/snap.yaml file sudo install -d $(CURDIR)/prime/meta sudo install -m 644 snap.yaml $(CURDIR)/prime/meta/ # Install mount points for snapd integration: # - /snap where snaps are exposed # - /var/snap where system-wide per-snap state is exposed # - /var/lib/snapd where snapd state is exposed: # - /usr/lib/snapd where snapd.snap (snapd itself) is exposed sudo install -d $(CURDIR)/prime/{snap,var/snap,var/lib/snapd,usr/lib/snapd} # Post-process and remove log and cache files. sudo rm -rf $(CURDIR)/prime/var/log/* sudo rm -rf $(CURDIR)/prime/var/cache/dnf sudo rm -rf $(CURDIR)/prime/var/tmp/* # Post-process and remove everything in the /etc directory, leaving a few # integration points (for bind mounting): # - /etc/nsswitch.conf # - /etc/alternatives (directory) # - /etc/ssl (directory) sudo rm -rf $(CURDIR)/prime/etc/* sudo install -d $(CURDIR)/prime/etc/{alternatives,ssl} sudo touch $(CURDIR)/prime/etc/nsswitch.conf # Post-process variant information in os-release. sudo sed -i -e 's/VARIANT="Workstation Edition"/VARIANT="Base Snap Edition"/' -e 's/VARIANT_ID=workstation/VARIANT_ID=snap/' $(CURDIR)/prime/usr/lib/os-release # Create the squashfs file sudo mksquashfs ./prime fedora29.snap -noappend -comp xz -no-xattrs -no-fragments .PHONY: cache cache: dnf_opts += --downloadonly cache: dnf_opts += --installroot=$(CURDIR)/cache cache: dnf $(dnf_opts) makecache # I'd use pseudo/fakeroot but they both seem broken sudo dnf $(dnf_opts) install $(seed_packages) .PHONY: clean clean: sudo rm -rf prime sudo rm -f fedora29.snap .PHONY: distclean distclean: sudo rm -rf cache