-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
79 lines (71 loc) · 3.19 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
app_name=integration_jupyterhub
cert_dir=$(HOME)/.nextcloud/certificates
get_version = $(shell grep /version $(app_name)/appinfo/info.xml | sed 's/.*\([0-9]\.[0-9]\.[0-9]\).*/\1/')
project_dir=$(CURDIR)/$(app_name)
build_dir=$(CURDIR)/build/artifacts
sign_dir=$(build_dir)/sign
package_name=$(app_name)
version := $(call get_version)
all: appstore
release: appstore
docker: package
docker run --rm --detach -p 8080:80 --name nextcloud nextcloud:latest
sleep 5
docker cp $(build_dir)/$(app_name)-$(version).tar.gz nextcloud:/var/www/html/custom_apps
docker exec -u www-data nextcloud /bin/bash -c "cd /var/www/html/custom_apps && tar -xzf $(app_name)-$(version).tar.gz && rm $(app_name)-$(version).tar.gz"
docker exec nextcloud /bin/bash -c "chown -R www-data:www-data /var/www/html/custom_apps/$(app_name)"
docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ maintenance:install --admin-user='admin' --admin-pass='adminpassword'"
docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ app:enable $(app_name)"
docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ app:disable firstrunwizard"
docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ log:manage --level 0"
firefox -new-tab http://127.0.0.1:8080/
sign: package
docker run --rm --volume $(cert_dir):/certificates --detach --name nextcloud nextcloud:latest
sleep 5
docker cp $(build_dir)/$(app_name)-$(version).tar.gz nextcloud:/var/www/html/custom_apps
docker exec -u www-data nextcloud /bin/bash -c "cd /var/www/html/custom_apps && tar -xzf $(app_name)-$(version).tar.gz && rm $(app_name)-$(version).tar.gz"
docker exec -u www-data nextcloud /bin/bash -c "php /var/www/html/occ integrity:sign-app --certificate /certificates/$(app_name).crt --privateKey /certificates/$(app_name).key --path /var/www/html/custom_apps/$(app_name)"
docker exec -u www-data nextcloud /bin/bash -c "cd /var/www/html/custom_apps && tar pzcf $(app_name)-$(version).tar.gz $(app_name)"
docker cp nextcloud:/var/www/html/custom_apps/$(app_name)-$(version).tar.gz $(build_dir)/$(app_name)-$(version).tar.gz
sleep 3
docker kill nextcloud
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(version).tar.gz | openssl base64
appstore: sign
.PHONY: composer
composer:
cd $(project_dir) && composer install --prefer-dist
# Installs npm dependencies
.PHONY: npm
npm:
cd $(project_dir) && npm install
cd $(project_dir) && npm run build
# Same as clean but also removes dependencies installed by composer, bower and
# npm
.PHONY: distclean
distclean: clean
rm -rf $(project_dir)/vendor
rm -rf $(project_dir)/node_modules
clean:
rm -rf $(build_dir)
package: clean npm composer
mkdir -p $(sign_dir)
rsync -a \
--exclude=/build \
--exclude=/docs \
--exclude=/translationfiles \
--exclude=.tx \
--exclude=/tests \
--exclude=.git \
--exclude=.github \
--exclude=/l10n/l10n.pl \
--exclude=/CONTRIBUTING.md \
--exclude=/issue_template.md \
--exclude=.gitattributes \
--exclude=.gitignore \
--exclude=.scrutinizer.yml \
--exclude=.travis.yml \
--exclude=/Makefile \
--exclude=.drone.yml \
$(project_dir)/ $(sign_dir)/$(app_name)
tar -czf $(build_dir)/$(app_name)-$(version).tar.gz \
-C $(sign_dir) $(app_name)