-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (42 loc) · 1.84 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/make -f
STARTURL ?= https://updates.safing.io/latest/linux_amd64/start/portmaster-start\?CI
NFPM ?= nfpm
.PHONY: icons test-debian test-ubuntu nfpm.yaml
all: deb rpm
nfpm.yaml: portmaster-start
sed -e "s/^version:.*$$/version: v$(shell ./portmaster-start version --short)-$(shell cat ./pkgrev)/g" ./nfpm.yaml.template > ./nfpm.yaml
build: icons nfpm.yaml gen-scripts gen-pkgbuild
icons:
for res in 16 32 48 96 128 ; do \
mkdir -p icons/$${res}x$${res} ; \
convert ./portmaster_logo.png -resize "$${res}x$${res}" "icons/$${res}x$${res}/portmaster.png" ; \
done
portmaster-start:
curl --fail --user-agent GitHub -o portmaster-start $(STARTURL)
chmod +x ./portmaster-start
deb: distdir build
$(NFPM) package --packager deb -t dist
rpm: distdir build
$(NFPM) package --packager rpm -t dist
distdir:
mkdir -p ./dist
clean:
rm -r ./portmaster-start ./scripts ./dist icons/ PKGBUILD arch.install nfpm.yaml src pkg portmaster-bin-*.pkg.tar.xz|| true
test-debian: build deb
docker run -ti --rm -v $(shell pwd)/dist:/work -w /work debian:latest bash -c 'apt update && apt install -y ca-certificates && dpkg -i /work/portmaster*.deb ; bash'
test-ubuntu: build deb
docker run -ti --rm -v $(shell pwd)/dist:/work -w /work ubuntu:latest bash -c 'apt update && apt install -y ca-certificates && dpkg -i /work/portmaster*.deb ; bash'
increase-pkgrev:
bash -c 'rev=$$(cat pkgrev) ; ((rev++)) ; echo $${rev} > ./pkgrev'
reset-pkgrev:
echo 1 > ./pkgrev
gen-scripts:
mkdir -p ./scripts
for file in "rules" "preinstall.sh" "postinstall.sh" "preremove.sh" "postremove.sh"; do \
gomplate -f "templates/$${file}" > "./scripts/$${file}" ; \
done;
gen-pkgbuild: nfpm.yaml
gomplate -d "nfpm=./nfpm.yaml" -f templates/arch.install > arch.install
gomplate -d "nfpm=./nfpm.yaml" -f templates/PKGBUILD > PKGBUILD
lint:
shellcheck ./scripts/* ./arch.install