add code signing in makefile

merge-requests/1/head
Julien Veyssier 2017-03-18 02:09:10 -03:00
parent 6be080627f
commit 67fc74f6b0
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,8 @@ project_dir=$(CURDIR)/../$(app_name)
build_dir=/tmp/build build_dir=/tmp/build
sign_dir=/tmp/sign sign_dir=/tmp/sign
cert_dir=$(HOME)/.nextcloud/certificates cert_dir=$(HOME)/.nextcloud/certificates
webserveruser ?= www-data
occ_dir ?= /var/www/html/nextcloud
all: appstore all: appstore
@ -16,6 +18,7 @@ appstore: clean
mkdir -p $(build_dir) mkdir -p $(build_dir)
rsync -a \ rsync -a \
--exclude=.git \ --exclude=.git \
--exclude=appinfo/signature.json \
--exclude=*.swp \ --exclude=*.swp \
--exclude=build \ --exclude=build \
--exclude=.gitignore \ --exclude=.gitignore \
@ -33,6 +36,10 @@ appstore: clean
--exclude=tests \ --exclude=tests \
--exclude=vendor/bin \ --exclude=vendor/bin \
$(project_dir) $(sign_dir) $(project_dir) $(sign_dir)
# give the webserver user the right to create signature file
sudo chown $(webserveruser) $(sign_dir)/$(app_name)/appinfo
sudo -u $(webserveruser) php $(occ_dir)/occ integrity:sign-app --privateKey=$(cert_dir)/$(app_name).key --certificate=$(cert_dir)/$(app_name).crt --path=$(sign_dir)/$(app_name)/
sudo chown -R $(USER) $(sign_dir)/$(app_name)/appinfo
tar -czf $(build_dir)/$(app_name)-$(app_version).tar.gz \ tar -czf $(build_dir)/$(app_name)-$(app_version).tar.gz \
-C $(sign_dir) $(app_name) -C $(sign_dir) $(app_name)
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(app_version).tar.gz | openssl base64 openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(app_version).tar.gz | openssl base64