Skip to content

Commit

Permalink
Rewrite to some makefile crap
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Oct 19, 2020
1 parent 773851a commit 7cf8168
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/out
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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))
10 changes: 10 additions & 0 deletions alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
script <<END
cat >/etc/motd <<MOTD
Welcome to Alpine!
You can install packages with: apk add <package>
You may change this message by editing /etc/motd.
MOTD
END
5 changes: 5 additions & 0 deletions appstore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
script <<END
apk del apk-tools
rm -rf /usr/share/apk
: >/etc/motd
END
19 changes: 0 additions & 19 deletions lib.sh

This file was deleted.

19 changes: 19 additions & 0 deletions makeroot.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7cf8168

Please sign in to comment.