From 7cf816863ada4b7707e2576f37fb556f75843da2 Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Sun, 18 Oct 2020 22:55:02 -0700 Subject: [PATCH] Rewrite to some makefile crap --- .gitignore | 1 + Makefile | 28 ++++++++++++++++++++++++++++ alpine.sh | 10 ++++++++++ appstore.sh | 5 +++++ lib.sh | 19 ------------------- makeroot.sh | 19 +++++++++++++++++++ 6 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 alpine.sh create mode 100644 appstore.sh delete mode 100644 lib.sh create mode 100755 makeroot.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2e7327 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/out diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c3a3621 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +OUT = out +MAKEROOT = ./makeroot.sh + +ROOTS = appstore alpine +ROOT_TARS = $(ROOTS:%=$(OUT)/%.tar.gz) + +.PHONY: all +all: $(OUT) $(ROOT_TARS) + +$(OUT): + mkdir -p $@ +.PHONY: clean +clean: + rm -rf $(OUT) + +define download-root +$$(OUT)/$(notdir $(1)): + curl -L -o $$@ $(1) +endef + +define make-root +$$(OUT)/$(1).tar.gz: $$(MAKEROOT) $(1).sh $$(OUT)/$(2).tar.gz + $$(MAKEROOT) $$@ $$(OUT)/$(2).tar.gz $(1).sh +endef + +$(eval $(call download-root,http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86/alpine-minirootfs-3.12.0-x86.tar.gz)) +$(eval $(call make-root,alpine,alpine-minirootfs-3.12.0-x86)) +$(eval $(call make-root,appstore,alpine-minirootfs-3.12.0-x86)) diff --git a/alpine.sh b/alpine.sh new file mode 100644 index 0000000..794eaf7 --- /dev/null +++ b/alpine.sh @@ -0,0 +1,10 @@ +script </etc/motd < + +You may change this message by editing /etc/motd. + +MOTD +END diff --git a/appstore.sh b/appstore.sh new file mode 100644 index 0000000..958f568 --- /dev/null +++ b/appstore.sh @@ -0,0 +1,5 @@ +script </etc/motd +END diff --git a/lib.sh b/lib.sh deleted file mode 100644 index e46a41e..0000000 --- a/lib.sh +++ /dev/null @@ -1,19 +0,0 @@ -dir="$(dirname "$0")" -root="$dir/root" -tarballs="$dir/tarballs" -b="$dir/../../build/" - -function root_import() { - rm -rf "$root" - "$b/tools/fakefsify" "$tarballs/$1" "$root" -} - -function root_export() { - rm -f "$tarballs/$1" - "$b/tools/unfakefsify" "$root" "$tarballs/$1" - rm -rf "$root" -} - -function script() { - "$b/ish" -f "$root" /bin/sh - -} diff --git a/makeroot.sh b/makeroot.sh new file mode 100755 index 0000000..debf29f --- /dev/null +++ b/makeroot.sh @@ -0,0 +1,19 @@ +#!/bin/sh +output="$1" +input="$2" +script="$3" + +dir="$(dirname "$0")" +root="$dir/root" +b="$dir/../../build/" + +function script() { + "$b/ish" -f "$root" /bin/sh - +} + +rm -rf "$root" +rm -f "$output" +"$b/tools/fakefsify" "$input" "$root" +source "$script" +"$b/tools/unfakefsify" "$root" "$output" +rm -rf "$root"