summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2022-02-18 02:07:53 +0100
committerPÁLI Gábor János <pali.gabor@gmail.com>2022-02-18 02:07:53 +0100
commit20873a8208910d8078f0ea166743a74d0c4114d4 (patch)
tree84fccb718e924399a4532ea14b9e3d241c2905c5 /Makefile
parent39a816a5594b6f79c87ffe78bb7afac86c3b0f1f (diff)
downloadfreebsd-wifibox-alpine-20873a8208910d8078f0ea166743a74d0c4114d4.zip
Implement the installation process.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6c9f4f3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+PREFIX?=/usr/local
+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
+MANDIR=$(DESTDIR)$(PREFIX)/man
+
+MKDIR=/bin/mkdir
+CP=/bin/cp
+SED=/usr/bin/sed
+TAR=/usr/bin/tar
+CHROOT=/usr/sbin/chroot
+RM=/bin/rm
+GIT=$(LOCALBASE)/bin/git
+
+.if !defined(VERSION)
+VERSION!= $(GIT) describe --tags --always
+.endif
+
+SUB_LIST= PREFIX=$(PREFIX) \
+ LOCALBASE=$(LOCALBASE) \
+ ROOT=$(ROOT)
+
+_SUB_LIST_EXP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
+
+install:
+ $(MKDIR) -p $(GUESTDIR)
+ $(SED) ${_SUB_LIST_EXP} grub.cfg > $(SHAREDIR)/grub.cfg
+ $(TAR) -xf $(MINIROOTFS) -C $(GUESTDIR)
+ $(CP) -R etc/* $(GUESTDIR)/etc/
+ $(MKDIR) -p $(PACKAGEDIR)
+ $(CP) -R $(PACKAGES) $(PACKAGEDIR)/
+ $(CP) setup.sh $(GUESTDIR)/
+ $(CHROOT) $(GUESTDIR) /bin/ash setup.sh
+ $(RM) -rf $(PACKAGEDIR)
+ $(RM) $(GUESTDIR)/setup.sh
+ $(RM) $(GUESTDIR)/busybox.core
+
+.MAIN: clean
+
+clean: ;