diff options
author | PÁLI Gábor János <pali.gabor@gmail.com> | 2022-03-13 21:00:12 +0100 |
---|---|---|
committer | PÁLI Gábor János <pali.gabor@gmail.com> | 2022-03-13 22:29:04 +0100 |
commit | af86a86fbd364ef8346112906c6a54b28fe9bd70 (patch) | |
tree | 50ee89db0429648dfef83e0d133b883bcdeedeb6 /Makefile | |
parent | 32e14309578a8867c7c0205bc48fd1c3d2b927c3 (diff) | |
download | freebsd-wifibox-alpine-af86a86fbd364ef8346112906c6a54b28fe9bd70.zip |
Switch to Squashfs.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 64 |
1 files changed, 45 insertions, 19 deletions
@@ -3,14 +3,18 @@ LOCALBASE?=/usr/local MINIROOTFS?=alpine-minirootfs.tar.gz PACKAGES?=*.apk -ROOT=$(PREFIX)/share/wifibox/guest -SHAREDIR=$(DESTDIR)$(PREFIX)/share/wifibox -GUESTDIR=$(SHAREDIR)/guest -PACKAGEDIR=$(GUESTDIR)/packages +ROOT=$(PREFIX)/share/wifibox +SHAREDIR=$(DESTDIR)$(ROOT) ETCDIR=$(DESTDIR)$(PREFIX)/etc/wifibox MANDIR=$(DESTDIR)$(PREFIX)/man RUNDIR=$(DESTDIR)/var/run/wifibox +GUESTDIR?=work/image-contents +PACKAGEDIR=$(GUESTDIR)/packages +BOOTDIR=$(GUESTDIR)/boot + +SHAREMODE?=0644 + MKDIR=/bin/mkdir CP=/bin/cp SED=/usr/bin/sed @@ -18,8 +22,16 @@ TAR=/usr/bin/tar CHROOT=/usr/sbin/chroot RM=/bin/rm GZIP=/usr/bin/gzip +INSTALL_DATA=/usr/bin/install -m $(SHAREMODE) +TOUCH=/usr/bin/touch GIT=$(LOCALBASE)/bin/git +MKSQUASHFS=$(LOCALBASE)/bin/mksquashfs +SQUASHFS_COMP?= lzo +SQUASHFS_IMG= alpine-$(VERSION).squashfs.img +SQUASHFS_INITRAMFS= $(BOOTDIR)/initramfs* +SQUASHFS_VMLINUZ= $(BOOTDIR)/vmlinuz* + .if !defined(VERSION) VERSION!= $(GIT) describe --tags --always .endif @@ -30,27 +42,40 @@ SUB_LIST= PREFIX=$(PREFIX) \ _SUB_LIST_EXP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} -APPLIANCE_DIR= $(RUNDIR)/appliance +APPLIANCEDIR= $(RUNDIR)/appliance -install: - $(MKDIR) -p $(GUESTDIR) +image-contents: $(GUESTDIR)/.done - $(SED) ${_SUB_LIST_EXP} share/grub.cfg > $(SHAREDIR)/grub.cfg +$(GUESTDIR)/.done: + $(RM) -rf $(GUESTDIR) + $(MKDIR) -p $(GUESTDIR) $(TAR) -xf $(MINIROOTFS) -C $(GUESTDIR) - $(CP) -R guest/etc/* $(GUESTDIR)/etc/ $(CP) -R guest/sbin/* $(GUESTDIR)/sbin/ - $(ECHO) "VERSION=$(VERSION)" >> $(GUESTDIR)/etc/wifibox-guest - $(MKDIR) -p $(PACKAGEDIR) $(CP) -R $(PACKAGES) $(PACKAGEDIR)/ $(CP) guest/setup.sh $(GUESTDIR)/ - $(CHROOT) $(GUESTDIR) /bin/ash setup.sh - $(RM) -rf $(PACKAGEDIR) $(RM) $(GUESTDIR)/setup.sh - $(RM) $(GUESTDIR)/busybox.core + $(RM) -f $(GUESTDIR)/busybox.core + $(TOUCH) $(GUESTDIR)/.done + +$(SQUASHFS_IMG): image-contents + $(MKSQUASHFS) \ + $(GUESTDIR) \ + $(SQUASHFS_IMG) \ + -comp $(SQUASHFS_COMP) \ + -wildcards -e boot -e .done -e "var/*" + +all: $(SQUASHFS_IMG) + +install: + $(MKDIR) -p $(SHAREDIR) + $(INSTALL_DATA) $(SQUASHFS_INITRAMFS) $(SHAREDIR)/initramfs + $(INSTALL_DATA) $(SQUASHFS_VMLINUZ) $(SHAREDIR)/vmlinuz + $(INSTALL_DATA) $(SQUASHFS_IMG) $(SHAREDIR)/disk.img + $(SED) ${_SUB_LIST_EXP} share/grub.cfg > $(SHAREDIR)/grub.cfg $(MKDIR) -p $(ETCDIR) $(CP) etc/* $(ETCDIR)/ @@ -59,10 +84,11 @@ install: $(SED) ${_SUB_LIST_EXP} man/wifibox-alpine.5 \ | $(GZIP) -c > $(MANDIR)/man5/wifibox-alpine.5.gz - $(MKDIR) -p $(APPLIANCE_DIR) - $(CP) -R $(GUESTDIR)/var/* $(APPLIANCE_DIR)/ - $(RM) -rf $(GUESTDIR)/var/* + $(MKDIR) -p $(APPLIANCEDIR) + $(CP) -R $(GUESTDIR)/var/* $(APPLIANCEDIR)/ -.MAIN: clean +clean: + $(RM) -rf $(GUESTDIR) + $(RM) $(SQUASHFS_IMG) -clean: ; +.MAIN: all |