From ce325cf3d012956d463e72bba2d43e3aea6ffda0 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 26 Feb 2019 20:24:02 +0100 Subject: [PATCH] Squashed commit of the following: - Bump basic OS to Alpine 3.9 - Restructure repo and add layer versioning - Use JSON for all metadata - Merge abuild branch (but without abuild) --- .gitlab/issue_templates/Issue.md | 13 - .gitmodules | 2 +- README.md | 22 +- _build/build-all.sh | 107 + {zz-build => _build}/etc/abuild.conf | 0 {zz-build => _build}/install-toolchain.sh | 11 +- {zz-build => _build}/root/.config/htop/htoprc | 0 {zz-build => _build}/root/.profile | 0 .../root/.ssh/authorized_keys | 0 {zz-build => _build}/usr/bin/fix-apk | 0 {zz-build => _build}/usr/bin/lxc-build | 24 +- {zz-build => _build}/usr/bin/lxc-pack | 53 +- {zz-extra => _extra}/frontlinesms-lang-js.py | 0 {zz-extra => _extra}/sahana-lang-csv.py | 0 {zz-extra => _extra}/vm-ping.php | 0 alpine.sh => _vm.sh | 9 +- {basic => _vm}/boot/extlinux.conf | 0 {basic => _vm}/boot/vm.txt | 0 {basic => _vm}/etc/apk/keys/repokey.rsa.pub | 0 _vm/etc/apk/repositories | 3 + {basic => _vm}/etc/conf.d/consolefont | 0 {basic => _vm}/etc/conf.d/iptables | 0 {basic => _vm}/etc/hostname | 0 {basic => _vm}/etc/hosts | 0 {basic => _vm}/etc/inittab | 0 {basic => _vm}/etc/iptables/rules-save | 0 {basic => _vm}/etc/network/interfaces | 0 {basic => _vm}/etc/nginx/conf.d/default.conf | 0 {basic => _vm}/etc/nginx/nginx.conf | 0 {basic => _vm}/etc/postfix/main.cf | 0 {basic => _vm}/etc/rc.conf | 0 {basic => _vm}/etc/ssl/services.key | 0 {basic => _vm}/etc/ssl/services.pem | 0 {basic => _vm}/sbin/extend-disk | 0 {basic => _vm}/sbin/vmtty | 0 {app-acme-sh => acme-sh}/APKBUILD | 14 +- {app-acme-sh => acme-sh}/source/acme-sh | 0 activemq/install.sh | 2 - activemq/lxcfile | 4 +- activemq/meta | 9 + activemq/pkg | 4 - activemq/uninstall.sh | 2 - {basic-nodejs => alpine3.8-nodejs8}/lxcfile | 4 +- alpine3.8-nodejs8/meta | 9 + alpine3.8-php5.6/lxcfile | 8 + alpine3.8-php5.6/meta | 9 + {basic-ruby => alpine3.8-ruby2.4}/lxcfile | 4 +- alpine3.8-ruby2.4/meta | 9 + alpine3.8/lxcfile | 13 + alpine3.8/meta | 9 + {basic-java => alpine3.9-java8}/lxcfile | 4 +- alpine3.9-java8/meta | 9 + alpine3.9-nodejs10/lxcfile | 7 + alpine3.9-nodejs10/meta | 9 + {basic-php => alpine3.9-php7.2}/lxcfile | 4 +- alpine3.9-php7.2/meta | 9 + alpine3.9-python2.7/lxcfile | 7 + alpine3.9-python2.7/meta | 9 + .../lxcfile | 5 +- alpine3.9-python3.6/meta | 9 + alpine3.9-ruby2.4/lxcfile | 33 + alpine3.9-ruby2.4/meta | 9 + .../lxc/srv/tomcat/bin/setenv.sh | 0 .../lxc/srv/tomcat/conf/logging.properties | 0 {basic-tomcat => alpine3.9-tomcat8}/lxcfile | 8 +- alpine3.9-tomcat8/meta | 9 + {basic-alpine => alpine3.9}/lxcfile | 5 +- alpine3.9/meta | 9 + app-lxc/APKBUILD | 43 - app-vmmgr | 1 - basic-alpine/pkg | 4 - basic-java/pkg | 4 - basic-libxml/lxcfile | 7 - basic-libxml/pkg | 4 - basic-nodejs/pkg | 4 - basic-php/pkg | 4 - basic-python2/lxcfile | 8 - basic-python2/pkg | 4 - basic-python3/pkg | 4 - basic-ruby/pkg | 4 - basic-tomcat/pkg | 4 - basic/etc/apk/repositories | 3 - basic/etc/conf.d/ntpd | 1 - ckan-datapusher/install.sh | 2 - ckan-datapusher/lxcfile | 5 +- ckan-datapusher/meta | 9 + ckan-datapusher/pkg | 4 - ckan-datapusher/uninstall.sh | 2 - ckan/install.sh | 2 - ckan/lxcfile | 6 +- ckan/meta | 10 + ckan/pkg | 7 - ckan/uninstall.sh | 3 +- crisiscleanup/install.sh | 2 - crisiscleanup/lxcfile | 9 +- crisiscleanup/meta | 10 + crisiscleanup/pkg | 7 - crisiscleanup/uninstall.sh | 3 +- cts/install.sh | 2 - cts/lxcfile | 5 +- cts/meta | 10 + cts/pkg | 7 - cts/uninstall.sh | 3 +- ecogis/install.sh | 26 + ecogis/install/createdb.sql | 4 + ecogis/install/etc/init.d/ecogis | 23 + ecogis/install/srv/ecogis/conf/config.php | 320 ++ ecogis/lxc/etc/nginx/nginx.conf | 42 + ecogis/lxc/etc/php5/php-fpm.conf | 13 + ecogis/lxc/etc/services.d/.s6-svscan/finish | 4 + ecogis/lxc/etc/services.d/nginx/run | 3 + ecogis/lxc/etc/services.d/php-fpm/run | 3 + ecogis/lxcfile | 40 + ecogis/meta | 10 + ecogis/uninstall.sh | 14 + frontlinesms/install.sh | 2 - frontlinesms/lxcfile | 4 +- frontlinesms/meta | 10 + frontlinesms/pkg | 7 - frontlinesms/uninstall.sh | 3 +- gnuhealth/install.sh | 2 - gnuhealth/lxcfile | 13 +- gnuhealth/meta | 10 + gnuhealth/pkg | 7 - gnuhealth/uninstall.sh | 3 +- kanboard/install.sh | 2 - kanboard/lxcfile | 4 +- kanboard/meta | 10 + kanboard/pkg | 7 - kanboard/uninstall.sh | 3 +- mariadb/install.sh | 2 - mariadb/lxcfile | 2 +- mariadb/meta | 9 + mariadb/pkg | 4 - mariadb/uninstall.sh | 2 - mifosx/install.sh | 2 - mifosx/lxcfile | 6 +- mifosx/meta | 10 + mifosx/pkg | 7 - mifosx/uninstall.sh | 3 +- motech/install.sh | 2 - motech/lxcfile | 6 +- motech/meta | 10 + motech/pkg | 7 - motech/uninstall.sh | 3 +- odoo/install.sh | 2 - odoo/lxcfile | 7 +- odoo/meta | 10 + odoo/pkg | 7 - odoo/uninstall.sh | 3 +- opendatakit-build/install.sh | 2 - opendatakit-build/lxcfile | 6 +- opendatakit-build/meta | 10 + opendatakit-build/pkg | 7 - opendatakit-build/uninstall.sh | 3 +- opendatakit/install.sh | 2 - opendatakit/lxcfile | 9 +- opendatakit/meta | 10 + opendatakit/pkg | 7 - opendatakit/uninstall.sh | 3 +- openmapkit/install.sh | 2 - openmapkit/lxcfile | 10 +- openmapkit/meta | 10 + openmapkit/pkg | 7 - openmapkit/uninstall.sh | 3 +- pandora/install.sh | 2 - pandora/lxcfile | 5 +- pandora/meta | 10 + pandora/pkg | 7 - pandora/uninstall.sh | 3 +- postgres/install.sh | 2 - postgres/lxcfile | 2 +- postgres/meta | 9 + postgres/pkg | 4 - postgres/uninstall.sh | 2 - rabbitmq/install.sh | 2 - rabbitmq/lxcfile | 2 +- rabbitmq/meta | 9 + rabbitmq/pkg | 4 - rabbitmq/uninstall.sh | 2 - redis/install.sh | 2 - redis/lxcfile | 2 +- redis/meta | 9 + redis/pkg | 4 - redis/uninstall.sh | 2 - sahana-demo/install.sh | 2 - sahana-demo/lxcfile | 5 +- sahana-demo/meta | 10 + sahana-demo/pkg | 7 - sahana-demo/uninstall.sh | 3 +- sahana-shared/lxcfile | 5 +- sahana-shared/meta | 9 + sahana-shared/pkg | 4 - sahana/install.sh | 2 - sahana/lxcfile | 5 +- sahana/meta | 10 + sahana/pkg | 7 - sahana/uninstall.sh | 3 +- sambro/install.sh | 2 - sambro/lxcfile | 5 +- sambro/meta | 10 + sambro/pkg | 7 - sambro/uninstall.sh | 3 +- seeddms/install.sh | 2 - seeddms/lxcfile | 7 +- seeddms/meta | 10 + seeddms/pkg | 7 - seeddms/uninstall.sh | 3 +- sigmah/install.sh | 2 - sigmah/lxcfile | 6 +- sigmah/meta | 10 + sigmah/pkg | 7 - sigmah/uninstall.sh | 3 +- solr/install.sh | 2 - solr/lxcfile | 7 +- solr/meta | 9 + solr/pkg | 4 - solr/uninstall.sh | 2 - ushahidi/install.sh | 2 - ushahidi/lxcfile | 4 +- ushahidi/meta | 10 + ushahidi/pkg | 7 - ushahidi/uninstall.sh | 3 +- vmmgr | 1 + zz-build/build-all.sh | 98 - zz-build/usr/bin/abuild | 2615 ----------------- 226 files changed, 1252 insertions(+), 3232 deletions(-) delete mode 100644 .gitlab/issue_templates/Issue.md create mode 100755 _build/build-all.sh rename {zz-build => _build}/etc/abuild.conf (100%) rename {zz-build => _build}/install-toolchain.sh (85%) rename {zz-build => _build}/root/.config/htop/htoprc (100%) rename {zz-build => _build}/root/.profile (100%) rename {zz-build => _build}/root/.ssh/authorized_keys (100%) rename {zz-build => _build}/usr/bin/fix-apk (100%) rename {zz-build => _build}/usr/bin/lxc-build (88%) rename {zz-build => _build}/usr/bin/lxc-pack (59%) rename {zz-extra => _extra}/frontlinesms-lang-js.py (100%) rename {zz-extra => _extra}/sahana-lang-csv.py (100%) rename {zz-extra => _extra}/vm-ping.php (100%) rename alpine.sh => _vm.sh (90%) rename {basic => _vm}/boot/extlinux.conf (100%) rename {basic => _vm}/boot/vm.txt (100%) rename {basic => _vm}/etc/apk/keys/repokey.rsa.pub (100%) create mode 100644 _vm/etc/apk/repositories rename {basic => _vm}/etc/conf.d/consolefont (100%) rename {basic => _vm}/etc/conf.d/iptables (100%) rename {basic => _vm}/etc/hostname (100%) rename {basic => _vm}/etc/hosts (100%) rename {basic => _vm}/etc/inittab (100%) rename {basic => _vm}/etc/iptables/rules-save (100%) rename {basic => _vm}/etc/network/interfaces (100%) rename {basic => _vm}/etc/nginx/conf.d/default.conf (100%) rename {basic => _vm}/etc/nginx/nginx.conf (100%) rename {basic => _vm}/etc/postfix/main.cf (100%) rename {basic => _vm}/etc/rc.conf (100%) rename {basic => _vm}/etc/ssl/services.key (100%) rename {basic => _vm}/etc/ssl/services.pem (100%) rename {basic => _vm}/sbin/extend-disk (100%) rename {basic => _vm}/sbin/vmtty (100%) rename {app-acme-sh => acme-sh}/APKBUILD (62%) rename {app-acme-sh => acme-sh}/source/acme-sh (100%) create mode 100644 activemq/meta delete mode 100644 activemq/pkg rename {basic-nodejs => alpine3.8-nodejs8}/lxcfile (50%) create mode 100644 alpine3.8-nodejs8/meta create mode 100644 alpine3.8-php5.6/lxcfile create mode 100644 alpine3.8-php5.6/meta rename {basic-ruby => alpine3.8-ruby2.4}/lxcfile (94%) create mode 100644 alpine3.8-ruby2.4/meta create mode 100644 alpine3.8/lxcfile create mode 100644 alpine3.8/meta rename {basic-java => alpine3.9-java8}/lxcfile (55%) create mode 100644 alpine3.9-java8/meta create mode 100644 alpine3.9-nodejs10/lxcfile create mode 100644 alpine3.9-nodejs10/meta rename {basic-php => alpine3.9-php7.2}/lxcfile (73%) create mode 100644 alpine3.9-php7.2/meta create mode 100644 alpine3.9-python2.7/lxcfile create mode 100644 alpine3.9-python2.7/meta rename {basic-python3 => alpine3.9-python3.6}/lxcfile (61%) create mode 100644 alpine3.9-python3.6/meta create mode 100644 alpine3.9-ruby2.4/lxcfile create mode 100644 alpine3.9-ruby2.4/meta rename {basic-tomcat => alpine3.9-tomcat8}/lxc/srv/tomcat/bin/setenv.sh (100%) rename {basic-tomcat => alpine3.9-tomcat8}/lxc/srv/tomcat/conf/logging.properties (100%) rename {basic-tomcat => alpine3.9-tomcat8}/lxcfile (64%) create mode 100644 alpine3.9-tomcat8/meta rename {basic-alpine => alpine3.9}/lxcfile (65%) create mode 100644 alpine3.9/meta delete mode 100644 app-lxc/APKBUILD delete mode 160000 app-vmmgr delete mode 100644 basic-alpine/pkg delete mode 100644 basic-java/pkg delete mode 100644 basic-libxml/lxcfile delete mode 100644 basic-libxml/pkg delete mode 100644 basic-nodejs/pkg delete mode 100644 basic-php/pkg delete mode 100644 basic-python2/lxcfile delete mode 100644 basic-python2/pkg delete mode 100644 basic-python3/pkg delete mode 100644 basic-ruby/pkg delete mode 100644 basic-tomcat/pkg delete mode 100644 basic/etc/apk/repositories delete mode 100644 basic/etc/conf.d/ntpd create mode 100644 ckan-datapusher/meta delete mode 100644 ckan-datapusher/pkg create mode 100644 ckan/meta delete mode 100644 ckan/pkg create mode 100644 crisiscleanup/meta delete mode 100644 crisiscleanup/pkg create mode 100644 cts/meta delete mode 100644 cts/pkg create mode 100755 ecogis/install.sh create mode 100644 ecogis/install/createdb.sql create mode 100755 ecogis/install/etc/init.d/ecogis create mode 100644 ecogis/install/srv/ecogis/conf/config.php create mode 100644 ecogis/lxc/etc/nginx/nginx.conf create mode 100644 ecogis/lxc/etc/php5/php-fpm.conf create mode 100755 ecogis/lxc/etc/services.d/.s6-svscan/finish create mode 100755 ecogis/lxc/etc/services.d/nginx/run create mode 100755 ecogis/lxc/etc/services.d/php-fpm/run create mode 100644 ecogis/lxcfile create mode 100644 ecogis/meta create mode 100755 ecogis/uninstall.sh create mode 100644 frontlinesms/meta delete mode 100644 frontlinesms/pkg create mode 100644 gnuhealth/meta delete mode 100644 gnuhealth/pkg create mode 100644 kanboard/meta delete mode 100644 kanboard/pkg create mode 100644 mariadb/meta delete mode 100644 mariadb/pkg create mode 100644 mifosx/meta delete mode 100644 mifosx/pkg create mode 100644 motech/meta delete mode 100644 motech/pkg create mode 100644 odoo/meta delete mode 100644 odoo/pkg create mode 100644 opendatakit-build/meta delete mode 100644 opendatakit-build/pkg create mode 100644 opendatakit/meta delete mode 100644 opendatakit/pkg create mode 100644 openmapkit/meta delete mode 100644 openmapkit/pkg create mode 100644 pandora/meta delete mode 100644 pandora/pkg create mode 100644 postgres/meta delete mode 100644 postgres/pkg create mode 100644 rabbitmq/meta delete mode 100644 rabbitmq/pkg create mode 100644 redis/meta delete mode 100644 redis/pkg create mode 100644 sahana-demo/meta delete mode 100644 sahana-demo/pkg create mode 100644 sahana-shared/meta delete mode 100644 sahana-shared/pkg create mode 100644 sahana/meta delete mode 100644 sahana/pkg create mode 100644 sambro/meta delete mode 100644 sambro/pkg create mode 100644 seeddms/meta delete mode 100644 seeddms/pkg create mode 100644 sigmah/meta delete mode 100644 sigmah/pkg create mode 100644 solr/meta delete mode 100644 solr/pkg create mode 100644 ushahidi/meta delete mode 100644 ushahidi/pkg create mode 160000 vmmgr delete mode 100755 zz-build/build-all.sh delete mode 100755 zz-build/usr/bin/abuild diff --git a/.gitlab/issue_templates/Issue.md b/.gitlab/issue_templates/Issue.md deleted file mode 100644 index cfa85b7..0000000 --- a/.gitlab/issue_templates/Issue.md +++ /dev/null @@ -1,13 +0,0 @@ -### Steps to reproduce -1. -2. -3. - -### Expected behaviour - - -### Observed behaviour - - -### Additional data (ticket URL, log, timestamp, stack trace etc.) - diff --git a/.gitmodules b/.gitmodules index 6fb74cf..a7a7f1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "app-vmmgr"] - path = app-vmmgr + path = vmmgr url = ssh://git@gitlab.dasm.cz:2222/Spotter-Cluster/vmmgr.git diff --git a/README.md b/README.md index 8d732be..8449b65 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ In case you're setting up a VMWare virtual machine, select OS type *Other Linux ## Virtual Machine creation -Download **Alpine Virtual 3.8.0 x86_64** from and boot from it. At the login prompt, use the root user without password to log in. +Download **Alpine Virtual 3.9.0 x86_64** from and boot from it. At the login prompt, use the root user without password to log in. ``` # Set up interfaces (leave the default choices) @@ -19,8 +19,8 @@ setup-interfaces ifup eth0 # Download and launch the setup script -wget dl.dasm.cz/alpine.sh -sh alpine.sh +wget dl.dasm.cz/_vm.sh +sh _vm.sh ``` The script will perform installation and configuration of Alpine linux, LXC and the whole VMMgr platform. Virtual machine is protected by LUKS-on-LVM disk encryption. The encryption password, which is simultaneously also a password for VMMgr web administration interface, will be asked for at the beginning of the script execution. Root access is disabled. @@ -31,7 +31,7 @@ After the script finishes and shuts down the virtual machine, remove CD/DVD driv ### First time setup -Follow the VM creation steps as above, but comment the line disabling the root login in *alpine.sh* file before its execution. After the script finishes and HDD size is adjusted, add serial port in the virtual machine settings and set it to use Unix socket or named pipe (eg. `\\.\pipe\alpine`). Then start the VM and connect to the serial port using *screen*, *PuTTY* or any other terminal client. +Follow the VM creation steps as above, but comment the line disabling the root login in *_vm.sh* file before its execution. After the script finishes and HDD size is adjusted, add serial port in the virtual machine settings and set it to use Unix socket or named pipe (eg. `\\.\pipe\alpine`). Then start the VM and connect to the serial port using *screen*, *PuTTY* or any other terminal client. ``` # Install git and OpenSSH client @@ -48,7 +48,7 @@ Assign the newly generated key to your GitLab account git clone --recurse-submodules ssh://git@gitlab.dasm.cz:2222/Spotter-Cluster/Spotter-Cluster.git # Install the build toolchain -Spotter-Cluster/zz-build/install-toolchain.sh +Spotter-Cluster/_build/install-toolchain.sh ``` After the script finishes, it is possible to connect via SSH (provided you have personal key in `authorized_keys`) as the toolchain sets up also *openssh-server*. The serial connection will work only until disconnected. If it should work indefinitely, run @@ -61,7 +61,7 @@ kill -1 1 ### Building the packages There are 3 distinct packaging systems. -1. Just a plain tar for basic OS setup used by *alpine.sh* installation script. +1. Just a plain tar for basic OS setup used by *_vm.sh* installation script. 2. Abuild for the native Alpine linux packages (APK) used for LXC, ACME client and VMMgr packaging. 3. `lxc-build`/`lxc-pack` for LXC images building and packaging. @@ -73,15 +73,8 @@ vi /srv/build/repokey.rsa # Or generate a new pair echo '/srv/build/repokey.rsa' | abuild-keygen -# Supply lxc-pack signing key -vi /srv/build/packages.key - -# Or generate a new pair -openssl ecparam -genkey -name secp384r1 -out /srv/build/packages.key -openssl ec -in /srv/build/packages.key -pubout -out /srv/build/packages.pub - # Build all packages -Spotter-Cluster/zz-build/build-all.sh +Spotter-Cluster/_build/build-all.sh ``` The full build process takes considerable amount of time, so it is advised to have a persistent build VM. @@ -95,6 +88,7 @@ The full build process takes considerable amount of time, so it is advised to ha | CKAN Datapusher | ckan-datapusher | 8004 | 8080 (HTTP) | - | | Crisis Cleanup | crisiscleanup | 8005 | 8080 (HTTP) | cc | | CTS | cts | 8006 | 8080 (HTTP) | cts | +| EcoGIS | ecogis | 8020 | 8080 (HTTP) | ecogis | | FrontlineSMS | frontlinesms | 8018 | 8080 (HTTP) | sms | | GNU Health | gnuhealth | 8008 | 8080 (HTTP) | gh | | KanBoard | kanboard | 8009 | 8080 (HTTP) | kb | diff --git a/_build/build-all.sh b/_build/build-all.sh new file mode 100755 index 0000000..c9a4bd3 --- /dev/null +++ b/_build/build-all.sh @@ -0,0 +1,107 @@ +#!/bin/sh +set -ev + +cd $(realpath $(dirname "${0}")) + +# Build basic.tar +cd ../_vm +tar cpf /srv/build/_vm.tar * + +# Build native apps +cd ../acme-sh +abuild -F +cd ../vmmgr +abuild -F +cd .. + +# Build runtimes +lxc-build alpine3.8 +lxc-build alpine3.8-php5.6 +lxc-build alpine3.8-nodejs8 +lxc-build alpine3.8-ruby2.4 +lxc-build alpine3.9 +lxc-build alpine3.9-java8 +lxc-build alpine3.9-php7.2 +lxc-build alpine3.9-python2.7 +lxc-build alpine3.9-python3.6 +lxc-build alpine3.9-nodejs10 +lxc-build alpine3.9-ruby2.4 +lxc-build alpine3.9-tomcat8 + +# Build services +lxc-build activemq +lxc-build mariadb +lxc-build postgres +lxc-build rabbitmq +lxc-build redis +lxc-build solr + +# Build applications +lxc-build ckan-datapusher +lxc-build ckan +lxc-build crisiscleanup +lxc-build cts +lxc-build ecogis +lxc-build frontlinesms +lxc-build gnuhealth +lxc-build kanboard +lxc-build mifosx +lxc-build motech +lxc-build odoo +lxc-build opendatakit +lxc-build opendatakit-build +lxc-build openmapkit +lxc-build pandora +lxc-build sahana-shared +lxc-build sahana +lxc-build sahana-demo +lxc-build sambro +lxc-build seeddms +lxc-build sigmah +lxc-build ushahidi + +# Pack runtimes +lxc-pack alpine3.8 +lxc-pack alpine3.8-php5.6 +lxc-pack alpine3.8-nodejs8 +lxc-pack alpine3.8-ruby2.4 +lxc-pack alpine3.9 +lxc-pack alpine3.9-java8 +lxc-pack alpine3.9-php7.2 +lxc-pack alpine3.9-python2.7 +lxc-pack alpine3.9-python3.6 +lxc-pack alpine3.9-nodejs10 +lxc-pack alpine3.9-ruby2.4 +lxc-pack alpine3.9-tomcat8 + +# Pack services +lxc-pack activemq +lxc-pack mariadb +lxc-pack postgres +lxc-pack rabbitmq +lxc-pack redis +lxc-pack solr + +# Pack applications +lxc-pack ckan-datapusher +lxc-pack ckan +lxc-pack crisiscleanup +lxc-pack cts +lxc-pack ecogis +lxc-pack frontlinesms +lxc-pack gnuhealth +lxc-pack kanboard +lxc-pack mifosx +lxc-pack motech +lxc-pack odoo +lxc-pack opendatakit +lxc-pack opendatakit-build +lxc-pack openmapkit +lxc-pack pandora +lxc-pack sahana-shared +lxc-pack sahana +lxc-pack sahana-demo +lxc-pack sambro +lxc-pack seeddms +lxc-pack sigmah +lxc-pack ushahidi diff --git a/zz-build/etc/abuild.conf b/_build/etc/abuild.conf similarity index 100% rename from zz-build/etc/abuild.conf rename to _build/etc/abuild.conf diff --git a/zz-build/install-toolchain.sh b/_build/install-toolchain.sh similarity index 85% rename from zz-build/install-toolchain.sh rename to _build/install-toolchain.sh index 36e5f61..923b736 100755 --- a/zz-build/install-toolchain.sh +++ b/_build/install-toolchain.sh @@ -17,19 +17,18 @@ cp root/.config/htop/htoprc /root/.config/htop/htoprc rc-update add sshd boot service sshd start -# Prepare build toolchain +# Prepare abuild toolchain adduser root abuild cp etc/abuild.conf /etc/abuild.conf -cp usr/bin/abuild /usr/bin/abuild + +# Prepare LXC build toolchain cp usr/bin/fix-apk /usr/bin/fix-apk cp usr/bin/lxc-build /usr/bin/lxc-build cp usr/bin/lxc-pack /usr/bin/lxc-pack -mkdir -p /srv/build/lxc -# Supply /srv/build/repokey.rsa +# Supply abuild key # echo '/srv/build/repokey.rsa' | abuild-keygen -# Supply /srv/build/packages.key +# Supply LXC build key # openssl ecparam -genkey -name secp384r1 -out /srv/build/packages.key # openssl ec -in /srv/build/packages.key -pubout -out /srv/build/packages.pub - diff --git a/zz-build/root/.config/htop/htoprc b/_build/root/.config/htop/htoprc similarity index 100% rename from zz-build/root/.config/htop/htoprc rename to _build/root/.config/htop/htoprc diff --git a/zz-build/root/.profile b/_build/root/.profile similarity index 100% rename from zz-build/root/.profile rename to _build/root/.profile diff --git a/zz-build/root/.ssh/authorized_keys b/_build/root/.ssh/authorized_keys similarity index 100% rename from zz-build/root/.ssh/authorized_keys rename to _build/root/.ssh/authorized_keys diff --git a/zz-build/usr/bin/fix-apk b/_build/usr/bin/fix-apk similarity index 100% rename from zz-build/usr/bin/fix-apk rename to _build/usr/bin/fix-apk diff --git a/zz-build/usr/bin/lxc-build b/_build/usr/bin/lxc-build similarity index 88% rename from zz-build/usr/bin/lxc-build rename to _build/usr/bin/lxc-build index eb44347..c7db300 100755 --- a/zz-build/usr/bin/lxc-build +++ b/_build/usr/bin/lxc-build @@ -109,10 +109,12 @@ class LXCImage: self.set_cwd(line.split()[1]) elif line.startswith('HALT'): self.set_halt(line.split()[1]) - # Add the final layer which can be treated as ephemeral + # Add the final layer which will be treated as ephemeral self.add_layer('{}/delta0'.format(self.name)) def rebuild_config(self): + if not self.name: + return if len(self.layers) == 1: rootfs = self.layers[0] else: @@ -148,9 +150,23 @@ class LXCImage: subprocess.run([cmd]+self.layers, check=True) def copy_files(self, src, dst): - src = os.path.join(self.build_dir, src) dst = os.path.join(self.layers[-1], dst) - copy_tree(src, dst) + if src.startswith('http://') or src.startswith('https://'): + self.unpack_http_archive(src, dst) + else: + src = os.path.join(self.build_dir, src) + copy_tree(src, dst) + + def unpack_http_archive(self, src, dst): + xf = 'xzf' + if src.endswith('.bz2'): + xf = 'xjf' + elif src.endswith('.xz'): + xf = 'xJf' + with subprocess.Popen(['wget', src, '-O', '-'], stdout=subprocess.PIPE) as wget: + with subprocess.Popen(['tar', xf, '-', '-C', dst], stdin=wget.stdout) as tar: + wget.stdout.close() + tar.wait() def add_mount(self, type, src, dst): self.mounts.append('lxc.mount.entry = {} {} none bind,create={} 0 0'.format(src, dst, type.lower())) @@ -187,7 +203,7 @@ def copy_tree(src, dst): shutil.copystat(src, dst) if __name__ == '__main__': - if len(sys.argv) != 2: + if len(sys.argv) != 2 or sys.argv[1] in ('-h', '--help'): print('Usage: lxc-build \n where the buildpath can be either specific lxcfile or a directory containing one') else: i = LXCImage(sys.argv[1]) diff --git a/zz-build/usr/bin/lxc-pack b/_build/usr/bin/lxc-pack similarity index 59% rename from zz-build/usr/bin/lxc-pack rename to _build/usr/bin/lxc-pack index ecf331f..1b3f0a4 100755 --- a/zz-build/usr/bin/lxc-pack +++ b/_build/usr/bin/lxc-pack @@ -11,24 +11,28 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.serialization import load_pem_private_key -BUILD_ROOT = '/srv/build/lxc' +PKG_ROOT = '/srv/build/lxc' PRIVATE_KEY = '/srv/build/packages.key' LXC_ROOT = '/var/lib/lxc' -def pack(pkg_file): - if os.path.isdir(pkg_file): - pkg_file = os.path.join(pkg_file, 'pkg') - # Prepare metadata - meta = {} - with open(pkg_file) as f: - for line in f: - line = [l.strip() for l in line.split(':', 1)] - meta[line[0]] = line[1] - meta['deps'] = meta['deps'].split() - pkg_name = meta['pkg'] - del meta['pkg'] +def pack(path): + # Determine correct metadata file and package name + path = os.path.realpath(path) + if os.path.isdir(path): + meta_dir = path + meta_file = os.path.join(meta_dir, 'meta') + else: + meta_dir = os.path.dirname(path) + meta_file = path + pkg_name = os.path.basename(meta_dir) - tar_path = os.path.join(BUILD_ROOT, '{}.tar'.format(pkg_name)) + # Load metadata + with open(meta_file) as f: + meta = json.load(f) + + # Prepare package file names + os.makedirs(PKG_ROOT, 0o755, True) + tar_path = os.path.join(PKG_ROOT, '{}_{}-{}.tar'.format(pkg_name, meta['version'], meta['release'])) xz_path = '{}.xz'.format(tar_path) # Remove old package @@ -40,11 +44,10 @@ def pack(pkg_file): # Create archive print('Archiving', meta['lxcpath']) subprocess.run(['tar', '--xattrs', '-cpf', tar_path, os.path.join(LXC_ROOT, meta['lxcpath'])], cwd='/') - if '/' not in meta['lxcpath']: - # If lxcpath doesn't point to layer but is a full-featured container, pack also scripts - print('Archiving install/upgrade/uninstall scripts and related files') - cwd = os.path.dirname(os.path.abspath(pkg_file)) - subprocess.run(['tar', '--transform', 's|^|srv/{}/|'.format(pkg_name), '-rpf', tar_path, 'install', 'install.sh', 'upgrade', 'upgrade.sh', 'uninstall', 'uninstall.sh'], cwd=cwd) + # Add install/upgrade/uninstall scripts + scripts = ('install', 'install.sh', 'upgrade', 'upgrade.sh', 'uninstall', 'uninstall.sh') + scripts = [s for s in scripts if os.path.exists(os.path.join(meta_dir, s))] + subprocess.run(['tar', '--transform', 's|^|srv/{}/|'.format(pkg_name), '-rpf', tar_path] + scripts, cwd=meta_dir) # Compress the tarball with xz (LZMA2) print('Compressing', tar_path, '({:.2f} MB)'.format(os.path.getsize(tar_path)/1048576)) subprocess.run(['xz', '-9', tar_path]) @@ -53,7 +56,7 @@ def pack(pkg_file): # Register package print('Registering package') packages = {} - packages_file = os.path.join(BUILD_ROOT, 'packages') + packages_file = os.path.join(PKG_ROOT, 'packages') if os.path.exists(packages_file): with open(packages_file, 'r') as f: packages = json.load(f) @@ -63,13 +66,13 @@ def pack(pkg_file): with open(packages_file, 'w') as f: json.dump(packages, f, sort_keys=True, indent=4) - # Sign packages + # Sign packages file print('Signing packages') with open(PRIVATE_KEY, 'rb') as f: priv_key = load_pem_private_key(f.read(), None, default_backend()) - with open(os.path.join(BUILD_ROOT, 'packages'), 'rb') as f: + with open(os.path.join(PKG_ROOT, 'packages'), 'rb') as f: data = f.read() - with open(os.path.join(BUILD_ROOT, 'packages.sig'), 'wb') as f: + with open(os.path.join(PKG_ROOT, 'packages.sig'), 'wb') as f: f.write(priv_key.sign(data, ec.ECDSA(hashes.SHA512()))) def hash_file(file_path): @@ -83,7 +86,7 @@ def hash_file(file_path): return sha512.hexdigest() if __name__ == '__main__': - if len(sys.argv) != 2: - print('Usage: lxc-pack ') + if len(sys.argv) != 2 or sys.argv[1] in ('-h', '--help'): + print('Usage: lxc-pack \n where the buildpath can be either specific meta file or a directory containing one') else: pack(sys.argv[1]) diff --git a/zz-extra/frontlinesms-lang-js.py b/_extra/frontlinesms-lang-js.py similarity index 100% rename from zz-extra/frontlinesms-lang-js.py rename to _extra/frontlinesms-lang-js.py diff --git a/zz-extra/sahana-lang-csv.py b/_extra/sahana-lang-csv.py similarity index 100% rename from zz-extra/sahana-lang-csv.py rename to _extra/sahana-lang-csv.py diff --git a/zz-extra/vm-ping.php b/_extra/vm-ping.php similarity index 100% rename from zz-extra/vm-ping.php rename to _extra/vm-ping.php diff --git a/alpine.sh b/_vm.sh similarity index 90% rename from alpine.sh rename to _vm.sh index 0849511..c854ddb 100755 --- a/alpine.sh +++ b/_vm.sh @@ -14,8 +14,8 @@ echo # Set up repositories cat </etc/apk/repositories -http://dl-cdn.alpinelinux.org/alpine/v3.8/main -http://dl-cdn.alpinelinux.org/alpine/v3.8/community +http://dl-cdn.alpinelinux.org/alpine/v3.9/main +http://dl-cdn.alpinelinux.org/alpine/v3.9/community EOF # Install disk management tools @@ -84,9 +84,10 @@ chroot /mnt setup-timezone -z Europe/Prague # Install basic system apk --no-cache add apache2-utils gettext -wget https://dl.dasm.cz/basic.tar -O - | tar xf - -C /mnt -chroot /mnt apk --no-cache add ca-certificates curl bridge e2fsprogs-extra gettext iptables kbd-misc libressl postfix nginx util-linux acme-sh@vm lxc@vm vmmgr@vm +wget https://dl.dasm.cz/_vm.tar -O - | tar xf - -C /mnt +chroot /mnt apk --no-cache add ca-certificates curl bridge e2fsprogs-extra gettext iptables kbd-misc libressl lxc postfix nginx util-linux acme-sh@vm vmmgr@vm chroot /mnt newaliases +mkdir /mnt/var/log/lxc for SERVICE in cgroups consolefont crond iptables networking nginx ntpd postfix swap urandom vmmgr; do ln -s /etc/init.d/${SERVICE} /mnt/etc/runlevels/boot done diff --git a/basic/boot/extlinux.conf b/_vm/boot/extlinux.conf similarity index 100% rename from basic/boot/extlinux.conf rename to _vm/boot/extlinux.conf diff --git a/basic/boot/vm.txt b/_vm/boot/vm.txt similarity index 100% rename from basic/boot/vm.txt rename to _vm/boot/vm.txt diff --git a/basic/etc/apk/keys/repokey.rsa.pub b/_vm/etc/apk/keys/repokey.rsa.pub similarity index 100% rename from basic/etc/apk/keys/repokey.rsa.pub rename to _vm/etc/apk/keys/repokey.rsa.pub diff --git a/_vm/etc/apk/repositories b/_vm/etc/apk/repositories new file mode 100644 index 0000000..ac06fce --- /dev/null +++ b/_vm/etc/apk/repositories @@ -0,0 +1,3 @@ +http://dl-cdn.alpinelinux.org/alpine/v3.9/main +http://dl-cdn.alpinelinux.org/alpine/v3.9/community +@vm https://dl.dasm.cz/spotter-abuild diff --git a/basic/etc/conf.d/consolefont b/_vm/etc/conf.d/consolefont similarity index 100% rename from basic/etc/conf.d/consolefont rename to _vm/etc/conf.d/consolefont diff --git a/basic/etc/conf.d/iptables b/_vm/etc/conf.d/iptables similarity index 100% rename from basic/etc/conf.d/iptables rename to _vm/etc/conf.d/iptables diff --git a/basic/etc/hostname b/_vm/etc/hostname similarity index 100% rename from basic/etc/hostname rename to _vm/etc/hostname diff --git a/basic/etc/hosts b/_vm/etc/hosts similarity index 100% rename from basic/etc/hosts rename to _vm/etc/hosts diff --git a/basic/etc/inittab b/_vm/etc/inittab similarity index 100% rename from basic/etc/inittab rename to _vm/etc/inittab diff --git a/basic/etc/iptables/rules-save b/_vm/etc/iptables/rules-save similarity index 100% rename from basic/etc/iptables/rules-save rename to _vm/etc/iptables/rules-save diff --git a/basic/etc/network/interfaces b/_vm/etc/network/interfaces similarity index 100% rename from basic/etc/network/interfaces rename to _vm/etc/network/interfaces diff --git a/basic/etc/nginx/conf.d/default.conf b/_vm/etc/nginx/conf.d/default.conf similarity index 100% rename from basic/etc/nginx/conf.d/default.conf rename to _vm/etc/nginx/conf.d/default.conf diff --git a/basic/etc/nginx/nginx.conf b/_vm/etc/nginx/nginx.conf similarity index 100% rename from basic/etc/nginx/nginx.conf rename to _vm/etc/nginx/nginx.conf diff --git a/basic/etc/postfix/main.cf b/_vm/etc/postfix/main.cf similarity index 100% rename from basic/etc/postfix/main.cf rename to _vm/etc/postfix/main.cf diff --git a/basic/etc/rc.conf b/_vm/etc/rc.conf similarity index 100% rename from basic/etc/rc.conf rename to _vm/etc/rc.conf diff --git a/basic/etc/ssl/services.key b/_vm/etc/ssl/services.key similarity index 100% rename from basic/etc/ssl/services.key rename to _vm/etc/ssl/services.key diff --git a/basic/etc/ssl/services.pem b/_vm/etc/ssl/services.pem similarity index 100% rename from basic/etc/ssl/services.pem rename to _vm/etc/ssl/services.pem diff --git a/basic/sbin/extend-disk b/_vm/sbin/extend-disk similarity index 100% rename from basic/sbin/extend-disk rename to _vm/sbin/extend-disk diff --git a/basic/sbin/vmtty b/_vm/sbin/vmtty similarity index 100% rename from basic/sbin/vmtty rename to _vm/sbin/vmtty diff --git a/app-acme-sh/APKBUILD b/acme-sh/APKBUILD similarity index 62% rename from app-acme-sh/APKBUILD rename to acme-sh/APKBUILD index 499ab9f..01110d3 100644 --- a/app-acme-sh/APKBUILD +++ b/acme-sh/APKBUILD @@ -1,24 +1,28 @@ # Contributor: Disassembler # Maintainer: Disassembler pkgname=acme-sh -pkgver=2.7.9 +pkgver=2.8.0 pkgrel=0 -pkgdesc="A pure Unix shell script implementing ACME client protocol" +pkgdesc="A pure Unix shell ACME protocol client" url="https://github.com/Neilpang/acme.sh" arch="noarch" license="GPL" -_commit=4f59a821d33281ff5a3090cbe8de47c5f0ae10ce +_commit=f62a4a0c0ccf6cd73b5746dd8b8790ce3c512833 source="${pkgname}-${pkgver}.tar.gz::https://github.com/Neilpang/acme.sh/archive/${_commit}.tar.gz" builddir="${srcdir}/acme.sh-${_commit}" options="!check" +build() { + return 0 +} + package() { mkdir -p ${pkgdir}/usr/bin mkdir -p ${pkgdir}/etc/acme.sh.d mkdir -p ${pkgdir}/etc/periodic/daily sed 's|$HOME/.$PROJECT_NAME|/etc/acme.sh.d|' ${builddir}/acme.sh > ${pkgdir}/usr/bin/acme.sh chmod +x ${pkgdir}/usr/bin/acme.sh - cp source/acme-sh ${pkgdir}/etc/periodic/daily/ + cp ${startdir}/source/acme-sh ${pkgdir}/etc/periodic/daily/ } -sha512sums="93d38007c0c8187217ac220b09180c3a367a9b518d0bb777a58900de134f1afde54e6643c42426e18f65a18de0d77b0c685396b9c33198b927f0ce2b5da778d1 acme-sh-2.7.9.tar.gz" +sha512sums="399385c03954fb8c6c9be740ad46ed307ab1b902f88f4e7134fd837e4d189b387811469158fc05f1f8894f4622e5bbbec15ab4ef8eb433dd6dbfda585e7b25b7 acme-sh-2.8.0.tar.gz" diff --git a/app-acme-sh/source/acme-sh b/acme-sh/source/acme-sh similarity index 100% rename from app-acme-sh/source/acme-sh rename to acme-sh/source/acme-sh diff --git a/activemq/install.sh b/activemq/install.sh index 0aaa4b3..e86b9bb 100755 --- a/activemq/install.sh +++ b/activemq/install.sh @@ -10,5 +10,3 @@ chown -R 61616:61616 /srv/activemq/data # Create service cp etc/init.d/activemq /etc/init.d/activemq rc-update -u - -exit 0 diff --git a/activemq/lxcfile b/activemq/lxcfile index 00065d4..e51bf8c 100644 --- a/activemq/lxcfile +++ b/activemq/lxcfile @@ -1,6 +1,6 @@ IMAGE activemq -LAYER shared/alpine -LAYER shared/java +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 LAYER activemq/activemq RUN EOF diff --git a/activemq/meta b/activemq/meta new file mode 100644 index 0000000..80dd28c --- /dev/null +++ b/activemq/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "ActiveMQ", + "desc-en": "ActiveMQ", + "lxcpath": "activemq", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-java8"] +} diff --git a/activemq/pkg b/activemq/pkg deleted file mode 100644 index f75a047..0000000 --- a/activemq/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: activemq -lxcpath: activemq -version: 0.0.1 -deps: java diff --git a/activemq/uninstall.sh b/activemq/uninstall.sh index 9fa7832..4f48056 100755 --- a/activemq/uninstall.sh +++ b/activemq/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/activemq rc-update -u - -exit 0 diff --git a/basic-nodejs/lxcfile b/alpine3.8-nodejs8/lxcfile similarity index 50% rename from basic-nodejs/lxcfile rename to alpine3.8-nodejs8/lxcfile index cde2a13..ce8dbdf 100644 --- a/basic-nodejs/lxcfile +++ b/alpine3.8-nodejs8/lxcfile @@ -1,6 +1,6 @@ IMAGE build -LAYER shared/alpine -LAYER shared/nodejs +LAYER shared/alpine3.8 +LAYER shared/alpine3.8-nodejs8 RUN EOF apk --no-cache add nodejs diff --git a/alpine3.8-nodejs8/meta b/alpine3.8-nodejs8/meta new file mode 100644 index 0000000..b010912 --- /dev/null +++ b/alpine3.8-nodejs8/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro Node.js 8", + "desc-en": "Basic LXC layer with Node.js 8 runtime environment", + "lxcpath": "shared/alpine3.8-nodejs8", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.8"] +} diff --git a/alpine3.8-php5.6/lxcfile b/alpine3.8-php5.6/lxcfile new file mode 100644 index 0000000..6c4798b --- /dev/null +++ b/alpine3.8-php5.6/lxcfile @@ -0,0 +1,8 @@ +IMAGE build +LAYER shared/alpine3.8 +LAYER shared/alpine3.8-php5.6 + +RUN EOF + apk --no-cache add nginx php5 php5-ctype php5-fpm php5-gd php5-json php5-mcrypt php5-opcache + ln -s /usr/bin/php5 /usr/bin/php +EOF diff --git a/alpine3.8-php5.6/meta b/alpine3.8-php5.6/meta new file mode 100644 index 0000000..436cd06 --- /dev/null +++ b/alpine3.8-php5.6/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro PHP 5", + "desc-en": "Basic LXC layer with PHP 5 runtime environment", + "lxcpath": "shared/alpine3.8-php5.6", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.8"] +} diff --git a/basic-ruby/lxcfile b/alpine3.8-ruby2.4/lxcfile similarity index 94% rename from basic-ruby/lxcfile rename to alpine3.8-ruby2.4/lxcfile index 295b9e2..c390a84 100644 --- a/basic-ruby/lxcfile +++ b/alpine3.8-ruby2.4/lxcfile @@ -1,6 +1,6 @@ IMAGE build -LAYER shared/alpine -LAYER shared/ruby +LAYER shared/alpine3.8 +LAYER shared/alpine3.8-ruby2.4 RUN EOF # Install Ruby runtime dependencies diff --git a/alpine3.8-ruby2.4/meta b/alpine3.8-ruby2.4/meta new file mode 100644 index 0000000..aca5c56 --- /dev/null +++ b/alpine3.8-ruby2.4/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro Ruby 2.4", + "desc-en": "Basic LXC layer with Ruby 2.4 runtime environment", + "lxcpath": "shared/alpine3.8-ruby2.4", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.8"] +} diff --git a/alpine3.8/lxcfile b/alpine3.8/lxcfile new file mode 100644 index 0000000..3ddc05a --- /dev/null +++ b/alpine3.8/lxcfile @@ -0,0 +1,13 @@ +IMAGE build +LAYER shared/alpine3.8 +COPY https://github.com/gliderlabs/docker-alpine/raw/rootfs/library-3.8/x86_64/versions/library-3.8/x86_64/rootfs.tar.xz + +RUN EOF + # Add edge/testing repository + echo '@em http://dl-cdn.alpinelinux.org/alpine/edge/main' >>/etc/apk/repositories + echo '@et http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories + echo '@ec http://dl-cdn.alpinelinux.org/alpine/edge/community' >>/etc/apk/repositories + + # Install s6 supervisor + apk --no-cache add libxml2 libxslt s6@em +EOF diff --git a/alpine3.8/meta b/alpine3.8/meta new file mode 100644 index 0000000..f9f8724 --- /dev/null +++ b/alpine3.8/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s Alpine linuxem", + "desc-en": "Basic LXC layer with Alpine linux", + "lxcpath": "shared/alpine3.8", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": [] +} diff --git a/basic-java/lxcfile b/alpine3.9-java8/lxcfile similarity index 55% rename from basic-java/lxcfile rename to alpine3.9-java8/lxcfile index 3c49efe..1285d5e 100644 --- a/basic-java/lxcfile +++ b/alpine3.9-java8/lxcfile @@ -1,6 +1,6 @@ IMAGE build -LAYER shared/alpine -LAYER shared/java +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 RUN EOF apk --no-cache add openjdk8-jre-base diff --git a/alpine3.9-java8/meta b/alpine3.9-java8/meta new file mode 100644 index 0000000..8b3a3b9 --- /dev/null +++ b/alpine3.9-java8/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro Javu", + "desc-en": "Basic LXC layer with Java runtime environment", + "lxcpath": "shared/alpine3.9-java8", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/alpine3.9-nodejs10/lxcfile b/alpine3.9-nodejs10/lxcfile new file mode 100644 index 0000000..ca88e53 --- /dev/null +++ b/alpine3.9-nodejs10/lxcfile @@ -0,0 +1,7 @@ +IMAGE build +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-nodejs10 + +RUN EOF + apk --no-cache add nodejs +EOF diff --git a/alpine3.9-nodejs10/meta b/alpine3.9-nodejs10/meta new file mode 100644 index 0000000..8272507 --- /dev/null +++ b/alpine3.9-nodejs10/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro Node.js 10", + "desc-en": "Basic LXC layer with Node.js 10 runtime environment", + "lxcpath": "shared/alpine3.9-nodejs10", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/basic-php/lxcfile b/alpine3.9-php7.2/lxcfile similarity index 73% rename from basic-php/lxcfile rename to alpine3.9-php7.2/lxcfile index 912e547..02519a9 100644 --- a/basic-php/lxcfile +++ b/alpine3.9-php7.2/lxcfile @@ -1,6 +1,6 @@ IMAGE build -LAYER shared/alpine -LAYER shared/php +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-php7.2 RUN EOF apk --no-cache add nginx php7 php7-ctype php7-fpm php7-gd php7-json php7-mbstring php7-mcrypt php7-opcache php7-session diff --git a/alpine3.9-php7.2/meta b/alpine3.9-php7.2/meta new file mode 100644 index 0000000..d4d674d --- /dev/null +++ b/alpine3.9-php7.2/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro PHP 7", + "desc-en": "Basic LXC layer with PHP 7 runtime environment", + "lxcpath": "shared/alpine3.9-php7.2", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/alpine3.9-python2.7/lxcfile b/alpine3.9-python2.7/lxcfile new file mode 100644 index 0000000..6de6f11 --- /dev/null +++ b/alpine3.9-python2.7/lxcfile @@ -0,0 +1,7 @@ +IMAGE build +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 + +RUN EOF + apk --no-cache add python2 +EOF diff --git a/alpine3.9-python2.7/meta b/alpine3.9-python2.7/meta new file mode 100644 index 0000000..63dd5e3 --- /dev/null +++ b/alpine3.9-python2.7/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro python 2", + "desc-en": "Basic LXC layer with python 2 runtime environment", + "lxcpath": "shared/alpine3.9-python2.7", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/basic-python3/lxcfile b/alpine3.9-python3.6/lxcfile similarity index 61% rename from basic-python3/lxcfile rename to alpine3.9-python3.6/lxcfile index 46b840a..0ed3a03 100644 --- a/basic-python3/lxcfile +++ b/alpine3.9-python3.6/lxcfile @@ -1,7 +1,6 @@ IMAGE build -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python3 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python3.6 RUN EOF apk --no-cache add python3 diff --git a/alpine3.9-python3.6/meta b/alpine3.9-python3.6/meta new file mode 100644 index 0000000..df9ebb4 --- /dev/null +++ b/alpine3.9-python3.6/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro python 3", + "desc-en": "Basic LXC layer with python 3 runtime environment", + "lxcpath": "shared/alpine3.9-python3.6", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/alpine3.9-ruby2.4/lxcfile b/alpine3.9-ruby2.4/lxcfile new file mode 100644 index 0000000..c0c034c --- /dev/null +++ b/alpine3.9-ruby2.4/lxcfile @@ -0,0 +1,33 @@ +IMAGE build +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-ruby2.4 + +RUN EOF + # Install Ruby runtime dependencies + apk --no-cache add gdbm libressl readline zlib + + # Install Ruby build dependencies + apk --no-cache add --virtual .deps build-base autoconf gdbm-dev libressl-dev linux-headers readline-dev zlib-dev + + # Download and unpack Ruby + mkdir -p /usr/src/ruby + wget http://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.5.tar.xz -O - | tar xJf - -C /usr/src/ruby --strip-components=1 + + # Compile and install Ruby + cd /usr/src/ruby + autoconf + ./configure --build=x86_64-linux-musl --disable-install-doc --enable-shared + make -j $(getconf _NPROCESSORS_ONLN) + make install + + # Install RubyGems and Bundler + mkdir -p /usr/local/etc + echo -e 'install: --no-document\nupdate: --no-document' >/usr/local/etc/gemrc + gem update --system + + # Cleanup + apk --no-cache del .deps + cd /root + rm -r /usr/src/ruby + rm -rf /root/.gem +EOF diff --git a/alpine3.9-ruby2.4/meta b/alpine3.9-ruby2.4/meta new file mode 100644 index 0000000..66bfb39 --- /dev/null +++ b/alpine3.9-ruby2.4/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s běhovým prostředím pro Ruby 2.4", + "desc-en": "Basic LXC layer with Ruby 2.4 runtime environment", + "lxcpath": "shared/alpine3.9-ruby2.4", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/basic-tomcat/lxc/srv/tomcat/bin/setenv.sh b/alpine3.9-tomcat8/lxc/srv/tomcat/bin/setenv.sh similarity index 100% rename from basic-tomcat/lxc/srv/tomcat/bin/setenv.sh rename to alpine3.9-tomcat8/lxc/srv/tomcat/bin/setenv.sh diff --git a/basic-tomcat/lxc/srv/tomcat/conf/logging.properties b/alpine3.9-tomcat8/lxc/srv/tomcat/conf/logging.properties similarity index 100% rename from basic-tomcat/lxc/srv/tomcat/conf/logging.properties rename to alpine3.9-tomcat8/lxc/srv/tomcat/conf/logging.properties diff --git a/basic-tomcat/lxcfile b/alpine3.9-tomcat8/lxcfile similarity index 64% rename from basic-tomcat/lxcfile rename to alpine3.9-tomcat8/lxcfile index 400ed6c..cb2610d 100644 --- a/basic-tomcat/lxcfile +++ b/alpine3.9-tomcat8/lxcfile @@ -1,11 +1,11 @@ IMAGE build -LAYER shared/alpine -LAYER shared/java -LAYER shared/tomcat +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-tomcat8 RUN EOF # Install Tomcat 8 - wget http://mirror.hosting90.cz/apache/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz -O - | tar xzf - -C /srv + wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz -O - | tar xzf - -C /srv mv /srv/apache-tomcat-8.0.53 /srv/tomcat # Make catalina.sh available globally diff --git a/alpine3.9-tomcat8/meta b/alpine3.9-tomcat8/meta new file mode 100644 index 0000000..512f2b1 --- /dev/null +++ b/alpine3.9-tomcat8/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s JSP a servlet kontejnerem Tomcat 8", + "desc-en": "Basic LXC layer with Tomcat 8 JSP and servlet container", + "lxcpath": "shared/alpine3.9-tomcat8", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-java8"] +} diff --git a/basic-alpine/lxcfile b/alpine3.9/lxcfile similarity index 65% rename from basic-alpine/lxcfile rename to alpine3.9/lxcfile index 74f0702..fd61975 100644 --- a/basic-alpine/lxcfile +++ b/alpine3.9/lxcfile @@ -1,5 +1,6 @@ IMAGE build -LAYER shared/alpine +LAYER shared/alpine3.9 +COPY https://github.com/gliderlabs/docker-alpine/raw/rootfs/library-3.9/x86_64/versions/library-3.9/x86_64/rootfs.tar.xz RUN EOF # Add edge/testing repository @@ -8,5 +9,5 @@ RUN EOF echo '@ec http://dl-cdn.alpinelinux.org/alpine/edge/community' >>/etc/apk/repositories # Install s6 supervisor - apk --no-cache add s6@em + apk --no-cache add libxml2 libxslt s6 EOF diff --git a/alpine3.9/meta b/alpine3.9/meta new file mode 100644 index 0000000..2a8b758 --- /dev/null +++ b/alpine3.9/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Základní LXC vrstva s Alpine linuxem", + "desc-en": "Basic LXC layer with Alpine linux", + "lxcpath": "shared/alpine3.9", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": [] +} diff --git a/app-lxc/APKBUILD b/app-lxc/APKBUILD deleted file mode 100644 index d2bf84f..0000000 --- a/app-lxc/APKBUILD +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor: Disassembler -# Maintainer: Disassembler -pkgname=lxc -pkgver=3.0.3 -pkgrel=0 -pkgdesc="Userspace interface for the Linux kernel containment features" -url="https://linuxcontainers.org/lxc/" -arch="x86_64" -license="GPL" -options="suid !check" -makedepends="automake autoconf bsd-compat-headers libcap-dev libseccomp-dev libtool linux-headers" -_commit=b8ab4849432cd64d789a757e385d1d324d88a61d -source="${pkgname}-${pkgver}.tar.gz::https://github.com/lxc/lxc/archive/${_commit}.tar.gz" -builddir="${srcdir}/${pkgname}-${_commit}" - -build() { - cd ${builddir} - ./autogen.sh - ./configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-apparmor \ - --with-distro=alpine \ - --disable-werror - make -} - -package() { - cd ${builddir} - make DESTDIR=${pkgdir} install - rm -rf ${pkgdir}/usr/include/ - rm -rf ${pkgdir}/usr/lib/liblxc.a - rm -rf ${pkgdir}/usr/lib/liblxc.la - rm -rf ${pkgdir}/usr/lib/pkgconfig/ - rm -rf ${pkgdir}/usr/share/doc/ - rm -rf ${pkgdir}/usr/share/lxc/selinux/ - rm -rf ${pkgdir}/usr/share/lxc/templates/ - rm -rf ${pkgdir}/usr/share/man/ - mkdir -p ${pkgdir}/var/log/lxc/ -} - -sha512sums="ef62f93799a14ba0e1b2fdbb4f69f8b531aef8eeecf537e2a08be3f30147484729bd41fa65e9ea5519c1c1f0e6f8940aac41ca5b749f89529a5b970e4ea0095c lxc-3.0.3.tar.gz" diff --git a/app-vmmgr b/app-vmmgr deleted file mode 160000 index be5e95d..0000000 --- a/app-vmmgr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit be5e95d5c0389ef024359cf4885a0a5792363c05 diff --git a/basic-alpine/pkg b/basic-alpine/pkg deleted file mode 100644 index d20edc2..0000000 --- a/basic-alpine/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: alpine -lxcpath: shared/alpine -version: 0.0.1 -deps: diff --git a/basic-java/pkg b/basic-java/pkg deleted file mode 100644 index 997ed2d..0000000 --- a/basic-java/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: java -lxcpath: shared/java -version: 0.0.1 -deps: alpine diff --git a/basic-libxml/lxcfile b/basic-libxml/lxcfile deleted file mode 100644 index 7de2b67..0000000 --- a/basic-libxml/lxcfile +++ /dev/null @@ -1,7 +0,0 @@ -IMAGE build -LAYER shared/alpine -LAYER shared/libxml - -RUN EOF - apk --no-cache add libxml2 libxslt -EOF diff --git a/basic-libxml/pkg b/basic-libxml/pkg deleted file mode 100644 index 3db35f3..0000000 --- a/basic-libxml/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: libxml -lxcpath: shared/libxml -version: 0.0.1 -deps: alpine diff --git a/basic-nodejs/pkg b/basic-nodejs/pkg deleted file mode 100644 index 3f3b31e..0000000 --- a/basic-nodejs/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: nodejs -lxcpath: shared/nodejs -version: 0.0.1 -deps: alpine diff --git a/basic-php/pkg b/basic-php/pkg deleted file mode 100644 index 44cc008..0000000 --- a/basic-php/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: php -lxcpath: shared/php -version: 0.0.1 -deps: alpine diff --git a/basic-python2/lxcfile b/basic-python2/lxcfile deleted file mode 100644 index dd3efce..0000000 --- a/basic-python2/lxcfile +++ /dev/null @@ -1,8 +0,0 @@ -IMAGE build -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 - -RUN EOF - apk --no-cache add python2 -EOF diff --git a/basic-python2/pkg b/basic-python2/pkg deleted file mode 100644 index 9bdd73e..0000000 --- a/basic-python2/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: python2 -lxcpath: shared/python2 -version: 0.0.1 -deps: libxml diff --git a/basic-python3/pkg b/basic-python3/pkg deleted file mode 100644 index 6a58df0..0000000 --- a/basic-python3/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: python3 -lxcpath: shared/python3 -version: 0.0.1 -deps: libxml diff --git a/basic-ruby/pkg b/basic-ruby/pkg deleted file mode 100644 index 1a384ae..0000000 --- a/basic-ruby/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: ruby -lxcpath: shared/ruby -version: 0.0.1 -deps: alpine diff --git a/basic-tomcat/pkg b/basic-tomcat/pkg deleted file mode 100644 index 6719cd6..0000000 --- a/basic-tomcat/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: tomcat -lxcpath: shared/tomcat -version: 0.0.1 -deps: java diff --git a/basic/etc/apk/repositories b/basic/etc/apk/repositories deleted file mode 100644 index 7016916..0000000 --- a/basic/etc/apk/repositories +++ /dev/null @@ -1,3 +0,0 @@ -http://dl-cdn.alpinelinux.org/alpine/v3.8/main -http://dl-cdn.alpinelinux.org/alpine/v3.8/community -@vm https://dl.dasm.cz/spotter-abuild diff --git a/basic/etc/conf.d/ntpd b/basic/etc/conf.d/ntpd deleted file mode 100644 index 91c628c..0000000 --- a/basic/etc/conf.d/ntpd +++ /dev/null @@ -1 +0,0 @@ -NTPD_OPTS="-N -p tik.cesnet.cz -p tak.cesnet.cz" diff --git a/ckan-datapusher/install.sh b/ckan-datapusher/install.sh index 860e962..194f062 100755 --- a/ckan-datapusher/install.sh +++ b/ckan-datapusher/install.sh @@ -15,5 +15,3 @@ rc-update -u # Install config update script cp srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh - -exit 0 diff --git a/ckan-datapusher/lxcfile b/ckan-datapusher/lxcfile index 63a1399..fca383a 100644 --- a/ckan-datapusher/lxcfile +++ b/ckan-datapusher/lxcfile @@ -1,7 +1,6 @@ IMAGE ckan-datapusher -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER ckan-datapusher/ckan-datapusher RUN EOF diff --git a/ckan-datapusher/meta b/ckan-datapusher/meta new file mode 100644 index 0000000..dfe0675 --- /dev/null +++ b/ckan-datapusher/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Služba datového skladu pro extrakci dat", + "desc-en": "Data store data extraction service", + "lxcpath": "ckan-datapusher", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python2.7"] +} diff --git a/ckan-datapusher/pkg b/ckan-datapusher/pkg deleted file mode 100644 index e8a6794..0000000 --- a/ckan-datapusher/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: ckan-datapusher -lxcpath: ckan-datapusher -version: 0.0.1 -deps: python2 diff --git a/ckan-datapusher/uninstall.sh b/ckan-datapusher/uninstall.sh index c549b47..8f2de9e 100755 --- a/ckan-datapusher/uninstall.sh +++ b/ckan-datapusher/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/ckan-datapusher rc-update -u - -exit 0 diff --git a/ckan/install.sh b/ckan/install.sh index 0b5a30d..1bef8ab 100755 --- a/ckan/install.sh +++ b/ckan/install.sh @@ -64,5 +64,3 @@ cp srv/ckan/update-conf.sh /srv/ckan/update-conf.sh # Register application vmmgr register-app ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" - -exit 0 diff --git a/ckan/lxcfile b/ckan/lxcfile index 537df2b..4f10357 100644 --- a/ckan/lxcfile +++ b/ckan/lxcfile @@ -1,7 +1,6 @@ IMAGE ckan -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER ckan/ckan RUN EOF @@ -31,6 +30,7 @@ RUN EOF pip install -e 'git+https://github.com/aptivate/ckanext-datasetthumbnail#egg=ckanext_datasetthumbnail' pip install -e 'git+https://github.com/datagvat/ckanext-dgvat_xls#egg=ckanext_dgvat_xls' pip install -r /srv/ckan/src/ckanext-spatial/pip-requirements.txt + pip install -r /srv/ckan/src/ckanext-geoview/pip-requirements.txt pip install -r /srv/ckan/src/ckanext-dgvat-xls/requirements.txt # Create OS user diff --git a/ckan/meta b/ckan/meta new file mode 100644 index 0000000..da7c74b --- /dev/null +++ b/ckan/meta @@ -0,0 +1,10 @@ +{ + "title": "CKAN", + "desc-cs": "Datový sklad", + "desc-en": "Data store", + "lxcpath": "ckan", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python2.7", "ckan-datapusher", "postgres", "redis", "solr"] +} diff --git a/ckan/pkg b/ckan/pkg deleted file mode 100644 index d4cef9c..0000000 --- a/ckan/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: ckan -title: CKAN -lxcpath: ckan -desc: Datový sklad -host: ckan -version: 0.0.1 -deps: python2 ckan-datapusher postgres redis solr diff --git a/ckan/uninstall.sh b/ckan/uninstall.sh index 5b24c38..1454828 100755 --- a/ckan/uninstall.sh +++ b/ckan/uninstall.sh @@ -23,4 +23,5 @@ lxc-attach redis -- redis-cli -n 0 flushdb rm -rf /srv/solr/data/ckan [ ! -z ${START_SOLR} ] && service solr start -exit 0 +# Unregister application +vmmgr unregister-app ckan diff --git a/crisiscleanup/install.sh b/crisiscleanup/install.sh index 153bd35..5026030 100755 --- a/crisiscleanup/install.sh +++ b/crisiscleanup/install.sh @@ -41,5 +41,3 @@ cp srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh # Register application vmmgr register-app crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}" - -exit 0 diff --git a/crisiscleanup/lxcfile b/crisiscleanup/lxcfile index c84d2b2..93a6c3c 100644 --- a/crisiscleanup/lxcfile +++ b/crisiscleanup/lxcfile @@ -1,8 +1,7 @@ IMAGE crisiscleanup -LAYER shared/alpine -LAYER shared/ruby -LAYER shared/nodejs -LAYER shared/libxml +LAYER shared/alpine3.8 +LAYER shared/alpine3.8-ruby2.4 +LAYER shared/alpine3.8-nodejs8 LAYER crisiscleanup/crisiscleanup FIXLAYER /usr/bin/fix-apk @@ -19,7 +18,7 @@ RUN EOF # Clone CrisisCleanup git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup - # Hackfix ruby dependency version + # Hackfix ruby dependency versions sed -i 's/2\.4\.4/2.4.5/' /srv/crisiscleanup/Gemfile # Install Ruby and NodeJS dependencies diff --git a/crisiscleanup/meta b/crisiscleanup/meta new file mode 100644 index 0000000..082d993 --- /dev/null +++ b/crisiscleanup/meta @@ -0,0 +1,10 @@ +{ + "title": "Crisis Cleanup", + "desc-cs": "Mapování následků katastrof", + "desc-en": "Disaster relief mapping", + "lxcpath": "crisiscleanup", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-ruby2.4", "alpine3.9-nodejs10", "postgres"] +} diff --git a/crisiscleanup/pkg b/crisiscleanup/pkg deleted file mode 100644 index 757af74..0000000 --- a/crisiscleanup/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: crisiscleanup -title: Crisis Cleanup -lxcpath: crisiscleanup -desc: Mapování následků katastrof -host: cc -version: 0.0.1 -deps: ruby nodejs libxml postgres diff --git a/crisiscleanup/uninstall.sh b/crisiscleanup/uninstall.sh index 8100ced..bc943ab 100755 --- a/crisiscleanup/uninstall.sh +++ b/crisiscleanup/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS crisiscleanup; DROP ROLE IF EXISTS crisiscleanup;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app crisiscleanup diff --git a/cts/install.sh b/cts/install.sh index 8f14b10..a517dbe 100755 --- a/cts/install.sh +++ b/cts/install.sh @@ -46,5 +46,3 @@ cp srv/cts/update-conf.sh /srv/cts/update-conf.sh # Register application vmmgr register-app cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}" - -exit 0 diff --git a/cts/lxcfile b/cts/lxcfile index a765630..43871d2 100644 --- a/cts/lxcfile +++ b/cts/lxcfile @@ -1,7 +1,6 @@ IMAGE cts -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER cts/cts RUN EOF diff --git a/cts/meta b/cts/meta new file mode 100644 index 0000000..df1550e --- /dev/null +++ b/cts/meta @@ -0,0 +1,10 @@ +{ + "title": "CTS", + "desc-cs": "Sledovací systém komodit", + "desc-en": "Commodity tracking system", + "lxcpath": "cts", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python2.7", "postgres"] +} diff --git a/cts/pkg b/cts/pkg deleted file mode 100644 index c29f501..0000000 --- a/cts/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: cts -title: CTS -lxcpath: cts -desc: Sledovací systém komodit -host: cts -version: 0.0.1 -deps: python2 postgres diff --git a/cts/uninstall.sh b/cts/uninstall.sh index c66b38e..74bf4a0 100755 --- a/cts/uninstall.sh +++ b/cts/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS cts; DROP ROLE IF EXISTS cts;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app cts diff --git a/ecogis/install.sh b/ecogis/install.sh new file mode 100755 index 0000000..45b3d2d --- /dev/null +++ b/ecogis/install.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -ev + +cd $(realpath $(dirname "${0}"))/install + +# Check prerequisites +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 + +# Populate database +export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64) +envsubst /srv/ecogis/conf/config.php +chown -R 8020:8020 /srv/ecogis/conf + +# Install service +cp etc/init.d/ecogis /etc/init.d/ecogis +rc-update -u + +# Stop services required for build +[ ! -z ${STOP_POSTGRES} ] && service postgres stop + +# Register application +vmmgr register-app ecogis diff --git a/ecogis/install/createdb.sql b/ecogis/install/createdb.sql new file mode 100644 index 0000000..ee57719 --- /dev/null +++ b/ecogis/install/createdb.sql @@ -0,0 +1,4 @@ +CREATE ROLE ecogis NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${ECOGIS_PWD}'; +CREATE DATABASE ecogis; +REVOKE ALL ON DATABASE ecogis FROM public; +ALTER DATABASE ecogis OWNER TO ecogis; diff --git a/ecogis/install/etc/init.d/ecogis b/ecogis/install/etc/init.d/ecogis new file mode 100755 index 0000000..0350868 --- /dev/null +++ b/ecogis/install/etc/init.d/ecogis @@ -0,0 +1,23 @@ +#!/sbin/openrc-run + +description="EcoGIS container" + +depend() { + need postgres +} + +start() { + lxc-start ecogis +} + +start_post() { + /usr/bin/vmmgr register-proxy ecogis +} + +stop_pre() { + /usr/bin/vmmgr unregister-proxy ecogis +} + +stop() { + lxc-stop ecogis +} diff --git a/ecogis/install/srv/ecogis/conf/config.php b/ecogis/install/srv/ecogis/conf/config.php new file mode 100644 index 0000000..687ed7d --- /dev/null +++ b/ecogis/install/srv/ecogis/conf/config.php @@ -0,0 +1,320 @@ + 'pgsql', + 'dbhost' => 'postgres', // host + 'dbuser' => 'ecogis', // login + 'dbpass' => '${ECOGIS_PWD}', // Password + 'dbname' => 'ecogis', // database + 'persistent' => false, // Persistent connection + 'charset' => 'UTF-8', // Charset to use + 'search_path' => 'ecogis'); + + +/* ------------------------------ Basic Parameters -------------------------- */ + +define('R3_IS_MULTIDOMAIN', false); // MULTI DOMAIN CONFIGURATION +define('APPLICATION_CODE', 'ECOGIS2'); +define('DEFAULT_DOMAIN', 'DEMO'); // Default domain if no @ given +define('DOMAIN_NAME', 'DEMO'); + +// - Static Paths +define('R3_APP_ROOT', substr(dirname(__FILE__), 0, -3)); +define('R3_CONFIG_DIR', R3_APP_ROOT . 'etc/'); +define('R3_LIB_DIR', R3_APP_ROOT . 'lib/'); +define('R3_LOG_DIR', R3_APP_ROOT . 'log/'); +define('R3_CLASS_DIR', R3_APP_ROOT . 'class/'); +define('R3_STAT_CLASS_DIR', R3_APP_ROOT . 'class/stat/'); +define('R3_LOOKUP_DIR', R3_CLASS_DIR . 'lookup/'); +define('R3_LANG_DIR', R3_APP_ROOT . 'lang/'); +define('R3_TMP_DIR', R3_APP_ROOT . 'tmp/'); +define('R3_WEB_DIR', R3_APP_ROOT . 'web/'); +define('R3_WEB_ADMIN_DIR', R3_WEB_DIR . 'admin/'); +define('R3_WEB_IMAGES_DIR', R3_WEB_DIR . 'images/'); +define('R3_WEB_STYLES_DIR', R3_WEB_DIR . 'style/'); +define('R3_CACHE_DIR', R3_APP_ROOT . 'cache/'); +define('R3_WEB_JS_DIR', R3_WEB_DIR . 'javascript/'); +define('R3_WEB_CSS_DIR', R3_WEB_DIR . 'style/'); +define('R3_UPLOAD_DIR', R3_APP_ROOT . 'upload/'); +define('R3_UPLOAD_DATA_DIR', R3_UPLOAD_DIR . 'data/'); + +define('R3_IMPORT_SCHEMA', 'impexp'); + +define('R3_AUTO_POPULATE_GEOMETRY_COLUMNS', false); // If true the geometry columns and srid are populated on customer save +define('R3_AUTO_SAVE_DATABASE_VERSION', false); // If true the geometry columns and srid are populated on customer save + +define('R3_SINGLE_JS', true); // If true use a single JS file + +define('R3_UM_JQUERY', true); +//define('R3_EZC_DIR', '/usr/share/pear/ezc'); +//define('R3_PHPEXCEL_DIR', '/usr/share/pear/PHPExcel'); +//define('R3_PHPEXCEL_DIR', R3_LIB_DIR . '/PHPExcel/PHPExcel'); +//echo R3_PHPEXCEL_DIR; + +define("CACHE_DIR_LIMIT", 1000); // Numero massimo di file nella cache +define("CACHE_MASK", '%08d'); // Maschera da usare per la cache +define("CACHE_EXT", '.png'); // Estensione per la cache +// - Static URL's +if (isset($_SERVER['SERVER_NAME'])) { + if ((isset($_SERVER['HTTPS']) && (strtoupper($_SERVER['HTTPS']) == 'ON' || $_SERVER['HTTPS'] == 1)) || $_SERVER['SERVER_PORT'] == '443') { + define('R3_DOMAIN_URL', 'https://' . $_SERVER['SERVER_NAME'] . '/'); + } else { + define('R3_DOMAIN_URL', 'http://' . ($_SERVER['SERVER_PORT'] == '80' ? $_SERVER['SERVER_NAME'] : $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . '/'); + } + define('R3_APP_URL', R3_DOMAIN_URL . ""); // online should be empty (not /) + define('R3_ADMIN_URL', R3_APP_URL . "admin/"); + define('R3_MAP_URL', R3_APP_URL . "map/"); + define('R3_CACHE_URL', R3_APP_URL . "cache/"); + define('R3_JS_URL', R3_APP_URL . "javascript/"); + define('R3_CSS_URL', R3_APP_URL . "style/"); + define('R3_IMAGES_URL', R3_APP_URL . "images/"); + define('R3_ICONS_URL', R3_APP_URL . "images/icons/"); + define('R3_REST_URL', R3_APP_URL . "rest/"); +} else { + define('R3_APP_URL', ''); + define('R3_IMAGES_URL', ''); +} + +define('R3_FOP_CMD', '/usr/local/fop/fop'); +define('GZIP_PHP_PAGE', false); + + +/* ------------------------------ Error manager ------------------------------ */ + +define('R3_ERROR_SCREEN', true); +define('R3_ERROR_SCREEN_BACKTRACE', true); +define('R3_ERROR_SYSLOG', false); +define('R3_ERROR_ERRLOG', true); +define('R3_ERROR_MAIL', false); +define('R3_ERROR_MAIL_ADDR', ''); +define('R3_ERROR_MAX_EMAIL', 10); +require_once R3_LIB_DIR . 'r3error.php'; + + +/* ------------------------------ Charset Settings ------------------------------ */ + +define('R3_APP_CHARSET', 'UTF-8'); +define('R3_APP_CHARSET_DB', 'UTF-8'); + + +/* ------------------------------ Simpletable Settings ------------------------------ */ + +define('R3SIMPLETABLE_VERSION_SUPPORT', '1.1.7'); + + +/* ------------------------------ Build version ----------------------------- */ + +define('BUILD', 'build-' . '0001'); + + +/* ------------------------------ Smarty Settings ------------------------------ */ + +//define('R3_SMARTY_ROOT_DIR', '/usr/share/php/Smarty/'); +define('R3_SMARTY_TEMPLATE_DIR', R3_APP_ROOT . 'templates/'); +define('R3_SMARTY_TEMPLATE_C_DIR', R3_APP_ROOT . 'templates_c/'); +define('R3_SMARTY_TEMPLATE_DIR_ADMIN', R3_SMARTY_TEMPLATE_DIR . 'admin/'); +define('R3_SMARTY_TEMPLATE_C_DIR_ADMIN', R3_SMARTY_TEMPLATE_C_DIR . 'admin/'); +define('R3_SMARTY_TEMPLATE_DIR_PUBLIC', R3_SMARTY_TEMPLATE_DIR . 'public/'); +define('R3_SMARTY_TEMPLATE_C_DIR_PUBLIC', R3_SMARTY_TEMPLATE_C_DIR . 'public/'); +define('R3_SMARTY_TEMPLATE_DIR_MAP', R3_SMARTY_TEMPLATE_DIR . 'map/'); +define('R3_SMARTY_TEMPLATE_C_DIR_MAP', R3_SMARTY_TEMPLATE_C_DIR . 'map/'); +define('R3_SMARTY_TEMPLATE_DIR_XML', R3_SMARTY_TEMPLATE_DIR . 'xml/'); +define('R3_SMARTY_TEMPLATE_C_DIR_XML', R3_SMARTY_TEMPLATE_C_DIR . 'xml/'); +define('R3_SMARTY_TEMPLATE_DIR_DOC', R3_SMARTY_TEMPLATE_DIR . 'doc/'); +define('R3_SMARTY_TEMPLATE_C_DIR_DOC', R3_SMARTY_TEMPLATE_C_DIR . 'doc/'); +define('R3_SMARTY_TEMPLATE_DIR_HELP', R3_SMARTY_TEMPLATE_DIR . 'help/'); +define('R3_SMARTY_TEMPLATE_DIR_EMAIL', R3_SMARTY_TEMPLATE_DIR . 'email/'); +define('R3_SMARTY_TEMPLATE_C_DIR_EMAIL', R3_SMARTY_TEMPLATE_C_DIR . 'email/'); +//define('R3_SMARTY_PLUGIN_DIR', '/data/sites/r3-common/smarty/plugins/'); + +define('R3_DB_SCHEMA', 'ecogis'); +define('R3_COMMON_SCHEMA', 'common'); +define('R3_EXPORT_SCHEMA', 'impexp'); +define('R3_TEMPORARY_FILE_TTL', 24 * 60 * 60); + +$languages = array(1 => 'it', 2 => 'de'); +$jQueryDateFormat = array('it' => 'dd/mm/yy', 'de' => 'dd.mm.yy'); +$phpDateFormat = array('it' => 'd/m/Y', 'de' => 'd.m.Y'); +$phpDateTimeFormat = array('it' => 'd/m/Y H:i:s', 'de' => 'd.m.Y H:i:s'); + +/* ------------------------------ GisClient ------------------------------------- */ +if (defined('R3_APP_URL')) { + define('GISCLIENT', true); + define('GC_PRINT_TPL_DIR', R3_APP_ROOT . 'web/admin/gisclient/'); + define('GC_MODULES_URL', R3_APP_URL . 'admin/gisclient_modules/'); + define('GC_PREVIEWMAP_SLD_FOLDER_URL', R3_APP_URL . 'sld/'); + define('GC_PREVIEWMAP_SLD_FOLDER_DIR', R3_APP_ROOT . 'web/sld/'); + define('GC_PREVIEWMAP_AUTO_SLD_FOLDER_URL', R3_APP_URL . 'cache/mappreview/sld/'); + define('GC_PREVIEWMAP_AUTO_SLD_FOLDER_DIR', R3_APP_ROOT . 'web/cache/mappreview/sld/'); + define('R3_WEB_TMP_URL', R3_APP_URL . 'cache/print/'); // print tmp + define('R3_WEB_TMP_DIR', R3_APP_ROOT . 'web/cache/print/'); // print tmp +} + +define('GC_PREVIEW_MAP_LAYERGROUP_LIST', null); + +$auth_options = array('settings_table' => 'auth.settings', + 'applications_table' => 'auth.applications', + 'users_groups_table' => 'auth.users_groups', + 'users_table' => 'auth.users', + 'domains_table' => 'auth.domains', + 'application_code' => APPLICATION_CODE, + 'groups_table' => 'auth.groups', + 'groups_acl_table' => 'auth.groups_acl', + 'users_acl_table' => 'auth.users_acl', + 'users_ip_table' => 'auth.users_ip', + 'domains_applications_table' => 'auth.domains_applications', + 'domains_name_table' => 'auth.domains_name', + 'acnames_table' => 'auth.acnames', + 'log_table' => 'auth.logs', + 'table' => 'auth.users', + 'usernamecol' => 'us_login', + 'passwordcol' => 'us_password', + 'cryptType' => 'md5', + 'auto_quote' => false, + 'db_where' => '1=1', + 'enable_logging' => true, + 'access_log_lifetime' => -1, + 'login_log_lifetime' => -1, + 'update_status_skip_time' => 5 * 60, + 'debug' => false, + 'result_buffering' => false +); + + + +/* ------------------------------ Session Settings ------------------------------ */ + +$sessionOpt = array('name' => APPLICATION_CODE, + 'timeout' => 24 * 60 * 60, + 'warning_timeout' => 24 * 60 * 60 - 120, + 'cookie_path' => '/'); + +require_once R3_LIB_DIR . 'r3locale.php'; +if (!isset($autoinit) || $autoinit == true) { + require_once R3_LIB_DIR . 'eco_app.php'; + if (!isset($isUserManager)) + $isUserManager = false; + R3AppInit('admin', array('auth' => !$isUserManager, 'auth_manager' => true, 'dbini' => true)); +} +$framesetReload = (isset($isUserManager) && $isUserManager === true); + + +/** + * xCSS config + */ +$xcssConfig = array( + 'path_to_css_dir' => R3_WEB_CSS_DIR, + 'compress_output_to_master' => true, + 'minify_output' => true, + 'xCSS_files' => array( + 'vars.xcss' => 'vars.css', + 'simpletable.xcss' => 'simpletable.css', + 'default.xcss' => 'default.css', + 'menu.xcss' => 'menu.css', + 'ui.all.xcss' => 'ui.all.css', + ), + 'reset_files' => array(), + 'hook_files' => array() +); + + +$jsPacker = array( + //'minify_output'=>false, + 'files' => array('jquery.all.js' => + array('jquery/jquery.js', + 'jquery/jquery-ui/jquery-ui.js', + 'jquery/plugins/jquery.form.js', + 'jquery/plugins/jquery.MultiFile.js', + 'jquery/plugins/jquery.printElement.js'), + 'jquery.all.i18n..js' => + array('jquery/jquery-ui/i18n/jquery.ui.datepicker-.js'), + 'ecogis2_core.all.js' => + array('jscore/r3.core.js', + 'jscore/r3.form.js', + 'jscore/r3.print.js', + 'jscore/r3.help.js', + 'jscore/r3.inputnumber.js', + 'jscore/r3.previewmap.js', + 'jscore/r3.thumbnail.js' + ), + 'gisclient_part1.all.js' => + array('../admin/gisclient/js/PanZoomBar.js', + '../admin/gisclient/external/proj4js/proj4.js' + ), + 'gisclient_part1.all.i18n..js' => + array('../admin/gisclient/languages/lang-.js'), + 'gisclient_part2.all.js' => + array('../admin/gisclient/js/widgetGisClient.js', + '../admin/gisclient/js/searchEngine.js', + '../admin/gisclient/js/gcTool.js', + '../admin/gisclient/js/gcTool/zoomToMaxExtent.js', + '../admin/gisclient/js/gcTool/zoomToHistoryPrevious.js', + '../admin/gisclient/js/gcTool/zoomToHistoryNext.js', + '../admin/gisclient/js/gcTool/pan.js', + '../admin/gisclient/js/gcTool/zoomIn.js', + '../admin/gisclient/js/gcTool/zoomOut.js', + '../admin/gisclient/js/gcTool/measureLine.js', + '../admin/gisclient/js/gcTool/measureArea.js', + '../admin/gisclient/js/gcTool/drawFeature.js', + '../admin/gisclient/js/gcTool/reloadLayers.js', + '../admin/gisclient/js/gcTool/redline.js', + '../admin/gisclient/js/gcTool/toolTip.js', + '../admin/gisclient/js/gcTool/mapPrint.js', + '../admin/gisclient/js/gcTool/selectBox.js', + '../admin/gisclient/js/gcTool/selectPoint.js', + '../admin/gisclient/js/gcTool/selectFeatures.js', + '../admin/gisclient/js/searchEngine.js', + '../admin/gisclient/js/gcComponent.js', + '../admin/gisclient/js/gcComponent/gcLayersManager.js', + '../admin/gisclient/js/gcComponent/gcLayerTree.js', + '../admin/gisclient/js/gcComponent/gcLegendTree.js', + '../admin/gisclient/js/gcComponent/mapInfo.js', + '../admin/gisclient/js/gcComponent/snapPoint.js', + '../admin/gisclient/js/gcComponent/referenceMap.js', + '../admin/gisclient/js/gcComponent/scaleDropDown.js', + '../admin/gisclient/js/gcComponent/mapImageDialog.js', + '../admin/gisclient/js/gcComponent/searchForm.js', + '../admin/gisclient/js/gcComponent/layerTools.js', + '../admin/gisclient/js/gcComponent/customSearch.js', + '../admin/gisclient/js/gcComponent/errorHandler.js', + '../admin/gisclient/js/gcComponent/loadingHandler.js', + '../admin/gisclient/js/gcComponent/customSearch.js', + '../admin/gisclient_modules/dialogToPopup/dialogToPopup.js', + '../admin/gisclient/js/gcComponent/contextHandler.js', + '../admin/gisclient/external/jstree/jquery.jstree.min.js', + '../admin/gisclient/external/plugin-jquery/jquery.maxzindex.js' + ), + ), + 'JS_files' => array('framework.js', 'eco_app.js', 'eco_utils.js', 'menu.js', 'r3_help.js', 'openfunc.js', 'mapopenfunc.js', 'jquery_extend.js', /* 'simpletable.js', */ + 'action_catalog.js', 'building.js', 'consumption.js', 'consumption_tree.js', 'customer.js', 'device.js', 'document.js', + 'energy_source_udm.js', 'global_action_builder.js', 'global_consumption_row.js', 'global_plain.js', 'global_plain_row.js', + 'global_plain_sum.js', 'global_plain_table.js', 'global_result.js', 'global_result_table.js', 'global_result_table_builder.js', 'global_strategy.js', + 'meter.js', 'sensor_data.js', 'simulation.js', 'street_lighting.js', 'street_lighting_consumption.js', 'utility.js', 'work.js', 'setup_table_column.js', + 'global_result_import.js', 'stat_general.js' + ), +); + + + +if (defined('R3_APP_URL')) { // Alitrmenti fa casino con command line tools, perchè la constante è inesistente + define('GC_MAP_SET_URL', R3_APP_URL . 'author/'); + define('GC_INITMAP_URL', GC_MAP_SET_URL . 'services/gcmap.php?jsonformat=true&'); + + define('GC_APP_ROOT_URL', R3_APP_URL . 'admin/gisclient/'); + define('GC_URL', R3_APP_URL . 'admin/gisclient.php'); +} + + +define('R3_STAT_FROM_TEXT_1', 'fino a %s'); +define('R3_STAT_FROM_TEXT_2', 'bis %s'); +define('R3_STAT_BETWEEN_TEXT_1', 'tra %s e %s'); +define('R3_STAT_BETWEEN_TEXT_2', 'von %s und %s'); +define('R3_STAT_TO_TEXT_1', 'oltre %s'); +define('R3_STAT_TO_TEXT_2', 'mehr als %s'); diff --git a/ecogis/lxc/etc/nginx/nginx.conf b/ecogis/lxc/etc/nginx/nginx.conf new file mode 100644 index 0000000..639b804 --- /dev/null +++ b/ecogis/lxc/etc/nginx/nginx.conf @@ -0,0 +1,42 @@ +user nginx; +pid /run/nginx.pid; +worker_processes 1; +error_log /dev/stderr warn; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + access_log off; + server_tokens off; + client_max_body_size 100m; + sendfile on; + + server { + listen 8080; + server_name localhost; + + root /srv/ecogis/web; + index index.php; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~ \.php$ { + fastcgi_pass unix:/var/run/ecogis.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param HTTP_HOST $http_x_forwarded_host if_not_empty; + fastcgi_param HTTPS "on"; + fastcgi_param REQUEST_SCHEME "https"; + fastcgi_param SERVER_NAME $http_x_forwarded_server_name if_not_empty; + fastcgi_param SERVER_PORT $http_x_forwarded_server_port if_not_empty; + } + } +} diff --git a/ecogis/lxc/etc/php5/php-fpm.conf b/ecogis/lxc/etc/php5/php-fpm.conf new file mode 100644 index 0000000..c063490 --- /dev/null +++ b/ecogis/lxc/etc/php5/php-fpm.conf @@ -0,0 +1,13 @@ +[global] +error_log = /proc/self/fd/2 +daemonize = no + +[ecogis] +catch_workers_output = yes +user = ecogis +group = ecogis +listen.owner = nginx +listen.group = nginx +listen = /var/run/ecogis.sock +pm = ondemand +pm.max_children = 16 diff --git a/ecogis/lxc/etc/services.d/.s6-svscan/finish b/ecogis/lxc/etc/services.d/.s6-svscan/finish new file mode 100755 index 0000000..c9e7add --- /dev/null +++ b/ecogis/lxc/etc/services.d/.s6-svscan/finish @@ -0,0 +1,4 @@ +#!/bin/execlineb -P + +foreground { s6-svwait -d -t 3000 nginx } +foreground { s6-svwait -d -t 3000 php-fpm } diff --git a/ecogis/lxc/etc/services.d/nginx/run b/ecogis/lxc/etc/services.d/nginx/run new file mode 100755 index 0000000..dff57ac --- /dev/null +++ b/ecogis/lxc/etc/services.d/nginx/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +nginx -g "daemon off;" diff --git a/ecogis/lxc/etc/services.d/php-fpm/run b/ecogis/lxc/etc/services.d/php-fpm/run new file mode 100755 index 0000000..e2296de --- /dev/null +++ b/ecogis/lxc/etc/services.d/php-fpm/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +php-fpm5 -F diff --git a/ecogis/lxcfile b/ecogis/lxcfile new file mode 100644 index 0000000..a4fb77e --- /dev/null +++ b/ecogis/lxcfile @@ -0,0 +1,40 @@ +IMAGE ecogis +LAYER shared/alpine3.8 +LAYER shared/alpine3.8-php5.6 +LAYER ecogis/ecogis + +RUN EOF + # Install runtime dependencies + apk --no-cache add php5-dom php5-gettext php5-pdo_pgsql php5-xml + + # Install build dependencies + apk --no-cache add --virtual .deps git php5-openssl php5-pear php5-phar + + # Install composer + wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/bin/composer + chmod +x /usr/bin/composer + + # Clone EcoGIS + git clone --depth=1 https://github.com/r3-gis/EcoGIS /srv/ecogis + + # Compose + cd /srv/ecogis + HOME=/tmp composer install + pear install Auth Log + + # Create OS user + addgroup -S -g 8020 ecogis + adduser -S -u 8020 -h /srv/ecogis -s /bin/false -g ecogis -G ecogis ecogis + + # Cleanup + apk --no-cache del .deps + find /srv/ecogis -name '.git*' -exec rm -rf {} + + rm -rf /usr/bin/composer /tmp/.composer +EOF + +COPY lxc + +# MOUNT DIR /srv/ecogis/data srv/ecogis/data/files +MOUNT FILE /srv/ecogis/conf/config.php srv/ecogis/etc/config.php + +CMD s6-svscan /etc/services.d diff --git a/ecogis/meta b/ecogis/meta new file mode 100644 index 0000000..b20489c --- /dev/null +++ b/ecogis/meta @@ -0,0 +1,10 @@ +{ + "title": "EcoGIS", + "desc-cs": "EcoGIS", + "desc-en": "EcoGIS", + "lxcpath": "ecogis", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.8-php5.6", "postgres"] +} diff --git a/ecogis/uninstall.sh b/ecogis/uninstall.sh new file mode 100755 index 0000000..a4a2be3 --- /dev/null +++ b/ecogis/uninstall.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -ev + +# Remove service +rm -f /etc/init.d/ecogis +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE IF EXISTS ecogis; DROP ROLE IF EXISTS ecogis;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop + +# Unregister application +vmmgr unregister-app ecogis diff --git a/frontlinesms/install.sh b/frontlinesms/install.sh index 5e4edc7..7f4ca42 100755 --- a/frontlinesms/install.sh +++ b/frontlinesms/install.sh @@ -18,5 +18,3 @@ rc-update -u # Register application vmmgr register-app frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" - -exit 0 diff --git a/frontlinesms/lxcfile b/frontlinesms/lxcfile index 61f8b53..21fb94e 100644 --- a/frontlinesms/lxcfile +++ b/frontlinesms/lxcfile @@ -1,6 +1,6 @@ IMAGE frontlinesms -LAYER shared/alpine -LAYER shared/java +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 LAYER frontlinesms/frontlinesms RUN EOF diff --git a/frontlinesms/meta b/frontlinesms/meta new file mode 100644 index 0000000..0d264a1 --- /dev/null +++ b/frontlinesms/meta @@ -0,0 +1,10 @@ +{ + "title": "FrontlineSMS", + "desc-cs": "Hromadné odesílání zpráv", + "desc-en": "Bulk SMS messaging", + "lxcpath": "frontlinesms", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-java8"] +} diff --git a/frontlinesms/pkg b/frontlinesms/pkg deleted file mode 100644 index dc9542a..0000000 --- a/frontlinesms/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: frontlinesms -title: FrontlineSMS -lxcpath: frontlinesms -desc: Hromadné odesílání zpráv -host: sms -version: 0.0.1 -deps: java diff --git a/frontlinesms/uninstall.sh b/frontlinesms/uninstall.sh index b535bc4..e22e404 100755 --- a/frontlinesms/uninstall.sh +++ b/frontlinesms/uninstall.sh @@ -5,4 +5,5 @@ set -ev rm -f /etc/init.d/frontlinesms rc-update -u -exit 0 +# Unregister application +vmmgr unregister-app frontlinesms diff --git a/gnuhealth/install.sh b/gnuhealth/install.sh index cccb002..1dbd27f 100755 --- a/gnuhealth/install.sh +++ b/gnuhealth/install.sh @@ -36,5 +36,3 @@ cp srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh # Register application vmmgr register-app gnuhealth "${GNUHEALTH_ADMIN_USER}" "${GNUHEALTH_ADMIN_PWD}" - -exit 0 diff --git a/gnuhealth/lxcfile b/gnuhealth/lxcfile index 4b4b2f8..96a9d44 100644 --- a/gnuhealth/lxcfile +++ b/gnuhealth/lxcfile @@ -1,8 +1,7 @@ IMAGE gnuhealth -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python3 -LAYER shared/nodejs +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python3.6 +LAYER shared/alpine3.9-nodejs10 LAYER gnuhealth/gnuhealth FIXLAYER /usr/bin/fix-apk @@ -33,7 +32,7 @@ RUN EOF sudo -u gnuhealth ./gnuhealth-setup install # Hackfix template1 database lock - sed -i 's/template1/gnuhealth/g' /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/trytond/backend/postgresql/database.py + sed -i 's/template1/gnuhealth/g' /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.20/trytond/backend/postgresql/database.py # Install Sao (Tryton web client) dependencies cd /srv/gnuhealth/sao @@ -53,7 +52,7 @@ EOF MOUNT DIR /srv/gnuhealth/conf srv/gnuhealth/gnuhealth/tryton/server/config USER 8008 8008 -ENV PATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV PATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.20/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV TRYTOND_CONFIG /srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf -ENV PYTHONPATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15:/srv/gnuhealth/gnuhealth/tryton/server/config +ENV PYTHONPATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.20:/srv/gnuhealth/gnuhealth/tryton/server/config CMD trytond --verbose diff --git a/gnuhealth/meta b/gnuhealth/meta new file mode 100644 index 0000000..21491ba --- /dev/null +++ b/gnuhealth/meta @@ -0,0 +1,10 @@ +{ + "title": "GNU Health", + "desc-cs": "Lékařské záznamy pacientů", + "desc-en": "Lékařské záznamy pacientů", + "lxcpath": "gnuhealth", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python3.6", "alpine3.9-nodejs10", "postgres"] +} diff --git a/gnuhealth/pkg b/gnuhealth/pkg deleted file mode 100644 index b26e761..0000000 --- a/gnuhealth/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: gnuhealth -title: GNU Health -lxcpath: gnuhealth -desc: Lékařské záznamy pacientů -host: gh -version: 0.0.1 -deps: python3 nodejs postgres diff --git a/gnuhealth/uninstall.sh b/gnuhealth/uninstall.sh index 8152bce..3c5d4ae 100755 --- a/gnuhealth/uninstall.sh +++ b/gnuhealth/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS gnuhealth; DROP DATABASE IF EXISTS gnuhealth_demo; DROP ROLE IF EXISTS gnuhealth;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app gnuhealth diff --git a/kanboard/install.sh b/kanboard/install.sh index ba35dcf..c02dcf0 100755 --- a/kanboard/install.sh +++ b/kanboard/install.sh @@ -35,5 +35,3 @@ cp srv/kanboard/update-conf.sh /srv/kanboard/update-conf.sh # Register application vmmgr register-app kanboard "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" - -exit 0 diff --git a/kanboard/lxcfile b/kanboard/lxcfile index c52aee8..a40e524 100644 --- a/kanboard/lxcfile +++ b/kanboard/lxcfile @@ -1,6 +1,6 @@ IMAGE kanboard -LAYER shared/alpine -LAYER shared/php +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-php7.2 LAYER kanboard/kanboard RUN EOF diff --git a/kanboard/meta b/kanboard/meta new file mode 100644 index 0000000..08ce849 --- /dev/null +++ b/kanboard/meta @@ -0,0 +1,10 @@ +{ + "title": "KanBoard", + "desc-cs": "Kanban řízení projektů", + "desc-en": "Kanban řízení projektů", + "lxcpath": "kanboard", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-php7.2", "postgres"] +} diff --git a/kanboard/pkg b/kanboard/pkg deleted file mode 100644 index 84d347d..0000000 --- a/kanboard/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: kanboard -title: KanBoard -lxcpath: kanboard -desc: Kanban řízení projektů -host: kb -version: 0.0.1 -deps: php postgres diff --git a/kanboard/uninstall.sh b/kanboard/uninstall.sh index 5f7c4f0..c0f1cc6 100755 --- a/kanboard/uninstall.sh +++ b/kanboard/uninstall.sh @@ -13,4 +13,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS kanboard; DROP ROLE IF EXISTS kanboard;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app kanboard diff --git a/mariadb/install.sh b/mariadb/install.sh index 673902a..fef5b42 100755 --- a/mariadb/install.sh +++ b/mariadb/install.sh @@ -24,5 +24,3 @@ rc-update -u service mariadb start cat adminpwd.sql | lxc-attach mariadb -- mysql service mariadb stop - -exit 0 diff --git a/mariadb/lxcfile b/mariadb/lxcfile index 89495f4..fd7d1db 100644 --- a/mariadb/lxcfile +++ b/mariadb/lxcfile @@ -1,5 +1,5 @@ IMAGE mariadb -LAYER shared/alpine +LAYER shared/alpine3.9 LAYER mariadb/mariadb RUN EOF diff --git a/mariadb/meta b/mariadb/meta new file mode 100644 index 0000000..3c8ce8a --- /dev/null +++ b/mariadb/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "MariaDB", + "desc-en": "MariaDB", + "lxcpath": "mariadb", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/mariadb/pkg b/mariadb/pkg deleted file mode 100644 index 88fbf4a..0000000 --- a/mariadb/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: mariadb -lxcpath: mariadb -version: 0.0.1 -deps: alpine diff --git a/mariadb/uninstall.sh b/mariadb/uninstall.sh index 3b3699f..2cda801 100755 --- a/mariadb/uninstall.sh +++ b/mariadb/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/mariadb rc-update -u - -exit 0 diff --git a/mifosx/install.sh b/mifosx/install.sh index c7701e1..ad5b060 100755 --- a/mifosx/install.sh +++ b/mifosx/install.sh @@ -48,5 +48,3 @@ cp srv/mifosx/update-conf.sh /srv/mifosx/update-conf.sh # Register application vmmgr register-app mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" - -exit 0 diff --git a/mifosx/lxcfile b/mifosx/lxcfile index aa3004b..11dbdb9 100644 --- a/mifosx/lxcfile +++ b/mifosx/lxcfile @@ -1,7 +1,7 @@ IMAGE mifosx -LAYER shared/alpine -LAYER shared/java -LAYER shared/tomcat +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-tomcat8 LAYER mifosx/mifosx RUN EOF diff --git a/mifosx/meta b/mifosx/meta new file mode 100644 index 0000000..b0600b7 --- /dev/null +++ b/mifosx/meta @@ -0,0 +1,10 @@ +{ + "title": "Mifos X", + "desc-cs": "Mikrofinancování rozvojových projektů", + "desc-en": "Mikrofinancování rozvojových projektů", + "lxcpath": "mifosx", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-tomcat8", "mariadb"] +} diff --git a/mifosx/pkg b/mifosx/pkg deleted file mode 100644 index 8f6f64c..0000000 --- a/mifosx/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: mifosx -title: Mifos X -lxcpath: mifosx -desc: Mikrofinancování rozvojových projektů -host: mifosx -version: 0.0.1 -deps: tomcat mariadb diff --git a/mifosx/uninstall.sh b/mifosx/uninstall.sh index 94d4684..02c0cd7 100755 --- a/mifosx/uninstall.sh +++ b/mifosx/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS `mifosplatform-tenants`; DROP DATABASE IF EXISTS `mifostenant-default`; DROP USER IF EXISTS `mifosx`;' | lxc-attach mariadb -- mysql [ ! -z ${STOP_MARIADB} ] && service mariadb stop -exit 0 +# Unregister application +vmmgr unregister-app mifosx diff --git a/motech/install.sh b/motech/install.sh index 1f605e3..4b92bf5 100755 --- a/motech/install.sh +++ b/motech/install.sh @@ -43,5 +43,3 @@ cp srv/motech/update-conf.sh /srv/motech/update-conf.sh # Register application vmmgr register-app motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" - -exit 0 diff --git a/motech/lxcfile b/motech/lxcfile index 6f440fa..43a2382 100644 --- a/motech/lxcfile +++ b/motech/lxcfile @@ -1,7 +1,7 @@ IMAGE motech -LAYER shared/alpine -LAYER shared/java -LAYER shared/tomcat +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-tomcat8 LAYER motech/motech RUN EOF diff --git a/motech/meta b/motech/meta new file mode 100644 index 0000000..96c335c --- /dev/null +++ b/motech/meta @@ -0,0 +1,10 @@ +{ + "title": "Motech", + "desc-cs": "Automatizace komunikace", + "desc-en": "Automatizace komunikace", + "lxcpath": "motech", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-tomcat8", "activemq", "postgres"] +} diff --git a/motech/pkg b/motech/pkg deleted file mode 100644 index 4786283..0000000 --- a/motech/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: motech -title: Motech -lxcpath: motech -desc: Automatizace komunikace -host: motech -version: 0.0.1 -deps: tomcat activemq postgres diff --git a/motech/uninstall.sh b/motech/uninstall.sh index 2d50d3e..33ab363 100755 --- a/motech/uninstall.sh +++ b/motech/uninstall.sh @@ -12,4 +12,5 @@ echo 'DROP DATABASE IF EXISTS motech; DROP DATABASE IF EXISTS motechdata; DROP D # TODO: Clear ActiveMQ config -exit 0 +# Unregister application +vmmgr unregister-app motech diff --git a/odoo/install.sh b/odoo/install.sh index 39ecc90..72abda6 100755 --- a/odoo/install.sh +++ b/odoo/install.sh @@ -37,5 +37,3 @@ rc-update -u # Register application vmmgr register-app odoo "${ODOO_ADMIN_USER}" "${ODOO_ADMIN_PWD}" - -exit 0 diff --git a/odoo/lxcfile b/odoo/lxcfile index e193789..04476fe 100644 --- a/odoo/lxcfile +++ b/odoo/lxcfile @@ -1,8 +1,7 @@ IMAGE odoo -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python3 -LAYER shared/nodejs +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python3.6 +LAYER shared/alpine3.9-nodejs10 LAYER odoo/odoo FIXLAYER /usr/bin/fix-apk diff --git a/odoo/meta b/odoo/meta new file mode 100644 index 0000000..8d8e092 --- /dev/null +++ b/odoo/meta @@ -0,0 +1,10 @@ +{ + "title": "Odoo", + "desc-cs": "Sada aplikací pro správu organizace", + "desc-en": "Sada aplikací pro správu organizace", + "lxcpath": "odoo", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python3.6", "alpine3.9-nodejs10", "postgres"] +} diff --git a/odoo/pkg b/odoo/pkg deleted file mode 100644 index 77635eb..0000000 --- a/odoo/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: odoo -title: Odoo -lxcpath: odoo -desc: Sada aplikací pro správu organizace -host: odoo -version: 0.0.1 -deps: python3 nodejs postgres diff --git a/odoo/uninstall.sh b/odoo/uninstall.sh index 47c90a0..267ab89 100755 --- a/odoo/uninstall.sh +++ b/odoo/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS odoo; DROP ROLE IF EXISTS odoo;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app odoo diff --git a/opendatakit-build/install.sh b/opendatakit-build/install.sh index b89c473..b0052e5 100755 --- a/opendatakit-build/install.sh +++ b/opendatakit-build/install.sh @@ -25,5 +25,3 @@ rc-update -u # Register application vmmgr register-app opendatakit-build - -exit 0 diff --git a/opendatakit-build/lxcfile b/opendatakit-build/lxcfile index 6ecf606..42cf5b4 100644 --- a/opendatakit-build/lxcfile +++ b/opendatakit-build/lxcfile @@ -1,7 +1,7 @@ IMAGE opendatakit-build -LAYER shared/alpine -LAYER shared/ruby -LAYER shared/nodejs +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-ruby2.4 +LAYER shared/alpine3.9-nodejs10 LAYER opendatakit-build/opendatakit-build FIXLAYER /usr/bin/fix-apk diff --git a/opendatakit-build/meta b/opendatakit-build/meta new file mode 100644 index 0000000..f6dda74 --- /dev/null +++ b/opendatakit-build/meta @@ -0,0 +1,10 @@ +{ + "title": "OpenDataKit Build", + "desc-cs": "Sběr formulářových dat - Aplikace pro návrh formulářů", + "desc-en": "Sběr formulářových dat - Aplikace pro návrh formulářů", + "lxcpath": "opendatakit-build", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-ruby2.4", "alpine3.9-nodejs10", "postgres"] +} diff --git a/opendatakit-build/pkg b/opendatakit-build/pkg deleted file mode 100644 index 6d3da6c..0000000 --- a/opendatakit-build/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: opendatakit-build -title: OpenDataKit Build -lxcpath: opendatakit-build -desc: Sběr formulářových dat - Aplikace pro návrh formulářů -host: odkbuild -version: 0.0.1 -deps: ruby nodejs postgres diff --git a/opendatakit-build/uninstall.sh b/opendatakit-build/uninstall.sh index 2eccf7c..a71d1cd 100755 --- a/opendatakit-build/uninstall.sh +++ b/opendatakit-build/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS opendatakitbuild; DROP ROLE IF EXISTS opendatakitbuild;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app opendatakit-build diff --git a/opendatakit/install.sh b/opendatakit/install.sh index a40f1c2..5e36f20 100755 --- a/opendatakit/install.sh +++ b/opendatakit/install.sh @@ -45,5 +45,3 @@ cp srv/opendatakit/update-conf.sh /srv/opendatakit/update-conf.sh # Register application vmmgr register-app opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}" - -exit 0 diff --git a/opendatakit/lxcfile b/opendatakit/lxcfile index 09bf1ce..ce3e3c5 100644 --- a/opendatakit/lxcfile +++ b/opendatakit/lxcfile @@ -1,7 +1,7 @@ IMAGE opendatakit -LAYER shared/alpine -LAYER shared/java -LAYER shared/tomcat +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-tomcat8 LAYER opendatakit/opendatakit RUN EOF @@ -9,7 +9,8 @@ RUN EOF apk --no-cache add --virtual .deps git git-lfs openjdk8 # Clone ODK aggregate - git clone --depth 1 https://github.com/opendatakit/aggregate.git /srv/opendatakit + git clone --depth 1000 https://github.com/opendatakit/aggregate.git /srv/opendatakit + git -C /srv/opendatakit checkout c285f1c # Compile Java web archive cd /srv/opendatakit diff --git a/opendatakit/meta b/opendatakit/meta new file mode 100644 index 0000000..0774b8a --- /dev/null +++ b/opendatakit/meta @@ -0,0 +1,10 @@ +{ + "title": "OpenDataKit", + "desc-cs": "Sběr formulářových dat", + "desc-en": "Sběr formulářových dat", + "lxcpath": "opendatakit", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-tomcat8", "postgres"] +} diff --git a/opendatakit/pkg b/opendatakit/pkg deleted file mode 100644 index 54a1909..0000000 --- a/opendatakit/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: opendatakit -title: OpenDataKit -lxcpath: opendatakit -desc: Sběr formulářových dat -host: odk -version: 0.0.1 -deps: tomcat postgres diff --git a/opendatakit/uninstall.sh b/opendatakit/uninstall.sh index 9d45746..d965a2d 100755 --- a/opendatakit/uninstall.sh +++ b/opendatakit/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS opendatakit; DROP ROLE IF EXISTS opendatakit;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app opendatakit diff --git a/openmapkit/install.sh b/openmapkit/install.sh index 120e26a..a3db06f 100755 --- a/openmapkit/install.sh +++ b/openmapkit/install.sh @@ -17,5 +17,3 @@ rc-update -u # Register application vmmgr register-app openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" - -exit 0 diff --git a/openmapkit/lxcfile b/openmapkit/lxcfile index 54ae19c..6e3e281 100644 --- a/openmapkit/lxcfile +++ b/openmapkit/lxcfile @@ -1,9 +1,8 @@ IMAGE openmapkit -LAYER shared/alpine -LAYER shared/java -LAYER shared/libxml -LAYER shared/python2 -LAYER shared/nodejs +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-python2.7 +LAYER shared/alpine3.9-nodejs10 LAYER openmapkit/openmapkit FIXLAYER /usr/bin/fix-apk @@ -19,6 +18,7 @@ RUN EOF # Install OpenMapKit dependencies pip install -r requirements.txt + yarn add libxmljs yarn cd frontend yarn diff --git a/openmapkit/meta b/openmapkit/meta new file mode 100644 index 0000000..078c327 --- /dev/null +++ b/openmapkit/meta @@ -0,0 +1,10 @@ +{ + "title": "OpenMapKit", + "desc-cs": "Sběr mapových dat", + "desc-en": "Sběr mapových dat", + "lxcpath": "openmapkit", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-java8", "alpine3.9-python2.7", "alpine3.9-nodejs10", "postgres"] +} diff --git a/openmapkit/pkg b/openmapkit/pkg deleted file mode 100644 index 5ad12e3..0000000 --- a/openmapkit/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: openmapkit -title: OpenMapKit -lxcpath: openmapkit -desc: Sběr mapových dat -host: omk -version: 0.0.1 -deps: java python2 nodejs postgres diff --git a/openmapkit/uninstall.sh b/openmapkit/uninstall.sh index b30da54..0e5d4c0 100755 --- a/openmapkit/uninstall.sh +++ b/openmapkit/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS openmapkit; DROP ROLE IF EXISTS openmapkit;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app openmapkit diff --git a/pandora/install.sh b/pandora/install.sh index 31d703d..1a073ac 100755 --- a/pandora/install.sh +++ b/pandora/install.sh @@ -61,5 +61,3 @@ cp srv/pandora/update-conf.sh /srv/pandora/update-conf.sh # Register application vmmgr register-app pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}" - -exit 0 diff --git a/pandora/lxcfile b/pandora/lxcfile index 585227b..0b136ed 100644 --- a/pandora/lxcfile +++ b/pandora/lxcfile @@ -1,7 +1,6 @@ IMAGE pandora -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python3 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python3.6 LAYER pandora/pandora RUN EOF diff --git a/pandora/meta b/pandora/meta new file mode 100644 index 0000000..662509c --- /dev/null +++ b/pandora/meta @@ -0,0 +1,10 @@ +{ + "title": "Pan.do/ra", + "desc-cs": "Archiv medií", + "desc-en": "Media archive", + "lxcpath": "pandora", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python3.6", "postgres", "rabbitmq"] +} diff --git a/pandora/pkg b/pandora/pkg deleted file mode 100644 index c070659..0000000 --- a/pandora/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: pandora -title: Pan.do/ra -lxcpath: pandora -desc: Archiv medií -host: pandora -version: 0.0.1 -deps: python3 postgres rabbitmq diff --git a/pandora/uninstall.sh b/pandora/uninstall.sh index 8d2247c..cdd4a0f 100755 --- a/pandora/uninstall.sh +++ b/pandora/uninstall.sh @@ -16,4 +16,5 @@ lxc-attach rabbitmq -- rabbitmqctl delete_vhost /pandora || true lxc-attach rabbitmq -- rabbitmqctl delete_user pandora || true [ ! -z ${STOP_RABBITMQ} ] && service rabbitmq stop -exit 0 +# Unregister application +vmmgr unregister-app pandora diff --git a/postgres/install.sh b/postgres/install.sh index 461c0b1..8a47d8d 100755 --- a/postgres/install.sh +++ b/postgres/install.sh @@ -22,5 +22,3 @@ fi # Install service cp etc/init.d/postgres /etc/init.d/postgres rc-update -u - -exit 0 diff --git a/postgres/lxcfile b/postgres/lxcfile index 20186a1..28ce68c 100644 --- a/postgres/lxcfile +++ b/postgres/lxcfile @@ -1,5 +1,5 @@ IMAGE postgres -LAYER shared/alpine +LAYER shared/alpine3.9 LAYER postgres/postgres RUN EOF diff --git a/postgres/meta b/postgres/meta new file mode 100644 index 0000000..10d4b60 --- /dev/null +++ b/postgres/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "PostgreSQL", + "desc-en": "PostgreSQL", + "lxcpath": "postgres", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/postgres/pkg b/postgres/pkg deleted file mode 100644 index 9327bd1..0000000 --- a/postgres/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: postgres -lxcpath: postgres -version: 0.0.1 -deps: alpine diff --git a/postgres/uninstall.sh b/postgres/uninstall.sh index e8ae29b..7bed8f9 100755 --- a/postgres/uninstall.sh +++ b/postgres/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/postgres rc-update -u - -exit 0 diff --git a/rabbitmq/install.sh b/rabbitmq/install.sh index 35427ef..a06ef80 100755 --- a/rabbitmq/install.sh +++ b/rabbitmq/install.sh @@ -10,5 +10,3 @@ chown 5672:5672 /srv/rabbitmq/data # Install service cp etc/init.d/rabbitmq /etc/init.d/rabbitmq rc-update -u - -exit 0 diff --git a/rabbitmq/lxcfile b/rabbitmq/lxcfile index efc7b27..63acb0b 100644 --- a/rabbitmq/lxcfile +++ b/rabbitmq/lxcfile @@ -1,5 +1,5 @@ IMAGE rabbitmq -LAYER shared/alpine +LAYER shared/alpine3.9 LAYER rabbitmq/rabbitmq RUN EOF diff --git a/rabbitmq/meta b/rabbitmq/meta new file mode 100644 index 0000000..c28040f --- /dev/null +++ b/rabbitmq/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "RabbitMQ", + "desc-en": "RabbitMQ", + "lxcpath": "rabbitmq", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/rabbitmq/pkg b/rabbitmq/pkg deleted file mode 100644 index efc7b2c..0000000 --- a/rabbitmq/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: rabbitmq -lxcpath: rabbitmq -version: 0.0.1 -deps: alpine diff --git a/rabbitmq/uninstall.sh b/rabbitmq/uninstall.sh index f4e6f62..9b3328b 100755 --- a/rabbitmq/uninstall.sh +++ b/rabbitmq/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/rabbitmq rc-update -u - -exit 0 diff --git a/redis/install.sh b/redis/install.sh index 452b62a..ec465e2 100755 --- a/redis/install.sh +++ b/redis/install.sh @@ -11,5 +11,3 @@ chown -R 6379:6379 /srv/redis/data # Install service cp etc/init.d/redis /etc/init.d/redis rc-update -u - -exit 0 diff --git a/redis/lxcfile b/redis/lxcfile index 88ede7a..f8523fb 100644 --- a/redis/lxcfile +++ b/redis/lxcfile @@ -1,5 +1,5 @@ IMAGE redis -LAYER shared/alpine +LAYER shared/alpine3.9 LAYER redis/redis RUN EOF diff --git a/redis/meta b/redis/meta new file mode 100644 index 0000000..4882655 --- /dev/null +++ b/redis/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Redis", + "desc-en": "Redis", + "lxcpath": "redis", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9"] +} diff --git a/redis/pkg b/redis/pkg deleted file mode 100644 index b1cc047..0000000 --- a/redis/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: redis -lxcpath: redis -version: 0.0.1 -deps: alpine diff --git a/redis/uninstall.sh b/redis/uninstall.sh index 2e9054d..ee85d68 100755 --- a/redis/uninstall.sh +++ b/redis/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/redis rc-update -u - -exit 0 diff --git a/sahana-demo/install.sh b/sahana-demo/install.sh index 868cb8a..be1613a 100755 --- a/sahana-demo/install.sh +++ b/sahana-demo/install.sh @@ -48,5 +48,3 @@ cp srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh # Register application vmmgr register-app sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}" - -exit 0 diff --git a/sahana-demo/lxcfile b/sahana-demo/lxcfile index 0600d54..d2e4256 100644 --- a/sahana-demo/lxcfile +++ b/sahana-demo/lxcfile @@ -1,7 +1,6 @@ IMAGE sahana-demo -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER shared/sahana LAYER sahana-demo/sahana-demo diff --git a/sahana-demo/meta b/sahana-demo/meta new file mode 100644 index 0000000..f460565 --- /dev/null +++ b/sahana-demo/meta @@ -0,0 +1,10 @@ +{ + "title": "Sahana Eden - Demo", + "desc-cs": "Řízení humanítární činnosti - Ukázková instance", + "desc-en": "Řízení humanítární činnosti - Ukázková instance", + "lxcpath": "sahana-demo", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["sahana-shared", "postgres"] +} diff --git a/sahana-demo/pkg b/sahana-demo/pkg deleted file mode 100644 index 370b745..0000000 --- a/sahana-demo/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: sahana-demo -title: Sahana Eden - Demo -lxcpath: sahana-demo -desc: Řízení humanítární činnosti - Ukázková instance -host: sahana-demo -version: 0.0.1 -deps: sahana-shared postgres diff --git a/sahana-demo/uninstall.sh b/sahana-demo/uninstall.sh index bd2d886..a6adf51 100755 --- a/sahana-demo/uninstall.sh +++ b/sahana-demo/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS sahanademo; DROP ROLE IF EXISTS sahanademo;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app sahana-demo diff --git a/sahana-shared/lxcfile b/sahana-shared/lxcfile index f902d90..eb91192 100644 --- a/sahana-shared/lxcfile +++ b/sahana-shared/lxcfile @@ -1,7 +1,6 @@ IMAGE sahana -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER shared/sahana RUN EOF diff --git a/sahana-shared/meta b/sahana-shared/meta new file mode 100644 index 0000000..54c7f97 --- /dev/null +++ b/sahana-shared/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Řízení humanítární činnosti - Sdílená vrstva", + "desc-en": "Řízení humanítární činnosti - Sdílená vrstva", + "lxcpath": "shared/sahana", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-python2.7"] +} diff --git a/sahana-shared/pkg b/sahana-shared/pkg deleted file mode 100644 index fc0f482..0000000 --- a/sahana-shared/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: sahana-shared -lxcpath: shared/sahana -version: 0.0.1 -deps: python2 diff --git a/sahana/install.sh b/sahana/install.sh index 308c778..3850705 100755 --- a/sahana/install.sh +++ b/sahana/install.sh @@ -49,5 +49,3 @@ cp srv/sahana/update-conf.sh /srv/sahana/update-conf.sh # Register application vmmgr register-app sahana "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}" - -exit 0 diff --git a/sahana/lxcfile b/sahana/lxcfile index 9097a0b..ec9def2 100644 --- a/sahana/lxcfile +++ b/sahana/lxcfile @@ -1,7 +1,6 @@ IMAGE sahana -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER shared/sahana LAYER sahana/sahana diff --git a/sahana/meta b/sahana/meta new file mode 100644 index 0000000..7157c0f --- /dev/null +++ b/sahana/meta @@ -0,0 +1,10 @@ +{ + "title": "Sahana Eden", + "desc-cs": "Řízení humanítární činnosti", + "desc-en": "Řízení humanítární činnosti", + "lxcpath": "sahana", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["sahana-shared", "postgres"] +} diff --git a/sahana/pkg b/sahana/pkg deleted file mode 100644 index ba3e920..0000000 --- a/sahana/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: sahana -title: Sahana Eden -lxcpath: sahana -desc: Řízení humanítární činnosti -host: sahana -version: 0.0.1 -deps: sahana-shared postgres diff --git a/sahana/uninstall.sh b/sahana/uninstall.sh index 1b3c0fa..cc2caa1 100755 --- a/sahana/uninstall.sh +++ b/sahana/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS sahana; DROP ROLE IF EXISTS sahana;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app sahana diff --git a/sambro/install.sh b/sambro/install.sh index fcc80a9..9f45c8c 100755 --- a/sambro/install.sh +++ b/sambro/install.sh @@ -49,5 +49,3 @@ cp srv/sambro/update-conf.sh /srv/sambro/update-conf.sh # Register application vmmgr register-app sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}" - -exit 0 diff --git a/sambro/lxcfile b/sambro/lxcfile index 5c7a292..0698ef2 100644 --- a/sambro/lxcfile +++ b/sambro/lxcfile @@ -1,7 +1,6 @@ IMAGE sambro -LAYER shared/alpine -LAYER shared/libxml -LAYER shared/python2 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-python2.7 LAYER shared/sahana LAYER sambro/sambro diff --git a/sambro/meta b/sambro/meta new file mode 100644 index 0000000..6871f47 --- /dev/null +++ b/sambro/meta @@ -0,0 +1,10 @@ +{ + "title": "Sahana Eden - SAMBRO", + "desc-cs": "Centrum hlášení a výstrah", + "desc-en": "Centrum hlášení a výstrah", + "lxcpath": "sambro", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["sahana-shared", "postgres"] +} diff --git a/sambro/pkg b/sambro/pkg deleted file mode 100644 index 92d3fb4..0000000 --- a/sambro/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: sambro -title: Sahana Eden - SAMBRO -lxcpath: sambro -desc: Centrum hlášení a výstrah -host: sambro -version: 0.0.1 -deps: sahana-shared postgres diff --git a/sambro/uninstall.sh b/sambro/uninstall.sh index 5558d98..4fd1cf6 100755 --- a/sambro/uninstall.sh +++ b/sambro/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS sambro; DROP ROLE IF EXISTS sambro;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app sambro diff --git a/seeddms/install.sh b/seeddms/install.sh index 0287763..b577961 100755 --- a/seeddms/install.sh +++ b/seeddms/install.sh @@ -41,5 +41,3 @@ cp srv/seeddms/update-conf.sh /srv/seeddms/update-conf.sh # Register application vmmgr register-app seeddms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" - -exit 0 diff --git a/seeddms/lxcfile b/seeddms/lxcfile index 5a7e19d..d0e7db5 100644 --- a/seeddms/lxcfile +++ b/seeddms/lxcfile @@ -1,8 +1,7 @@ IMAGE seeddms -LAYER shared/alpine -LAYER shared/php -LAYER shared/libxml -LAYER shared/python3 +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-php7.2 +LAYER shared/alpine3.9-python3.6 LAYER seeddms/seeddms FIXLAYER /usr/bin/fix-apk diff --git a/seeddms/meta b/seeddms/meta new file mode 100644 index 0000000..7df33c5 --- /dev/null +++ b/seeddms/meta @@ -0,0 +1,10 @@ +{ + "title": "SeedDMS", + "desc-cs": "Archiv dokumentace", + "desc-en": "Archiv dokumentace", + "lxcpath": "seeddms", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-php7.2", "alpine3.9-python3.6", "postgres"] +} diff --git a/seeddms/pkg b/seeddms/pkg deleted file mode 100644 index da50d1a..0000000 --- a/seeddms/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: seeddms -title: SeedDMS -lxcpath: seeddms -desc: Archiv dokumentace -host: dms -version: 0.0.1 -deps: php python3 postgres diff --git a/seeddms/uninstall.sh b/seeddms/uninstall.sh index c1c3953..b0e1347 100755 --- a/seeddms/uninstall.sh +++ b/seeddms/uninstall.sh @@ -13,4 +13,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS seeddms; DROP ROLE IF EXISTS seeddms;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app seeddms diff --git a/sigmah/install.sh b/sigmah/install.sh index e76f1b2..42d5c10 100755 --- a/sigmah/install.sh +++ b/sigmah/install.sh @@ -48,5 +48,3 @@ cp srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh # Register application vmmgr register-app sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" - -exit 0 diff --git a/sigmah/lxcfile b/sigmah/lxcfile index 621d3d5..ab88dae 100644 --- a/sigmah/lxcfile +++ b/sigmah/lxcfile @@ -1,7 +1,7 @@ IMAGE sigmah -LAYER shared/alpine -LAYER shared/java -LAYER shared/tomcat +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 +LAYER shared/alpine3.9-tomcat8 LAYER sigmah/sigmah RUN EOF diff --git a/sigmah/meta b/sigmah/meta new file mode 100644 index 0000000..0960371 --- /dev/null +++ b/sigmah/meta @@ -0,0 +1,10 @@ +{ + "title": "Sigmah", + "desc-cs": "Finanční řízení sbírek", + "desc-en": "Finanční řízení sbírek", + "lxcpath": "sigmah", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-tomcat8", "postgres"] +} diff --git a/sigmah/pkg b/sigmah/pkg deleted file mode 100644 index 97545aa..0000000 --- a/sigmah/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: sigmah -title: Sigmah -lxcpath: sigmah -desc: Finanční řízení sbírek -host: sigmah -version: 0.0.1 -deps: tomcat postgres diff --git a/sigmah/uninstall.sh b/sigmah/uninstall.sh index 7b74804..3205ed6 100755 --- a/sigmah/uninstall.sh +++ b/sigmah/uninstall.sh @@ -10,4 +10,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS sigmah; DROP ROLE IF EXISTS sigmah;' | lxc-attach -u 5432 -g 5432 postgres -- psql [ ! -z ${STOP_POSTGRES} ] && service postgres stop -exit 0 +# Unregister application +vmmgr unregister-app sigmah diff --git a/solr/install.sh b/solr/install.sh index 2380fa3..c19578a 100755 --- a/solr/install.sh +++ b/solr/install.sh @@ -11,5 +11,3 @@ chown -R 8983:8983 /srv/solr/data # Install service cp etc/init.d/solr /etc/init.d/solr rc-update -u - -exit 0 diff --git a/solr/lxcfile b/solr/lxcfile index 2fef8c4..bbed9e6 100644 --- a/solr/lxcfile +++ b/solr/lxcfile @@ -1,6 +1,6 @@ IMAGE solr -LAYER shared/alpine -LAYER shared/java +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-java8 LAYER solr/solr RUN EOF @@ -8,8 +8,7 @@ RUN EOF apk --no-cache add bash lsof # Download and install Solr - mkdir /opt - wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O - | tar xzf - -C /opt/ + wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz -O - | tar xzf - -C /opt mv /opt/solr-6.5.1 /opt/solr # Create OS user diff --git a/solr/meta b/solr/meta new file mode 100644 index 0000000..2ea5d74 --- /dev/null +++ b/solr/meta @@ -0,0 +1,9 @@ +{ + "desc-cs": "Solr", + "desc-en": "Solr", + "lxcpath": "solr", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-java8"] +} diff --git a/solr/pkg b/solr/pkg deleted file mode 100644 index 847c413..0000000 --- a/solr/pkg +++ /dev/null @@ -1,4 +0,0 @@ -pkg: solr -lxcpath: solr -version: 0.0.1 -deps: java diff --git a/solr/uninstall.sh b/solr/uninstall.sh index c852993..8582c8f 100755 --- a/solr/uninstall.sh +++ b/solr/uninstall.sh @@ -4,5 +4,3 @@ set -ev # Remove service rm -f /etc/init.d/solr rc-update -u - -exit 0 diff --git a/ushahidi/install.sh b/ushahidi/install.sh index 2bb2ac4..df8ba89 100755 --- a/ushahidi/install.sh +++ b/ushahidi/install.sh @@ -40,5 +40,3 @@ cp srv/ushahidi/update-conf.sh /srv/ushahidi/update-conf.sh # Register application vmmgr register-app ushahidi "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" - -exit 0 diff --git a/ushahidi/lxcfile b/ushahidi/lxcfile index 80c99b6..93a399c 100644 --- a/ushahidi/lxcfile +++ b/ushahidi/lxcfile @@ -1,6 +1,6 @@ IMAGE ushahidi -LAYER shared/alpine -LAYER shared/php +LAYER shared/alpine3.9 +LAYER shared/alpine3.9-php7.2 LAYER ushahidi/ushahidi RUN EOF diff --git a/ushahidi/meta b/ushahidi/meta new file mode 100644 index 0000000..ac1fb06 --- /dev/null +++ b/ushahidi/meta @@ -0,0 +1,10 @@ +{ + "title": "Ushahidi", + "desc-cs": "Skupinová reakce na události", + "desc-en": "Skupinová reakce na události", + "lxcpath": "ushahidi", + "version": "0.0.1", + "release": "0", + "license": "GPL", + "depends": ["alpine3.9-php7.2", "mariadb"] +} diff --git a/ushahidi/pkg b/ushahidi/pkg deleted file mode 100644 index 7ac6a46..0000000 --- a/ushahidi/pkg +++ /dev/null @@ -1,7 +0,0 @@ -pkg: ushahidi -title: Ushahidi -lxcpath: ushahidi -desc: Skupinová reakce na události -host: ush -version: 0.0.1 -deps: php mariadb diff --git a/ushahidi/uninstall.sh b/ushahidi/uninstall.sh index 4f3e1fc..1890160 100755 --- a/ushahidi/uninstall.sh +++ b/ushahidi/uninstall.sh @@ -13,4 +13,5 @@ rc-update -u echo 'DROP DATABASE IF EXISTS ushahidi; DROP USER IF EXISTS ushahidi;' | lxc-attach mariadb -- mysql [ ! -z ${STOP_MARIADB} ] && service mariadb stop -exit 0 +# Unregister application +vmmgr unregister-app ushahidi diff --git a/vmmgr b/vmmgr new file mode 160000 index 0000000..d64e57b --- /dev/null +++ b/vmmgr @@ -0,0 +1 @@ +Subproject commit d64e57ba693f381219a97d902b9003a1e22a7319 diff --git a/zz-build/build-all.sh b/zz-build/build-all.sh deleted file mode 100755 index 777bb7b..0000000 --- a/zz-build/build-all.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -set -ev - -cd $(realpath $(dirname "${0}")) - -# Build basic.tar -cd ../basic -tar cpf /srv/build/basic.tar * - -# Build native apps -cd ../app-acme-sh -abuild -F -cd ../app-lxc -su -c 'abuild -Fr' -cd ../app-vmmgr -abuild -F - -# Build basic Alpine LXC image -mkdir -p /var/lib/lxc/shared/alpine -wget https://github.com/gliderlabs/docker-alpine/raw/c14b86580b9f86f42296050ec7564faf6b6db9be/versions/library-3.8/x86_64/rootfs.tar.xz -O - | tar xJf - -C /var/lib/lxc/shared/alpine -chmod 755 /var/lib/lxc/shared/alpine -lxc-build ../basic-alpine - -# Build shared overlays -lxc-build ../basic-java -lxc-build ../basic-libxml -lxc-build ../basic-php -lxc-build ../basic-python2 -lxc-build ../basic-python3 -lxc-build ../basic-nodejs -lxc-build ../basic-ruby -lxc-build ../basic-tomcat - -# Build applications -lxc-build ../activemq -lxc-build ../ckan -lxc-build ../ckan-datapusher -lxc-build ../crisiscleanup -lxc-build ../cts -lxc-build ../frontlinesms -lxc-build ../gnuhealth -lxc-build ../kanboard -lxc-build ../mariadb -lxc-build ../mifosx -lxc-build ../motech -lxc-build ../opendatakit -lxc-build ../opendatakit-build -lxc-build ../openmapkit -lxc-build ../pandora -lxc-build ../postgres -lxc-build ../rabbitmq -lxc-build ../redis -lxc-build ../sahana-shared -lxc-build ../sahana -lxc-build ../sahana-demo -lxc-build ../sambro -lxc-build ../seeddms -lxc-build ../sigmah -lxc-build ../solr -lxc-build ../ushahidi - -# Create packages -lxc-pack ../basic-alpine -lxc-pack ../basic-java -lxc-pack ../basic-libxml -lxc-pack ../basic-php -lxc-pack ../basic-python2 -lxc-pack ../basic-python3 -lxc-pack ../basic-nodejs -lxc-pack ../basic-ruby -lxc-pack ../basic-tomcat - -lxc-pack ../activemq -lxc-pack ../ckan -lxc-pack ../ckan-datapusher -lxc-pack ../crisiscleanup -lxc-pack ../cts -lxc-pack ../frontlinesms -lxc-pack ../gnuhealth -lxc-pack ../kanboard -lxc-pack ../mariadb -lxc-pack ../mifosx -lxc-pack ../motech -lxc-pack ../opendatakit -lxc-pack ../opendatakit-build -lxc-pack ../openmapkit -lxc-pack ../pandora -lxc-pack ../postgres -lxc-pack ../rabbitmq -lxc-pack ../redis -lxc-pack ../sahana-shared -lxc-pack ../sahana -lxc-pack ../sahana-demo -lxc-pack ../sambro -lxc-pack ../seeddms -lxc-pack ../sigmah -lxc-pack ../solr -lxc-pack ../ushahidi diff --git a/zz-build/usr/bin/abuild b/zz-build/usr/bin/abuild deleted file mode 100755 index 100a456..0000000 --- a/zz-build/usr/bin/abuild +++ /dev/null @@ -1,2615 +0,0 @@ -#!/bin/ash -e - -# abuild - build apk packages (light version of makepkg) -# Copyright (c) 2008-2015 Natanael Copa -# Copyright (c) 2016 Timo Teräs -# -# Distributed under GPL-2 -# - -program_version=3.2.0-r0 -sysconfdir=/etc -datadir=/usr/share/abuild - -abuild_path=$(readlink -f $0) -git=$(command -v git) || git=true - -if ! [ -f "$datadir/functions.sh" ]; then - echo "$datadir/functions.sh: not found" >&2 - exit 1 -fi -. "$datadir/functions.sh" - -# defaults -: ${FAKEROOT:="fakeroot"} -: ${SUDO_APK:="abuild-apk"} -: ${APK:="apk"} -: ${ADDUSER:="abuild-adduser"} -: ${ADDGROUP:="abuild-addgroup"} - -apk_opt_wait="--wait 30" - -umask 022 - -# run optional log command for remote logging -logcmd() { - ${ABUILD_LOG_CMD:-true} "$@" - return 0 -} - -# we override the default msg, warning and error as we want the pkgname -msg() { - [ -n "$quiet" ] && return 0 - local prompt="$GREEN>>>${NORMAL}" - local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}" - local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" - printf "${prompt} ${name}${fake}: %s\n" "$1" >&2 -} - -warning() { - local prompt="${YELLOW}>>> WARNING:${NORMAL}" - local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}" - local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" - printf "${prompt} ${name}${fake}: %s\n" "$1" >&2 -} - -error() { - local prompt="${RED}>>> ERROR:${NORMAL}" - local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}" - local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" - printf "${prompt} ${name}${fake}: %s\n" "$1" >&2 - logcmd "ERROR: $pkgname: $1" -} - -cross_creating() { - test "$CHOST" != "$CTARGET" -a -n "$CBUILDROOT" -} - -cross_compiling() { - test "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" -} - -want_check() { - [ -n "$ABUILD_BOOTSTRAP" ] && return 1 - cross_compiling && return 1 - options_has "!check" && return 1 - return 0 -} - -cleanup() { - local i= - [ -z "$subpkgdir" ] && set_xterm_title "" - if [ -n "$keep_build" ]; then - return 0 - fi - for i; do - case $i in - bldroot) - if [ "$BUILD_ROOT" ]; then - msg "Cleaning up build chroot" - abuild-rmtemp "$BUILD_ROOT" - fi;; - pkgdir) msg "Cleaning up pkgdir"; rm -rf "$pkgbasedir";; - srcdir) msg "Cleaning up srcdir"; rm -rf "$srcdir";; - deps) - if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then - msg "Uninstalling dependencies..." - undeps - fi - ;; - esac - done -} - -die() { - trap - EXIT - error "$@" - cleanup $ERROR_CLEANUP - exit 1 -} - -spell_error() { - die "APKBUILD contains '$1'. It should be '$2'" -} - -print_version() { - msg "$program $program_version" -} - -# check if apkbuild is basicly sane -default_sanitycheck() { - local i= j= suggestion= - msg "Checking sanity of $APKBUILD..." - [ -z "$pkgname" ] && die "Missing pkgname in APKBUILD" - [ -z "${pkgname##* *}" ] && die "pkgname contains spaces" - [ -z "$pkgver" ] && die "Missing pkgver in APKBUILD" - if [ "$pkgver" != "volatile" ] && [ -z "$nodeps" ]; then - $APK version --check --quiet "$pkgver" ||\ - die "$pkgver is not a valid version" - fi - [ -z "$pkgrel" ] && die "Missing pkgrel in APKBUILD" - [ -z "$pkgdesc" ] && die "Missing pkgdesc in APKBUILD" - [ -z "$url" ] && die "Missing url in APKBUILD" - [ -z "$license" ] && die "Missing license in APKBUILD" - if [ $(echo "$pkgdesc" | wc -c) -gt 128 ]; then - die "pkgdesc is too long" - fi - is_function package || warning "Missing package() function in APKBUILD" - - if [ -n "$replaces_priority" ] \ - && ! echo $replaces_priority | egrep -q '^[0-9]+$'; then - die "replaces_priority must be a number" - fi - - if [ -n "$provider_priority" ] \ - && ! echo $provider_priority | egrep -q '^[0-9]+$'; then - die "provider_priority must be a number" - fi - - # check so no package names starts with - - for i in $pkgname $subpackages; do - case $i in - -*) die "${i%%:*} is not a valid package name";; - esac - done - - for i in $install; do - local n=${i%.*} - local suff=${i##*.} - case "$suff" in - pre-install|post-install|pre-upgrade|post-upgrade|pre-deinstall|post-deinstall);; - *) die "$i: unknown install script suffix" - esac - if ! subpackages_has "$n" && [ "$n" != "$pkgname" ]; then - die "$i: install script does not match pkgname or any subpackage" - fi - [ -e "$startdir/$i" ] || die "install script $i is missing" - for j in chown chmod chgrp; do - if grep -q $j "$startdir"/$i; then - warning "$i: found $j" - warning2 "Permissions should be fixed in APKBUILD package()" - fi - done - done - - for i in $triggers; do - local f=${i%=*} - local p=${f%.trigger} - [ "$f" = "$i" ] && die "$f: triggers must contain '='" - [ "$p" = "$f" ] && die "$f: triggers scripts must have .trigger suffix" - if ! subpackages_has "$p" && [ "$p" != "$pkgname" ]; then - die "$p: trigger script does not match pkgname or any subpackage" - fi - - if source_has "$f"; then - warning "You should not have \$triggers in source" - continue - fi - - [ -e "$startdir"/$f ] || die "trigger script $f is missing" - done - if [ -n "$source" ]; then - for i in $source; do - if install_has "$i"; then - warning "You should not have \$install in source" - continue - fi - case "$i" in - *::*) i=${i%%::*};; - https://*) makedepends_has wget && warning "wget no longer need to be in makedepends when source has https://" ;; - esac - list_has ${i##*/} $md5sums $sha256sums $sha512sums \ - || die "${i##*/} is missing in checksums" - - # verify that our source does not have git tag version - # name as tarball (typicallly github) - if is_remote "$i" && [ "${i#*::}" = "$i" ]; then - case ${i##*/} in - v$pkgver.tar.*|$pkgver.tar.*) - die "source ${i##*/} needs to be renamed to avoid possible collisions" - ;; - esac - fi - done - fi - - # verify that things listed in checksum also is listed in source - local algo= - for algo in md5 sha256 sha512; do - eval set -- \$${algo}sums - while [ $# -gt 1 ]; do - local file="$2" - shift 2 - source_has $file || die "$file exists in ${algo}sums but is missing in \$source" - done - done - - # common spelling errors - [ -n "$depend" ] && spell_error depend depends - [ -n "$makedepend" ] && spell_error makedepend makedepends - [ -n "$pkguser" ] && spell_error pkguser pkgusers - [ -n "$pkggroup" ] && spell_error pkggroup pkggroups - [ -n "$subpackage" ] && spell_error subpackage subpackages - [ -n "$checkdepend" ] && spell_error checkdepend checkdepends - - check_maintainer || die "Provide a valid RFC822 maintainer address" - check_license || warning "Please use valid SPDX license identifiers found at: https://spdx.org/licenses" - - check_depends_dev || warning "depends_dev found but no development subpackage found" - check_secfixes_comment || return 1 - - makedepends_has 'g++' && ! options_has toolchain && warning "g++ should not be in makedepends" - - if ! options_has "!check" && [ -n "$REQUIRE_CHECK" ]; then - (unset check; . "$APKBUILD"; type check >/dev/null 2>&1) || \ - die "Testsuites (abuild check) are required or need to be explicitly disabled!" - fi - - check_provides || die "provides must not contain $pkgname" - - return 0 -} - -sanitycheck() { - default_sanitycheck -} - -sumcheck() { - local algo="$1" sums="$2" - local dummy f endreturnval originalparams origin file - - # get number of checksums - set -- $sums - local numsums=$(( $# / 2 )) - - set -- $source - if [ $# -ne $numsums ]; then - die "Number of ${algo}sums($numsums) does not correspond to number of sources($#)" - fi - fetch || return 1 - msg "Checking ${algo}sums..." - cd "$srcdir" || return 1 - IFS=$'\n' - endreturnval=0 - for src in $sums; do - origin=$1; shift - if ! echo "$src" | ${algo}sum -c; then - endreturnval=1 - is_remote $origin || continue - - local csum="${src:0:8}" - local file="$SRCDEST/$(filename_from_uri $origin)" - - echo "Because the remote file above failed the ${algo}sum check it will be renamed." - echo "Rebuilding will cause it to re-download which in some cases may fix the problem." - echo "Renaming: ${file##*/} to ${file##*/}.$csum" - mv "$file" "$file.$csum" - fi - done - unset IFS - return $endreturnval -} - -# for compatibility -md5check() { - warning "'md5check' is deprecated. Use 'verify' instead" - sumcheck md5 "$md5sums" -} - -# verify checksums -verify() { - local verified=false algo= - for algo in sha512 sha256 sha1 md5; do - local sums= - eval sums=\"\$${algo}sums\" - if [ -z "$sums" ] || [ -z "$source" ]; then - continue - fi - sumcheck "$algo" "$sums" || return 1 - verified=true - break - done - if [ -n "$source" ] && ! $verified; then - die "Use 'abuild checksum' to generate/update the checksum(s)" - fi - return 0 -} - -# verify upstream sources -sourcecheck() { - local uri - for uri in $source; do - is_remote $uri || continue - case "$uri" in - *::*) - uri=${uri##*::} - ;; - esac - wget --spider -q "$uri" || return 1 - done - return 0 -} - -uri_fetch() { - local uri="$1" - mkdir -p "$SRCDEST" - msg "Fetching $uri" - abuild-fetch -d "$SRCDEST" "$uri" -} - -is_remote() { - case "${1#*::}" in - http://*|ftp://*|https://*) - return 0;; - esac - return 1 -} - -filename_from_uri() { - local uri="$1" - local filename="${uri##*/}" # $(basename $uri) - case "$uri" in - *::*) filename=${uri%%::*};; - esac - echo "$filename" -} - -# try download from file from mirror first -uri_fetch_mirror() { - local uri="$1" - if [ -n "$DISTFILES_MIRROR" ]; then - if is_remote "$DISTFILES_MIRROR"; then - uri_fetch "$DISTFILES_MIRROR"/$(filename_from_uri $uri)\ - && return 0 - else - cp "$DISTFILES_MIRROR"/$(filename_from_uri $uri) \ - "$SRCDEST" && return 0 - fi - fi - uri_fetch "$uri" -} - -symlinksrc() { - local s - mkdir -p "$srcdir" - for s in $source; do - if is_remote "$s"; then - ln -sf "$SRCDEST/$(filename_from_uri $s)" "$srcdir"/ - else - ln -sf "$startdir/$s" "$srcdir/" - fi - done -} - -default_fetch() { - local s - mkdir -p "$srcdir" - for s in $source; do - if is_remote "$s"; then - uri_fetch_mirror "$s" || return 1 - ln -sf "$SRCDEST/$(filename_from_uri $s)" "$srcdir"/ - else - ln -sf "$startdir/$s" "$srcdir/" - fi - done -} - -fetch() { - default_fetch -} - -# verify that all init.d scripts are openrc runscripts -initdcheck() { - local i line - for i in $source; do - case $i in - *.initd) line=$(head -n 1 "$srcdir"/$i);; - *) continue ;; - esac - - case "$line" in - *sbin/openrc-run) - ;; - *sbin/runscript) - warning "$i is not an openrc #!/sbin/openrc-run" - ;; - *) error "$i is not an openrc #!/sbin/openrc-run" - return 1 - ;; - esac - done -} - -# unpack the sources -default_unpack() { - local u - verify || return 1 - initdcheck || return 1 - mkdir -p "$srcdir" - local gunzip=$(command -v pigz || echo gunzip) - [ $gunzip = "/usr/bin/pigz" ] && gunzip="$gunzip -d" - for u in $source; do - local s - if is_remote "$u"; then - s="$SRCDEST/$(filename_from_uri $u)" - else - s="$startdir/$u" - fi - case "$s" in - *.tar) - msg "Unpacking $s..." - tar -C "$srcdir" -xf "$s" || return 1;; - *.tar.gz|*.tgz) - msg "Unpacking $s..." - $gunzip -c "$s" | tar -C "$srcdir" -x || return 1;; - *.tar.bz2) - msg "Unpacking $s..." - tar -C "$srcdir" -jxf "$s" || return 1;; - *.tar.lz) - msg "Unpacking $s..." - tar -C "$srcdir" --lzip -xf "$s" || return 1;; - *.tar.lzma) - msg "Unpacking $s..." - unlzma -T 0 -c "$s" | tar -C "$srcdir" -x \ - || return 1;; - *.tar.xz) - msg "Unpacking $s..." - local threads_opt - if [ $(readlink -f $(command -v unxz)) != "/bin/busybox" ]; then - threads_opt="--threads=0" - fi - unxz $threads_opt -c "$s" | tar -C "$srcdir" -x || return 1;; - *.zip) - msg "Unpacking $s..." - unzip -n -q "$s" -d "$srcdir" || return 1;; - esac - done -} - -unpack() { - default_unpack -} - -# cleanup source and package dir -clean() { - msg "Cleaning temporary build dirs..." - rm -rf "$srcdir" - rm -rf "$pkgbasedir" -} - -# cleanup fetched sources -cleancache() { - local s - for s in $source; do - if is_remote "$s"; then - s=$(filename_from_uri $s) - msg "Cleaning downloaded $s ..." - rm -f "$SRCDEST/$s" - fi - done -} - -subpkg_unset() { - unset subpkgname subpkgsplit subpkgarch -} - -subpkg_set() { - subpkgname=${1%%:*} - - local _splitarch=${1#*:} - [ "$_splitarch" = "$1" ] && _splitarch="" - - subpkgsplit=${_splitarch%%:*} - [ -z "$subpkgsplit" ] && subpkgsplit="${subpkgname##*-}" - - subpkgarch=${_splitarch#*:} - if [ "$subpkgarch" = "$_splitarch" -o -z "$subpkgarch" ]; then - case "$subpkgname" in - *-doc | *-openrc | *-lang | *-lang-*) subpkgarch="noarch" ;; - *) subpkgarch="$pkgarch" ;; - esac - fi -} - -cleanpkg() { - local i - getpkgver || return 1 - msg "Cleaning built packages..." - rm -f "$REPODEST/$repo/src/$pkgname-$pkgver-r$pkgrel.src.tar.gz" - for i in $allpackages; do - subpkg_set "$i" - rm -f "$REPODEST/$repo/${subpkgarch/noarch/$CARCH}/$subpkgname-$pkgver-r$pkgrel.apk" - done - subpkg_unset - - # remove given packages from index - update_abuildrepo_index -} - -# clean all packages except current -cleanoldpkg() { - local i j - getpkgver || return 1 - msg "Cleaning all packages except $pkgver-r$pkgrel..." - for i in $allpackages; do - subpkg_set "$i" - for j in "$REPODEST"/$repo/*/$subpkgname-[0-9]*.apk ; do - [ "${j##*/}" = "$subpkgname-$pkgver-r$pkgrel.apk" ] \ - && continue - rm -f "$j" - done - done - subpkg_unset - update_abuildrepo_index - return 0 -} - -mkusers() { - local i - for i in $pkggroups; do - if ! getent group $i >/dev/null; then - msg "Creating group $i" - $ADDGROUP -S $i || return 1 - fi - done - for i in $pkgusers; do - if ! getent passwd $i >/dev/null; then - local gopt= - msg "Creating user $i" - if getent group $i >/dev/null; then - gopt="-G $i" - fi - $ADDUSER -S -D -H $gopt $i || return 1 - fi - done -} - -# helper to update config.sub to a recent version -update_config_sub() { - find . -name config.sub | (local changed=false; while read f; do - if ! ./$f armv6-alpine-linux-muslgnueabihf 2>/dev/null; then - msg "Updating $f" - cp "$datadir"/${f##*/} "$f" || return 1 - changed=true - else - msg "No update needed for $f" - fi - done; $changed) -} - -# helper to update config.guess to a recent version -update_config_guess() { - find . -name config.guess | (local changed=false; while read f; do - if grep -q aarch64 "$f" && grep -q ppc64le "$f"; then - msg "No update needed for $f" - else - msg "Updating $f" - cp "$datadir"/${f##*/} "$f" || return 1 - changed=true - fi - done; $changed) -} - -runpart() { - local part=$1 - [ -n "$DEBUG" ] && msg "$part" - trap "die '$part failed'" EXIT - $part - trap - EXIT -} - -# override those in your build script -getpkgver() { - # this func is supposed to be overridden by volatile packages - if [ "$pkgver" = "volatile" ]; then - error "Please provide a getpkgver() function in your APKBUILD" - return 1 - fi -} - -have_patches() { - local i - for i in $source; do - case ${i%::*} in - *.patch) return 0;; - esac - done - return 1 -} - -default_prepare() { - local i - [ -n "$builddir" -a -d "$builddir" ] && cd "$builddir" - if ! have_patches; then - return 0 - fi - [ -d "$builddir" ] || { error "Is \$builddir set correctly?"; return 1; } - for i in $source; do - case ${i%::*} in - *.patch) - msg "${i%::*}" - patch ${patch_args:--p1} -i "$srcdir/${i%::*}" || return 1 - ;; - esac - done -} - -prepare() { - default_prepare -} - -build() { - : -} - -# generate a simple tar.gz package of pkgdir -targz() { - cd "$pkgdir" || return 1 - mkdir -p "$REPODEST"/src - tar -czf "$REPODEST"/src/$pkgname-$pkgver-r$pkgrel.tar.gz * -} - -postcheck() { - local dir="$1" name="$2" i= - msg "Running postcheck for $name" - # checking for FHS compat - if ! options_has "!fhs"; then - for i in "$dir"/srv/* "$dir"/usr/local/* "$dir"/opt/*; do - if [ -e "$i" ]; then - error "Packages must not put anything under /srv, /usr/local or /opt" - return 1 - fi - done - if [ -d "$dir"/usr/var ]; then - error "Found /usr/var, localstatedir is most likely wrong" - return 1 - fi - fi - - # remove *.la files if libtool is not set - if ! options_has "libtool"; then - find "$dir" -name '*.la' -type f -delete - fi - - # look for /usr/lib/charset.alias - if [ -e "$dir"/usr/lib/charset.alias ] \ - && ! options_has "charset.alias"; then - error "Found /usr/lib/charset.alias" - return 1 - fi - # look for /etc/init.d and /etc/conf.d - if [ -e "$dir"/etc/init.d -o -e "$dir"/etc/conf.d ] \ - && ! is_openrc_pkg "$name"; then - warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc" - fi - # look for /usr/share/doc - if [ -e "$dir"/usr/share/doc ] \ - && ! is_doc_pkg "$name"; then - warning "Found /usr/share/doc but package name doesn't end with -doc" - fi - # look for /usr/share/man - if [ -e "$dir"/usr/share/man ]; then - if ! is_doc_pkg "$name"; then - warning "Found /usr/share/man but package name doesn't end with -doc" - fi - # check for uncompressed man pages - i=$(find "$dir"/usr/share/man -name '*.[0-8]' -type f | sed "s|^$dir|\t|") - if [ -n "$i" ]; then - error "Found uncompressed man pages:" - echo "$i" - return 1 - fi - fi - # check directory permissions - i=$(find "$dir" -type d -perm -777 | sed "s|^$dir|\t|") - if [ -n "$i" ]; then - warning "World writeable directories found:" - echo "$i" - fi - # check so we dont have any suid root binaries that are not PIE - i=$(find "$dir" -type f -perm /6000 \ - | xargs scanelf --nobanner --etype ET_EXEC \ - | sed "s|ET_EXEC $dir|\t|") - if [ -n "$i" ]; then - error "Found non-PIE files that has SUID:" - echo "$i" - return 1 - fi - # test suid bit on executable - if ! options_has "suid"; then - i=$(find "$dir" \( -perm -u+s -o -perm -g+s \) -a -type f \ - -a -perm -o+x) - if [ -n "$i" ]; then - error "Found executable files with SUID bit set:" - echo "$i" - return 1 - fi - fi - - # test for textrels - if ! options_has "textrels"; then - local res="$(scanelf --recursive --textrel --quiet "$dir")" - if [ -n "$res" ]; then - error "Found textrels:" - echo "$res" - return 1 - fi - fi - return 0 -} - -pre_split() { - if [ -z "$subpkgname" ]; then - return 0 - fi - # the subpackages should not inherit those from main package - provides="" - install_if="" -} - -prepare_subpackages() { - local i - cd "$startdir" - for i in $subpackages; do - # call abuild recursively, setting subpkg{dir,name} - ( subpkg_set "$i"; msg "Running split function $subpkgsplit..."; \ - subpkgdir="$pkgbasedir/$subpkgname" subpkgname="$subpkgname" subpkgarch="$subpkgarch" \ - "$abuild_path" $forceroot pre_split $subpkgsplit prepare_package \ - && postcheck "$pkgbasedir/$subpkgname" "$subpkgname" ) || return 1 - done - postcheck "$pkgdir" "$pkgname" || return 1 - # post check for /usr/share/locale - if [ -d "$pkgdir"/usr/share/locale ]; then - warning "Found /usr/share/locale" - warning2 "Maybe add \$pkgname-lang to subpackages?" - fi -} - -default_lang() { - pkgdesc="Languages for package $pkgname" - install_if="$pkgname=$pkgver-r$pkgrel lang" - - local dir - for dir in ${langdir:-/usr/share/locale}; do - mkdir -p "$subpkgdir"/${dir%/*} - mv "$pkgdir"/"$dir" "$subpkgdir"/"$dir" || return 1 - done -} - -lang() { - default_lang -} - -default_lang_subpkg() { - if [ -z "$lang" ]; then - error "lang is not set" - return 1 - fi - pkgdesc="$pkgname language pack for $lang" - install_if="$pkgname=$pkgver-r$pkgrel lang-$lang" - - local dir - for dir in ${langdir:-/usr/share/locale}; do - mkdir -p "$subpkgdir"/$dir - mv "$pkgdir"/$dir/$lang* \ - "$subpkgdir"/$dir/ \ - || return 1 - done -} - -lang_subpkg() { - default_lang_subpkg -} - -prepare_language_packs() { - local lang - for lang in $linguas; do - lang="$lang" \ - subpkgname="$pkgname-lang-$lang" \ - subpkgdir="$pkgbasedir"/$subpkgname \ - "$abuild_path" $forceroot lang_subpkg prepare_package || return 1 - done -} - -# echo '-dirty' if git is not clean -git_dirty() { - [ $($git status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty" -} - -# echo last commit hash id -git_last_commit() { - $git log --format=oneline -n 1 "$startdir" | awk '{print $1}' -} - -get_maintainer() { - if [ -z "$maintainer" ]; then - maintainer=$(awk -F': ' '/\# *Maintainer/ {print $2}' "$APKBUILD") - # remove surrounding whitespace - maintainer=$(echo "$maintainer" | xargs) - fi -} - -check_maintainer() { - get_maintainer - if [ -z "$maintainer" ]; then - warning "No maintainer" - else - # try to check for a valid rfc822 address - case "$maintainer" in - *[A-Za-z0-9]*\ \<*@*.*\>) ;; - *) return 1 ;; - esac - fi -} - -check_license() { - local ret=0 - local license_list=/usr/share/spdx/license.lst - local exclude="AND OR WITH" - if options_has "!spdx" || ! [ -f "$license_list" ]; then - return 0 - fi - local i; for i in $license; do - list_has "$i" $exclude && continue - if ! grep -q -w -F "$i" "$license_list"; then - ret=1 - warning "\"$i\" is not a known license" - fi - done - return $ret -} - -check_secfixes_comment() { - local c=$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#') - local invalid=$(echo "$c" \ - | grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)') - if [ -z "$invalid" ]; then - return 0 - fi - - # check if there are tabs - if echo "$invalid" | grep -q $'\t'; then - error "secfixes comment must not have tabs:" - echo "$c" | grep $'\t' >&2 - return 1 - fi - - error "secfixes comment is not valid:" - echo "$invalid" >&2 - return 1 -} - -check_depends_dev() { - if [ -z "$depends_dev" ]; then - return 0 - fi - local i - for i in $pkgname $subpackages; do - case "${i%%:*}" in - *-dev) return 0 ;; - esac - done - return 1 -} - -check_provides() { - local i - for i in $provides; do - if [ "${i%%[<>=]*}" = "$pkgname" ]; then - return 1 - fi - done - return 0 -} - -prepare_metafiles() { - getpkgver || return 1 - local name=${subpkgname:-$pkgname} - [ -z "${name##* *}" ] && die "package name contains spaces" - local dir=${subpkgdir:-$pkgdir} - local pkg="$name-$pkgver-r$pkgrel.apk" - local pkginfo="$controldir"/.PKGINFO - local sub - - [ ! -d "$dir" ] && die "Missing $dir" - cd "$dir" - mkdir -p "$controldir" - local builddate=$(date -u "+%s") - - # Fix package size on several filesystems - case "$(df -PT . | awk 'END {print $2}')" in - btrfs|ecryptfs|zfs) - sync;; - esac - - local size=$(du -sk | awk '{print $1 * 1024}') - - if [ "$arch" != "$apkbuild_arch" ]; then - local msg="Split function set arch=\"$arch\" for $name, use subpackages=pkg:split:arch format instead" - [ "$arch" != "noarch" ] && die "$msg" - warning "$msg" - subpkgarch="$arch" - fi - - echo "# Generated by $(basename "$abuild_path") $program_version" >"$pkginfo" - if [ -n "$FAKEROOTKEY" ]; then - echo "# using $($FAKEROOT -v)" >> "$pkginfo" - fi - echo "# $(date -u)" >> "$pkginfo" - cat >> "$pkginfo" <<-EOF - pkgname = $name - pkgver = $pkgver-r$pkgrel - pkgdesc = $pkgdesc - url = $url - builddate = $builddate - packager = ${PACKAGER:-"Unknown"} - size = $size - arch = ${subpkgarch:-$pkgarch} - origin = $pkgname - EOF - local i deps - deps="$depends" - if [ "$pkgname" != "busybox" ] && ! depends_has busybox && ! depends_has /bin/sh; then - for i in $install $triggers; do - local s=${i%=*} - [ "$name" != "${s%.*}" ] && continue - if head -n 1 "$startdir/$s" | grep '^#!/bin/sh' >/dev/null ; then - msg "Script found. /bin/sh added as a dependency for $pkg" - deps="$deps /bin/sh" - break - fi - done - fi - - # store last_commit in global var so we only call git once - if [ -z "$last_commit" ]; then - last_commit="$(git_last_commit)$(git_dirty)" - fi - echo "commit = $last_commit" >> "$pkginfo" - - get_maintainer - if [ -n "$maintainer" ]; then - echo "maintainer = $maintainer" >> "$pkginfo" - fi - - if [ -n "$replaces_priority" ]; then - echo "replaces_priority = $replaces_priority" >> "$pkginfo" - fi - - if [ -n "$provider_priority" ]; then - echo "provider_priority = $provider_priority" >> "$pkginfo" - fi - - echo "license = $license" >> "$pkginfo" - for i in $replaces; do - echo "replaces = $i" >> "$pkginfo" - done - for i in $deps; do - echo "depend = $i" >> "$pkginfo" - done - for i in $provides; do - echo "provides = $i" >> "$pkginfo" - done - for i in $triggers; do - local f=${i%=*} - local dirs=${i#*=} - [ "${f%.trigger}" != "$name" ] && continue - echo "triggers = ${dirs//:/ }" >> "$pkginfo" - done - if [ -n "$install_if" ]; then - echo "install_if = $(echo $install_if)" >> "$pkginfo" - fi - - local metafiles=".PKGINFO" - for i in $install $triggers; do - local f=${i%=*} - local n=${f%.*} - if [ "$n" != "$name" ]; then - continue - fi - script=${f#$name} - msg "Adding $script" - cp "$startdir/$f" "$controldir/$script" || return 1 - chmod +x "$controldir/$script" - metafiles="$metafiles $script" - done - echo $metafiles | tr ' ' '\n' > "$controldir"/.metafiles -} - -prepare_trace_rpaths() { - local dir=${subpkgdir:-$pkgdir} - local etype= soname= file= sover= - [ "${subpkgarch:-$pkgarch}" = "noarch" ] && return 0 - options_has "!tracedeps" && return 0 - # lets tell all the places we should look for .so files - all rpaths - scanelf --quiet --recursive --rpath "$dir" \ - | sed -e 's/[[:space:]].*//' -e 's/:/\n/' | sort -u \ - >"$controldir"/.rpaths - if grep -q -x '/usr/lib' "$controldir"/.rpaths; then - warning "Redundant /usr/lib in rpath found" - fi - if grep '^/home/' "$controldir"/.rpaths; then - error "Has /home/... in rpath" - return 1 - fi -} - -# search for broken symlinks so we later can pull in proper depends -prepare_symlinks() { - local target - local dir="${subpkgdir:-$pkgdir}" - options_has "!tracedeps" && return 0 - cd "$dir" || return 1 - find -type l | while read symlink; do - target=$(readlink "$symlink") - if ! [ -e "$dir$(normalize_target_path "$target" "$symlink")" ]; then - echo "$symlink $target" >> "$controldir"/.symlinks - fi - done -} - -prepare_pkgconfig_provides() { - local dir="${subpkgdir:-$pkgdir}" - options_has "!tracedeps" && return 0 - cd "$dir" || return 1 - for i in usr/lib/pkgconfig/*.pc; do - if ! [ -e "$i" ]; then - continue - fi - local f=${i##*/} - local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \ - --modversion ${f%.pc}) - echo "${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc - done -} - -prepare_command_provides() { - local dir="${subpkgdir:-$pkgdir}" - options_has "!tracedeps" && return 0 - cd "$dir" || return 1 - for i in bin/* sbin/* usr/bin/* usr/sbin/*; do - if ! [ -x "$i" ]; then - continue - fi - local f=${i##*/} - echo $f >> "$controldir"/.provides-command - done -} - -# check if dir has arch specific binaries -dir_has_arch_binaries() { - local dir="$1" - # if scanelf returns something, then we have binaries - [ -n "$(scanelf -R "$dir" | head -n 1)" ] && return 0 - - # look for static *.a - [ -n "$(find "$dir" -type f -name '*.a' | head -n 1)" ] && return 0 - - return 1 -} - -# returns true if this is the -dev package -is_dev_pkg() { - test "${subpkgname%-dev}" != "$subpkgname" -} - -# returns true if this is the -doc package -is_doc_pkg() { - test "${1%-doc}" != "$1" -} - -# returns true if this is the -openrc package -is_openrc_pkg() { - test "${1%-openrc}" != "$1" -} - -# check that noarch is set if needed -archcheck() { - options_has "!archcheck" && return 0 - if dir_has_arch_binaries "${subpkgdir:-$pkgdir}"; then - [ "${subpkgarch:-$pkgarch}" != "noarch" ] && return 0 - error "Arch specific binaries found so arch must not be set to \"noarch\"" - return 1 - elif [ "${subpkgarch:-$pkgarch}" != "noarch" ] && ! is_dev_pkg; then - # we dont want -dev package go to noarch - warning "No arch specific binaries found so arch should probably be set to \"noarch\"" - fi - return 0 -} - -prepare_package() { - msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..." - stripbin - prepare_metafiles \ - && prepare_trace_rpaths \ - && prepare_symlinks \ - && prepare_pkgconfig_provides \ - && prepare_command_provides \ - || return 1 - archcheck -} - -pkginfo_val() { - local key="$1" - local file="$2" - awk -F ' = ' "\$1 == \"$key\" {print \$2}" "$file" -} - -# find real path to so files -real_so_path() { - local so="$1" - shift - while [ $# -gt 0 ]; do - [ -e "$1"/$so ] && realpath "$1/$so" && return 0 - shift - done - error "$so: path not found" - return 1 -} - -# search rpaths and /usr/lib /lib for given so files -find_so_files() { - local rpaths=$(cat "$1") - shift - while [ $# -gt 0 ]; do - real_so_path "$1" /usr/lib /lib $rpaths || return 1 - shift - done - return 0 -} - -subpkg_provides_prefixed_so() { - [ -n "$sonameprefix" ] && grep -q -w "^$sonameprefix$1" \ - "$pkgbasedir"/.control.*/.provides-so 2>/dev/null -} - -subpkg_provides_so() { - grep -q -w "^$1" "$pkgbasedir"/.control.*/.provides-so 2>/dev/null -} - -subpkg_provides_pc() { - grep -q -w "^${1%%[<>=]*}" "$pkgbasedir"/.control.*/.provides-pc \ - 2>/dev/null -} - -trace_apk_deps() { - local name="$1" - local dir="$2" - local parch="$3" - local i= found= autodeps= deppkgs= missing= - local apkroot= - - case "$parch" in - $CBUILD_ARCH) ;; - $CARCH | $CTARGET_ARCH) apkroot="--root $CBUILDROOT --arch $CTARGET_ARCH" ;; - esac - - msg "Tracing dependencies..." - # add pkgconfig if usr/lib/pkgconfig is found - if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] \ - && ! grep -q '^depend = pkgconfig' "$dir"/.PKGINFO; then - autodeps="$autodeps pkgconfig" - fi - - # special case for libpthread: we need depend on libgcc - if [ "$CLIBC" = "uclibc" ] && [ -f "$dir"/.needs-so ] \ - && grep -q -w '^libpthread.so.*' "$dir"/.needs-so \ - && ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then - autodeps="$autodeps libgcc" - msg " added libgcc (due to libpthread)" - fi - - [ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do - # first check if its provided by same apkbuild - grep -q -w "^$sonameprefix$i" "$dir"/.provides-so 2>/dev/null && continue - - if subpkg_provides_prefixed_so "$i"; then - autodeps="$autodeps so:$sonameprefix$i" - elif subpkg_provides_so "$i" \ - || $APK $apkroot info --quiet --installed "so:$i"; then - autodeps="$autodeps so:$i" - else - missing="$missing $i" - fi - done - - # find all packages that holds the so files - if [ -f "$dir"/.rpaths ]; then - local so_files=$(find_so_files "$dir"/.rpaths $missing) \ - || return 1 - deppkgs=$($APK $apkroot info --quiet --who-owns $so_files) || return 1 - fi - - for found in $deppkgs; do - if grep -w "^depend = ${found}$" "$dir"/.PKGINFO >/dev/null ; then - warning "You can remove '$found' from depends" - continue - fi - autodeps="$autodeps $found" - done - - # symlink targets - for i in $(sort -u "$dir"/.symlinks-needs 2>/dev/null); do - autodeps="$autodeps $i" - done - - # pkg-config depends - for i in $(sort -u "$dir"/.needs-pc 2>/dev/null); do - if subpkg_provides_pc "$i" \ - || $APK $apkroot info --quiet --installed "pc:$i"; then - local provider=$(apk $apkroot search --quiet "pc:$i") - if list_has "$provider" $depends_dev; then - warning "$provider should be removed from depends_dev" - fi - autodeps="$autodeps pc:$i" - else - warning "Could not find any provider for pc:$i" - local pcfile=/usr/lib/pkgconfig/"${i%%[<>=]*}".pc - if [ -e "$pcfile" ]; then - local owner=$($APK $apkroot info --quiet --who-owns $pcfile) - warning "${owner:-package providing $pcfile} needs to be rebuilt" - fi - fi - done - - echo "# automatically detected:" >> "$dir"/.PKGINFO - if [ -f "$dir"/.provides-so ]; then - sed 's/^\(.*\) \([0-9].*\)/provides = so:\1=\2/' \ - "$dir"/.provides-so | sort -u \ - >> "$dir"/.PKGINFO - fi - if [ -f "$dir"/.provides-pc ]; then - sed 's/^/provides = pc:/' "$dir"/.provides-pc | sort -u \ - >> "$dir"/.PKGINFO - fi - if [ -f "$dir"/.provides-command ]; then - sed 's/^/provides = cmd:/' "$dir"/.provides-command | sort -u \ - >> "$dir"/.PKGINFO - fi - [ -z "$autodeps" ] && return 0 - for i in $autodeps; do - echo "depend = $i" - done | sort -u >> "$dir"/.PKGINFO - # display all depends - sed -n '/^depend =/s/depend = /\t/p' "$dir"/.PKGINFO >&2 -} - -find_scanelf_paths() { - local datadir="$1" - local paths="$datadir/lib:$datadir/usr/lib" i= rpaths= - if [ -n "$ldpath" ]; then - paths="$paths:$(echo "${datadir}${ldpath}" | sed "s|:|:$datadir|g")" - fi - # search in all rpaths - for rpaths in "$pkgbasedir"/.control.*/.rpaths; do - [ -f "$rpaths" ] || continue - while read i; do - local dir="${datadir}${i}" - IFS=: - if [ -d "$dir" ] && ! list_has "$dir" $paths; then - paths="$paths:${dir}" - fi - unset IFS - done < "$rpaths" - done - echo "$paths" -} - -scan_shared_objects() { - local name="$1" controldir="$2" datadir="$3" - local opt= i= - - if [ "${subpkgarch:-$pkgarch}" = "noarch" ]; then - return 0 - fi - - # allow spaces in paths - IFS=: - set -- $(find_scanelf_paths "$datadir") - unset IFS - - # sanity check, verify that each path is prefixed with datadir - for i; do - if [ "${i#$datadir}" = "$i" ]; then - error "Internal error in scanelf paths" - return 1 - fi - done - - if options_has "ldpath-recursive"; then - opt="--recursive" - fi - msg "Scanning shared objects" - # lets tell all the .so files this package provides in .provides-so - scanelf --nobanner --soname $opt "$@" | while read etype soname file; do - # if soname field is missing, soname will be the filepath - sover=0 - if [ -z "$file" ]; then - file="$soname" - soname=${soname##*/} - fi - - # we only want shared libs - case $soname in - *.so|*.so.[0-9]*|*.c32);; - *) continue;; - esac - - case "$file" in - *.so.[0-9]*) sover=${file##*.so.};; - *.so) - # filter out sonames with version when file does not - # have version - case "$soname" in - *.so.[0-9]*) - if options_has "sover-namecheck"; then - continue - fi - esac - ;; - esac - list_has "$soname" $somask && continue - echo "$sonameprefix$soname $sover" - # use awk to filter out dupes that has sover = 0 - done | awk '{ if (so[$1] == 0) so[$1] = $2; } - END { for (i in so) print(i " " so[i]); }' \ - | sort -u > "$controldir"/.provides-so - - # verify that we dont have any duplicates - local dupes="$(cut -d' ' -f1 "$controldir"/.provides-so | uniq -d)" - if [ -n "$dupes" ]; then - die "provides multiple versions of same shared object: $dupes" - fi - - # now find the so dependencies - scanelf --nobanner --recursive --needed "$datadir" | tr ' ' ':' \ - | awk -F ":" '$2 != "" && ($1 == "ET_DYN" || $1 == "ET_EXEC") {print $2}' \ - | sed 's:,:\n:g' | sort -u \ - | while read soname; do - # only add files that are not self provided - grep -q -w "^$sonameprefix$soname" "$controldir"/.provides-so \ - || list_has "$soname" $somask \ - || echo $soname - done > "$controldir"/.needs-so -} - -# normalize a symlink target path (1st arg) -# Converts a relative path to absolute with respect to the symlink -# path (2nd arg). -normalize_target_path() { - local path=$1 - [ "${path:0:1}" = / ] || path=$(dirname "$2")/$path - - local oifs="$IFS" pathstr= i= - IFS='/' - set -- $path - for i; do - case "$i" in - "."|"") continue;; - "..") pathstr="${pathstr%%/${pathstr##*/}}";; - *) pathstr="${pathstr}/$i";; - esac - done - echo "$pathstr" -} - -# find which package provides file that symlink points to -scan_symlink_targets() { - local name="$1" dir="$2" datadir="$3" - local symfile= targetpath= - cd "$datadir" - for symfile in "$pkgbasedir"/.control.*/.symlinks; do - local d="${symfile%/.symlinks}" - if ! [ -e "$symfile" ] || [ "$d" = "$dir" ]; then - continue - fi - - while read symlink target; do - targetpath=$datadir$(normalize_target_path "$target" "$symlink") - if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then - echo "$name=$pkgver-r$pkgrel" \ - >> "$d"/.symlinks-needs - fi - done < "$symfile" - done -} - -#find pkg-config dependencies -scan_pkgconfig_depends() { - local provides_pc="$1" controldir= name= datadir= - [ -e "$provides_pc" ] || return 0 - controldir="${provides_pc%/*}" - name="$(pkginfo_val pkgname "$controldir"/.PKGINFO)" - datadir="$pkgbasedir"/$name - for i in $(sort -u "$provides_pc"); do - PKG_CONFIG_PATH="$datadir"/usr/lib/pkgconfig pkg-config \ - --print-requires \ - --print-requires-private ${i%=*} \ - | sed -E 's/\s*([<>=]+)\s*/\1/' \ - | while read pc; do - # only add files that are not self provided - if ! grep -q -w "^${pc%%[<>=]*}" "$provides_pc"; then - echo "$pc" >> "$controldir"/.needs-pc - fi - done - done -} - -# read size in bytes from stdin and show as human readable -human_size() { - awk '{ split("B KB MB GB TB PB", type) - for(i=5; y < 1 && $1 > 0; i--) - y = $1 / (2^(10*i)) - printf("%.1f %s\n", y, type[i+2]) }' -} - -create_apks() { - local file= dir= name= ver= apk= datadir= size= - getpkgver || return 1 - if ! options_has "!tracedeps"; then - for file in "$pkgbasedir"/.control.*/.PKGINFO; do - dir="${file%/.PKGINFO}" - name="$(pkginfo_val pkgname $file)" - datadir="$pkgbasedir"/$name - subpkgname=$name - scan_shared_objects "$name" "$dir" "$datadir" - scan_symlink_targets "$name" "$dir" "$datadir" - done - for file in "$pkgbasedir"/.control.*/.provides-pc; do - scan_pkgconfig_depends "$file" - done - fi - - for file in "$pkgbasedir"/.control.*/.PKGINFO; do - local dir="${file%/.PKGINFO}" - local name=$(pkginfo_val pkgname $file) - local ver=$(pkginfo_val pkgver $file) - local size=$(pkginfo_val size $file | human_size) - local apk=$name-$ver.apk - local datadir="$pkgbasedir"/$name - local subpkgname=$name - local subpkgarch=$(pkginfo_val arch $file) - - trace_apk_deps "$name" "$dir" "$subpkgarch" || return 1 - msg "Package size: ${size}" - msg "Compressing data..." - ( - cd "$datadir" - # data.tar.gz - set -- * - if [ "$1" = '*' ]; then - touch .dummy - set -- .dummy - fi - tar --xattrs -f - -c "$@" | abuild-tar --hash | gzip -9 >"$dir"/data.tar.gz - - msg "Create checksum..." - # append the hash for data.tar.gz - local sha256=$(sha256sum "$dir"/data.tar.gz | cut -f1 -d' ') - echo "datahash = $sha256" >> "$dir"/.PKGINFO - - # control.tar.gz - cd "$dir" - tar -f - -c $(cat "$dir"/.metafiles) | abuild-tar --cut \ - | gzip -9 > control.tar.gz - abuild-sign -q control.tar.gz || exit 1 - - msg "Create $apk" - mkdir -p "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH} - cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}/$apk - ) - done -} - -build_abuildrepo() { - local d apk _build=build _check=check_fakeroot - if ! is_function package; then - # if package() is missing then build is called from rootpkg - _build=true - fi - if options_has "!checkroot"; then - _check=check - fi - if ! want_check; then - _check=true - fi - if ! apk_up2date || [ -n "$force" ]; then - print_version - # check early if we have abuild key - abuild-sign --installed - logcmd "building $repo/$pkgname-$pkgver-r$pkgrel" - sanitycheck - builddeps - clean - fetch - unpack - prepare - mkusers - $_build - $_check - rootpkg - cleanup $CLEANUP - fi - update_abuildrepo_index -} - -update_abuildrepo_index() { - local i allarch="" - for i in $allpackages; do - subpkg_set "$i" - ##NOARCH: These packages are really in $CARCH and do not need their - # own repository. --rewrite-arch is used below to make sure the index - # thinks they are for $CARCH and apk-tools will fetch them from - # correct URL path. Remainder of the script uses ${subpkgarch/noarch/$CARCH} - # when expanding to the target repository path. - [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH" - list_has "$subpkgarch" "$allarch" || allarch="$allarch $subpkgarch" - done - subpkg_unset - - if [ -z "$DESCRIPTION" ]; then - DESCRIPTION="$repo $(cd $startdir && $git describe 2>/dev/null || true)" - fi - - for i in $allarch; do - cd "$REPODEST/$repo/$i" - local index=$i/APKINDEX.tar.gz - - msg "Updating the $repo/$i repository index..." - local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}" - local oldindex= - if [ -f APKINDEX.tar.gz ]; then - oldindex="--index APKINDEX.tar.gz" - fi - ( $APK index --quiet $oldindex --output APKINDEX.tar.gz.$$ \ - --description "$DESCRIPTION" --rewrite-arch $i *.apk && \ - msg "Signing the index..." && \ - abuild-sign -q APKINDEX.tar.gz.$$ && \ - chmod 644 APKINDEX.tar.gz.$$ && \ - mv APKINDEX.tar.gz.$$ APKINDEX.tar.gz \ - ) || (rm -f APKINDEX.tar.gz.$$ ; die "Failed to create index") - done -} - -# predefined function check -default_check() { - warning "APKBUILD does not run any tests!" - msg2 "Alpine policy will soon require that packages have any relevant testsuites run during the build process." - msg2 "To fix, either define a check() function, or declare !check in \$options to indicate the package does not have a testsuite." -} - -check() { - default_check -} - -# predefined splitfunc doc -default_doc() { - depends="$depends_doc" - pkgdesc="$pkgdesc (documentation)" - install_if="docs $pkgname=$pkgver-r$pkgrel" - - local i - for i in doc man info html sgml licenses gtk-doc ri help; do - if [ -d "$pkgdir/usr/share/$i" ]; then - mkdir -p "$subpkgdir/usr/share" - mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/" - fi - done - - # compress man pages - local mandir="$subpkgdir"/usr/share/man - [ -d "$mandir" ] && find "$mandir" -type l \ - -a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \ - -a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \ - | while read symlink; do - - ln -s $(readlink $symlink).gz "$symlink".gz - rm -f "$symlink" - done - [ -d "$mandir" ] && find "$mandir" -type f \ - -a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \ - -a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \ - -exec stat -c "%i %n" \{\} \+ | while read inode name; do - - # Skip hardlinks removed in last iteration. - [ -f "$name" ] || continue - - local islink=0 - find "$mandir" -type f -links +1 \ - -a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \ - -a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \ - -exec stat -c "%i %n" \{\} \+ | while read linode lname; do - if [ "$linode" = "$inode" -a "$lname" != "$name" ]; then - islink=1 - rm -f "$lname" - ln -s "${name##*/}".gz "$lname".gz - fi - done - - [ $islink -eq 0 ] && gzip -9 "$name" - done - - rm -f "$subpkgdir/usr/share/info/dir" - - # remove if empty, ignore error (not empty) - rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || : -} - -doc() { - default_doc -} - -# predefined splitfunc dbg -default_dbg() { - local f - pkgdesc="$pkgdesc (debug symbols)" - - binfiles=$(scanelf -R "$pkgdir" | grep ET_DYN | sed "s:$pkgdir\/::g" | sed "s:ET_DYN ::g") - for f in $binfiles; do - srcdir=$(dirname $pkgdir/$f) - srcfile=$(basename $pkgdir/$f) - dstdir=$(dirname $subpkgdir/usr/lib/debug/$f.debug) - dstfile=$(basename $subpkgdir/usr/lib/debug/$f.debug) - if [ ! -d $dstdir ] ; then - mkdir -p $dstdir - fi - cd $srcdir - local XATTR=$(getfattr --match="" --dump "${srcfile}") - ${CROSS_COMPILE}objcopy --only-keep-debug $srcfile $dstfile - ${CROSS_COMPILE}objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile - mv $dstfile $dstdir - ${CROSS_COMPILE}strip $srcfile - [ -n "$XATTR" ] && { echo "$XATTR" | setfattr --restore=-; } - done - return 0 -} - -dbg() { - default_dbg -} - -# predefined splitfunc dev -default_dev() { - local i= j= - depends="$depends_dev" - pkgdesc="$pkgdesc (development files)" - - cd "$pkgdir" || return 0 - local libdirs=usr/ - [ -d lib/ ] && libdirs="lib/ $libdirs" - for i in usr/include usr/lib/pkgconfig usr/share/aclocal\ - usr/share/gettext usr/bin/*-config \ - usr/share/vala/vapi usr/share/gir-[0-9]*\ - usr/share/qt*/mkspecs \ - usr/lib/qt*/mkspecs \ - usr/lib/cmake \ - $(find . -name include -type d) \ - $(find $libdirs -name '*.[acho]' \ - -o -name '*.prl' 2>/dev/null); do - if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then - d="$subpkgdir/${i%/*}" # dirname $i - mkdir -p "$d" - mv "$pkgdir/$i" "$d" - rmdir "$pkgdir/${i%/*}" 2>/dev/null || : - fi - done - # move *.so links needed when linking the apps to -dev packages - for i in lib/*.so usr/lib/*.so; do - if [ -L "$i" ]; then - mkdir -p "$subpkgdir"/"${i%/*}" - mv "$i" "$subpkgdir/$i" || return 1 - fi - done - return 0 -} - -dev() { - default_dev -} - -# predefined splitfunc libs -default_libs() { - pkgdesc="$pkgdesc (libraries)" - local dir= file= - for dir in lib usr/lib; do - for file in "$pkgdir"/$dir/lib*.so.[0-9]*; do - [ -f "$file" ] || continue - mkdir -p "$subpkgdir"/$dir - mv "$file" "$subpkgdir"/$dir/ - done - done -} - -libs() { - default_libs -} - -# predefined splitfunc openrc -default_openrc() { - pkgdesc="$pkgdesc (OpenRC init scripts)" - install_if="openrc $pkgname=$pkgver-r$pkgrel" - local dir file - for dir in conf.d init.d; do - if [ -d "$pkgdir/etc/$dir" ]; then - mkdir -p "$subpkgdir"/etc - mv "$pkgdir/etc/$dir" "$subpkgdir"/etc/ - fi - done - return 0 -} - -openrc() { - default_openrc -} - - -is_function() { - type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function" -} - -do_fakeroot() { - if [ -n "$FAKEROOT" ]; then - $FAKEROOT -- "$@" - else - "$@" - fi -} - -# wrap check() with fakeroot -check_fakeroot() { - cd "$startdir" - [ -n "$FAKEROOT" ] && msg "Entering fakeroot..." - do_fakeroot "$abuild_path" $forceroot $color_opt $keep_build check -} - -# build and package in fakeroot -rootpkg() { - local _package=package - if ! is_function package; then - # if package() is missing then run 'build' in fakeroot instead - warning "No package() function in APKBUILD" - _package=build - fi - cd "$startdir" - rm -rf "$pkgdir" - [ -n "$FAKEROOT" ] && msg "Entering fakeroot..." - do_fakeroot "$abuild_path" $forceroot $color_opt $keep_build \ - $_package \ - prepare_subpackages \ - prepare_language_packs \ - prepare_package \ - create_apks -} - -srcpkg() { - echo "Ensuring source is fetched" - fetch - getpkgver || return 1 - local p="$pkgname-$pkgver-$pkgrel" - local prefix="${startdir##*/}" - local i files="$prefix/APKBUILD" - for i in $source; do - echo "Packaging source file: $i" - if [ ! -e $(filename_from_uri $i) ]; then - cp $srcdir/$(filename_from_uri $i) $(filename_from_uri $i) - fi - files="$files $prefix/$(filename_from_uri $i)" - done - - for i in $install; do - echo "Packaging install file: $i" - files="$files $prefix/$i" - done - - for i in $triggers; do - local f=${i%=*} - echo "Packaging trigger file: $f" - files="$files $prefix/$f" - done - - mkdir -p "$REPODEST/src" - msg "Creating source package $p.src.tar.gz..." - (cd .. && tar -zcf "$REPODEST/src/$p.src.tar.gz" $files) -} - -# return true if arch is supported or noarch -check_arch() { - local ret=1 - local i - for i in $arch; do - case $i in - all | noarch) ret=0 ;; - "$CARCH") ret=0 ;; - "!$CARCH") return 1 ;; - esac - done - return $ret -} - -# return true if libc is not masked in options -check_libc() { - ! list_has "!libc_$CLIBC" $options -} - -# check if package is up to date -apk_up2date() { - getpkgver || return 1 - - local i s - for i in $allpackages; do - subpkg_set "$i" - if [ ! -f "$REPODEST/$repo/${subpkgarch/noarch/$CARCH}/$subpkgname-$pkgver-r$pkgrel.apk" ]; then - subpkg_unset - return 1 - fi - done - subpkg_unset - [ -n "$keep" ] && return 0 - - cd "$startdir" - for i in $source APKBUILD; do - if is_remote "$i"; then - s="$SRCDEST/$(filename_from_uri $i)" - else - s="$startdir/${i##*/}" - fi - if [ "$s" -nt "$REPODEST/$repo/${pkgarch/noarch/$CARCH}/$pkgname-$pkgver-r$pkgrel.apk" ]; then - return 1 - fi - done - return 0 -} - -abuildindex_up2date() { - local i - getpkgver || return 1 - - for i in $allpackages; do - subpkg_set "$i" - local dir="$REPODEST"/$repo/${subpkgarch/noarch/$CARCH} - local idx="$dir"/APKINDEX.tar.gz - local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk - - # if any file is missing or .apk is newer then index - # the index needs to be updated - if [ ! -f "$idx" -o ! -f "$file" -o "$file" -nt "$idx" ]; then - subpkg_unset - return 1 - fi - done - subpkg_unset - - return 0 -} - -up2date() { - check_arch || return 0 - check_libc || return 0 - apk_up2date && abuildindex_up2date -} - -# rebuild package and abuildrepo index if needed -abuildindex() { - up2date && return 0 - build_abuildrepo -} - -# source all APKBUILDs and output: -# 1) origin of package -# 2) all dependencies -# the output is i in a format easy parseable for awk -parse_aports_makedepends() { - # lets run this in a subshell since we source all APKBUILD here - ( - aportsdir=$(realpath ${APKBUILD%/APKBUILD}/..) - for i in $aportsdir/*/APKBUILD; do - # no forks in this loop or it will be painfully slow! - pkgname= - subpackages= - depends= - makedepends= - checkdepends= - . $i - dir=${i%/APKBUILD} - deps= - # filter out conflicts from deps and version info - wantdepends="$depends $makedepends" - want_check && wantdepends="$wantdepends $checkdepends" - for j in $wantdepends; do - case "$j" in - !*) continue;; - esac - deps="$deps ${j%%[<>=]*}" - done - for j in $pkgname $subpackages; do - echo "o ${j%%:*} $dir" - set -- $deps - if [ $# -eq 0 ]; then - echo "d ${j%%:*}" - continue - fi - echo -n "d ${j%%:*} $1" - shift - while [ $# -gt 0 ]; do - echo -n ",$1" - shift - done - echo - done - done - ) -} - -trace_makedepends() { - local deps= i= - # strip versions from deps - for i in "$@"; do - deps="$deps ${i%%[<>=]*}" - done - [ -z "$deps" ] && return 0 - ( parse_aports_makedepends - if [ -z "$upgrade" ]; then - # list installed pkgs and prefix with 'i ' - $APK info --quiet | sort | sed 's/^/i /' - fi - ) | awk -v pkgs="$deps" ' - - function depgraph(pkg, a, i) { - if (visited[pkg]) - return 0; - visited[pkg] = 1; - split(deps[pkg], a, ","); - for (i in a) - depgraph(a[i]); - print pkg ":" origin[pkg]; - - } - - $1 == "i" { visited[$2] = 1 } - $1 == "o" { origin[$2] = $3 } - $1 == "d" { deps[$2] = $3 } - END { - split(pkgs, pkgarray); - for (i in pkgarray) - depgraph(pkgarray[i]); - } - ' -} - -calcdeps() { - builddeps= - hostdeps= - - if cross_compiling && [ -n "$makedepends_build" -o -n "$makedepends_host" ]; then - for i in $EXTRADEPENDS_BUILD $1 $makedepends_build; do - list_has $i $hostdeps && continue - builddeps="$builddeps $i" - done - for i in $EXTRADEPENDS_HOST $EXTRADEPENDS_TARGET $makedepends_host; do - [ "$pkgname" = "${i%%[<>=]*}" ] && continue - list_has $i $hostdeps && continue - subpackages_has ${i%%[<>=]*} || hostdeps="$hostdeps $i" - done - else - [ -z "$makedepends" ] && makedepends="$makedepends_build $makedepends_host" - want_check && makedepends="$makedepends $checkdepends" - for i in $EXTRADEPENDS_BUILD $EXTRADEPENDS_HOST $1 $depends $makedepends; do - [ "$pkgname" = "${i%%[<>=]*}" ] && continue - list_has $i $builddeps && continue - subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i" - done - hostdeps="$EXTRADEPENDS_TARGET" - fi -} - -get_missing_deps() { - local cmd="$APK info --quiet --installed $1" - shift - - while [ "$1" ]; do - local cp=${1#\!} - if [ $cp != $1 ]; then - if $cmd $cp; then - error "Conflicting package installed: $cp" - return 1 - fi - elif [ "$upgrade" ] || ! $cmd $1; then - echo $1 - fi - shift - done -} - -# build and install dependencies -builddeps() { - local pkg= i= BUILD_BASE= - [ -n "$nodeps" ] && return 0 - - msg "Analyzing dependencies..." - case "$BOOTSTRAP" in - no*) BUILD_BASE="";; - *) if cross_creating || cross_compiling; then - BUILD_BASE="build-base-$CTARGET_ARCH" - else - BUILD_BASE="build-base" - fi - esac - calcdeps "$BUILD_BASE" - - # find which deps are missing - local mbd mhd missing - mbd=$(get_missing_deps "" $builddeps) || return 1 - mhd=$(get_missing_deps "--root $CBUILDROOT --arch $CTARGET_ARCH" $hostdeps) || return 1 - missing=$(echo $mbd $mhd) - - if [ -z "$install_deps" ] && [ -z "$recursive" ]; then - # if we dont have any missing deps we are done now - [ -z "$missing" ] && return 0 - error "Missing dependencies (use -r to autoinstall or -R to build them): $missing" - return 1 - fi - - uninstall_after=".makedepends-$pkgname $uninstall_after" - if [ -n "$install_deps" ] && [ -z "$recursive" ]; then - # make a --simulate run first to detect missing deps - # apk-tools --virtual is no goot at reporting those. - deps "--quiet --simulate" || return 1 - deps || return 1 - return 0 - fi - - [ -z "$recursive" ] && return 1 - - if [ -n "$CBUILDROOT" ]; then - error "Recursive rebuilding (-R) is not supported when cross compiling." - return 1 - fi - - # find dependencies that are installed but missing in repo. - for i in $builddeps; do - local m=$($APK search --repository "$REPODEST/$repo" ${i%%[<>=]*}) - if [ -z "$m" ]; then - missing="$missing $i" - fi - done - - for i in $(trace_makedepends $missing); do - # i = pkg:dir - local dir=${i#*:} - local pkg=${i%:*} - - # ignore if dependency is in other repo - [ -d "$dir" ] || continue - - # check if dep is blacklisted - if list_has $pkg $ABUILD_BLACKLIST; then - error "$pkg is blacklisted" - return 1 - fi - - # break circular deps - list_has $pkg $ABUILD_VISITED && continue - export ABUILD_VISITED="$ABUILD_VISITED $pkg" - - msg "Entering $dir" - cd "$dir" && "$abuild_path" $forceroot $keep $keep_build $quiet \ - $install_deps $recursive $upgrade $color_opt \ - abuildindex || return 1 - done - $SUDO_APK add --upgrade --repository "$REPODEST/$repo" \ - $apk_opt_wait \ - --virtual .makedepends-$pkgname $builddeps \ - || return 1 -} - -# replace the md5sums in the APKBUILD -checksum() { - local s files - [ -z "$source" ] && [ -n "${md5sums}${sha256sums}${sha512sums}" ] \ - && msg "Removing checksums from APKBUILD" - sed -i -e '/^md5sums="/,/"\$/d; /^md5sums=''/,/''\$/d' "$APKBUILD" - sed -i -e '/^sha512sums="/,/"\$/d; /^sha512sums=''/,/''\$/d' "$APKBUILD" - sed -i -e '/^sha256sums="/,/"\$/d; /^sha256sums=''/,/''\$/d' "$APKBUILD" - [ -z "$source" ] && return 0 - fetch - for s in $source; do - files="$files $(filename_from_uri $s)" - done - - msg "Updating the sha512sums in APKBUILD..." - md5sums= - sha256sums= - sha512sums="$(cd "$srcdir" && sha512sum $files)" \ - || die "sha512sum failed" - echo "sha512sums=\"$sha512sums\"" >>"$APKBUILD" -} - -rootbld_actions() { - local part _build=build _check=check_fakeroot - if ! is_function package; then - # if package() is missing then build is called from rootpkg - _build=true - fi - if options_has "!checkroot"; then - _check=check - fi - if ! want_check; then - _check=true - fi - for part in symlinksrc unpack prepare $_build $_check rootpkg; do - runpart $part - done -} - -rootbld() { - if apk_up2date && [ -z "$force" ]; then - msg "Package is up to date" - return - fi - - [ "$CBUILD" = "$CHOST" ] || die "rootbld: cross-building not supported currently" - apk info -eq abuild-rootbld || die "rootbld: abuild-rootbld package not installed" - - logcmd "chroot building building $repo/$pkgname-$pkgver-r$pkgrel" - - # check early if we have abuild key - abuild-sign --installed - - # networking business - sanitycheck - clean - fetch - verify - - msg "Preparing build chroot..." - - mkusers - - BUILD_ROOT=$(mktemp -d /var/tmp/abuild.XXXXXXXXXX) - local aportsgit=${APORTSDIR:-${startdir}} - - mkdir -p "$BUILD_ROOT/proc" "$BUILD_ROOT/etc/apk/keys" \ - "$BUILD_ROOT/$HOME/.abuild" "$BUILD_ROOT/$aportsgit" \ - "$BUILD_ROOT/$SRCDEST" "$BUILD_ROOT/$REPODEST" \ - "$BUILD_ROOT/tmp/pkg" "$BUILD_ROOT/tmp/src" \ - "$BUILD_ROOT/usr/bin" "$pkgbasedir" "$REPODEST" \ - "$srcdir" - - cp /etc/abuild.conf /etc/group /etc/passwd "$BUILD_ROOT/etc" - cp /etc/apk/keys/* "$BUILD_ROOT/etc/apk/keys" - - if options_has "net"; then - cp /etc/resolv.conf "$BUILD_ROOT/etc" - fi - - local version="edge" buildhost="edge" gitref - if gitref="$(expr "$(git symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then - version=v${gitref} - buildhost=${gitref/./-} - fi - - local repo_template=$aportsgit/$repo/.rootbld-repositories - [ -s "$repo_template" ] || die "rootbld: $repo_template does not exist" - ( - for key in $(git config --list --name-only); do - k=${key#abuild.} - [ $k != $key ] && \ - eval "export $k=\"$(git config --get $key)\"" - done - - export mirror version - [ "$mirror" ] || mirror=http://dl-cdn.alpinelinux.org/alpine - - envsubst - echo "$REPODEST/$repo" - ) < "$repo_template" > "$BUILD_ROOT/etc/apk/repositories" - - calcdeps - $SUDO_APK add --initdb --root "$BUILD_ROOT" --update \ - abuild alpine-base build-base git $hostdeps $builddeps - - local bwrap_opts="" - options_has "net" || bwrap_opts="$bwrap_opts --unshare-net" - bwrap --unshare-ipc --unshare-uts $bwrap_opts \ - --ro-bind "$BUILD_ROOT" / \ - --proc /proc \ - --dev-bind /dev /dev \ - --bind "$BUILD_ROOT/$HOME" "$HOME" \ - --ro-bind "$HOME/.abuild" "$HOME/.abuild" \ - --ro-bind "$aportsgit" "$aportsgit" \ - --bind "$SRCDEST" "$SRCDEST" \ - --bind "$BUILD_ROOT/tmp" /tmp \ - --bind "$BUILD_ROOT/tmp/src" "$srcdir" \ - --bind "$BUILD_ROOT/tmp/pkg" "$pkgbasedir" \ - --bind "$REPODEST" "$REPODEST" \ - --hostname "build-$buildhost-$CARCH" \ - --chdir "$startdir" \ - --setenv PATH /bin:/usr/bin:/sbin:/usr/sbin \ - /usr/bin/abuild $force rootbld_actions - update_abuildrepo_index - cleanup $CLEANUP -} - -stripbin() { - local bin - if options_has "!strip" || [ "${subpkgarch:-$pkgarch}" = "noarch" ]; then - return 0 - fi - cd "${subpkgdir:-$pkgdir}" || return 1 - - local stripcmd=strip - case "${subpkgarch:-$pkgarch}" in - $CBUILD_ARCH) stripcmd="strip" ;; - $CARCH) stripcmd="${CHOST}-strip" ;; - $CTARGET_ARCH) stripcmd="${CTARGET}-strip" ;; - esac - - msg "Stripping binaries" - scanelf --recursive --nobanner --osabi --etype "ET_DYN,ET_EXEC" . \ - | while read type osabi filename; do - - # scanelf may have picked up a temp file so verify that file still exists - [ -e "$filename" ] || continue - - [ "$osabi" != "STANDALONE" ] || continue - local XATTR=$(getfattr --match="" --dump "${filename}") - "${stripcmd}" "${filename}" - if [ -n "$XATTR" ]; then - echo "$XATTR" | setfattr --restore=- - fi - done -} - -# simply list target apks -listpkg() { - local name - getpkgver || return 1 - for name in $allpackages ; do - subpkg_set $name - echo "$subpkgname-$pkgver-r$pkgrel.apk" - done - subpkg_unset -} - -source_has() { - local i - for i in $source; do - [ "$1" = "${i##*/}" ] && return 0 - [ "$1" = "${i%%::*}" ] && return 0 - done - return 1 -} - -subpackages_has() { - local i - for i in $subpackages; do - [ "$1" = "${i%%:*}" ] && return 0 - done - return 1 -} - -subpackage_types_has() { - local i - for i in $subpackages; do - local _name="${i%%:*}" - [ "$1" = "${_name##*-}" ] && return 0 - done - return 1 -} - -list_has() { - local needle="$1" - local i - shift - for i in $@; do - [ "$needle" = "$i" ] && return 0 - [ "$needle" = "!$i" ] && return 1 - done - return 1 -} - -# same as list_has but we filter version info -deplist_has() { - local needle="$1" - local i - shift - for i in $@; do - i=${i%%[<>=]*} - [ "$needle" = "$i" ] && return 0 - [ "$needle" = "!$i" ] && return 1 - done - return 1 -} - -options_has() { - list_has "$1" $options -} - -depends_has() { - deplist_has "$1" $depends -} - -makedepends_has() { - deplist_has "$1" $makedepends -} - -md5sums_has() { - list_has "$1" $md5sums -} - -install_has() { - list_has "$1" $install -} - -deps() { - [ -z "$hostdeps" -a -z "$builddeps" ] && calcdeps - - local _quiet="$1" - [ -z "$_quiet" ] && msg "Installing for build:$builddeps" - $SUDO_APK add $_quiet $apk_opt_wait --repository "$REPODEST/$repo" \ - --virtual .makedepends-$pkgname \ - $builddeps \ - || return 1 - if [ -n "$CBUILDROOT" ]; then - [ -z "$_quiet" ] && msg "Installing for host:$hostdeps" - $SUDO_APK add $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" --repository "$REPODEST/$repo" $apk_opt_wait \ - --no-scripts --virtual .makedepends-$pkgname $hostdeps || return 1 - fi -} - -undeps() { - local _quiet="$@" - $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname || : - if [ -n "$CBUILDROOT" ]; then - $SUDO_APK del $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" $apk_opt_wait \ - --no-scripts .makedepends-$pkgname || : - fi -} - -# compat -installdeps() { deps; } -uninstalldeps() { undeps; } -index() { update_abuildrepo_index; } - -all() { - if ! [ -n "$force" ]; then - if ! check_arch; then - echo "Package not available for the target architecture ($CARCH). Aborting." - return 0 - fi - check_libc || return 0 - fi - if up2date && [ -z "$force" ]; then - msg "Package is up to date" - else - build_abuildrepo - fi -} - -# This abuild hook will checkout an svn or git repository by specifying -# $svnurl or $giturl in APKBUILD. You can checkout a specific branch in -# git by adding -b $branch in $giturl. $reporev will select the correct -# commit, revision or tag for you. If you specify $disturl your distfile -# will automatically be uploaded with rsync to the url provided. -# Base version defaults to 0 except if specified by $verbase. - -snapshot() { - # check if we setup vars correctly - [ -z "$disturl" ] && warning "Missing disturl in APKBUILD, auto uploading disabled." - [ -z "$svnurl" ] && [ -z "$giturl" ] && die "Missing repository url in APKBUILD!" - [ -n "$svnurl" ] && [ -n "$giturl" ] && die "You can only use a single repository!" - local _date=$(date +%Y%m%d) - local _format="tar.gz" - # remove any repositories left in srcdir - abuild clean - mkdir -p "$srcdir" && cd "$srcdir" - # clone git repo and archive - if [ -n "$giturl" ]; then - local _version=${verbase:-0}_git${_date} - [ "$git" = "true" ] && die "Missing git! Install git to support git clone." - local _rev="${reporev:-HEAD}" - [ "$_rev" = "HEAD" ] && local _depth="--depth=1" - msg "Creating git snapshot: $pkgname-$_version" - git clone $_depth --bare $giturl $pkgname-$_version || return 1 - git --git-dir $pkgname-$_version archive \ - --format=$_format \ - -o $pkgname-$_version.$_format \ - --prefix=$pkgname-$_version/ $_rev \ - || return 1 - fi - # export svn repo and archive - if [ -n "$svnurl" ]; then - local _version=${verbase:-0}_svn${_date} - command -v svn >/dev/null || \ - die "Missing svn! Install subverion to support svn export." - [ -n "$reporev" ] && local _rev="-r $reporev" - msg "Creating svn snapshot: $pkgname-$_version" - svn co $_rev $svnurl $pkgname-$_version || return 1 - tar zcf $pkgname-$_version.$_format $pkgname-$_version || return 1 - fi - # upload to defined distfiles url - if [ -n "$disturl" ]; then - command -v rsync >/dev/null || \ - die "Missing rsync! Install rsync to enable automatic uploads." - msg "Uploading to $disturl" - rsync --progress -La $pkgname-$_version.$_format \ - $disturl || return 1 - cd "$startdir" - # set the pkgver to current date and update checksum - sed -i -e "s/^pkgver=.*/pkgver=${_version}/" \ - APKBUILD || return 1 - abuild checksum - fi -} - -usage() { - cat <<-EOF - usage: $program [options] [-P REPODEST] [-s SRCDEST] [-D DESCRIPTION] [cmd] ... - $program [-c] -n PKGNAME[-PKGVER] - Options: - -A Print CARCH and exit - -c Enable colored output - -d Disable dependency checking - -D Set APKINDEX description (default: \$repo \$(git describe)) - -f Force specified cmd (skip checks: apk up to date, arch, libc) - -F Force run as root - -h Show this help - -i Install PKG after successful build - -k Keep built packages, even if APKBUILD or sources are newer - -K Keep buildtime temp dirs and files (srcdir/pkgdir/deps) - -m Disable colors (monochrome) - -P Set REPODEST as the repository location for created packages - -q Quiet - -r Install missing dependencies from system repository (using sudo) - -R Recursively build and install missing dependencies (using sudo) - -s Set source package destination directory - -u Recursively build and upgrade all dependencies (using sudo) - -v Verbose: show every command as it is run (very noisy) - - Commands: - build Compile and install package into \$pkgdir - check Run any defined tests concerning the package - checksum Generate checksum to be included in APKBUILD - clean Remove temp build and install dirs - cleancache Remove downloaded files from \$SRCDEST - cleanoldpkg Remove binary packages except current version - cleanpkg Remove already built binary and source package - deps Install packages listed in makedepends and depends - fetch Fetch sources to \$SRCDEST and verify checksums - index Regenerate indexes in \$REPODEST - listpkg List target packages - package Install project into $pkgdir - prepare Apply patches - rootbld Build package in clean chroot - rootpkg Run 'package', the split functions and create apks as fakeroot - sanitycheck Basic sanity check of APKBUILD - snapshot Create a \$giturl or \$svnurl snapshot and upload to \$disturl - sourcecheck Check if remote source package exists upstream - srcpkg Make a source package - undeps Uninstall packages listed in makedepends and depends - unpack Unpack sources to \$srcdir - up2date Compare target and sources dates - verify Verify checksums - - To activate cross compilation specify in environment: - CHOST Arch or hostspec of machine to generate packages for - CTARGET Arch or hostspec of machine to generate compiler for - - EOF - exit 0 -} - -APKBUILD="${APKBUILD:-./APKBUILD}" -unset force -unset recursive -while getopts "AcdD:fFhkKimnp:P:qrRs:uv" opt; do - case $opt in - 'A') echo "$CARCH"; exit 0;; - 'c') enable_colors - color_opt="-c";; - 'd') nodeps="-d";; - 'D') DESCRIPTION=$OPTARG;; - 'f') force="-f";; - 'F') forceroot="-F";; - 'h') usage;; - 'k') keep="-k";; - 'K') keep_build="-K";; - 'm') disable_colors - color_opt="-m";; - 'n') die "Use newapkbuild to create new aports";; - 'P') REPODEST=$OPTARG;; - 'q') quiet="-q";; - 'r') install_deps="-r";; - 'R') recursive="-R";; - 's') SRCDEST=$OPTARG;; - 'u') upgrade="-u" - recursive="-R";; - 'v') set -x;; - esac -done -shift $(( $OPTIND - 1 )) - -# check so we are not root -if [ $(id -u) -eq 0 ] && [ -z "$FAKEROOTKEY" ]; then - [ -z "$forceroot" ] && die "Do not run abuild as root" - FAKEROOT= -fi - -# find startdir -[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)" -APKBUILD=$(readlink -f "$APKBUILD") - -startdir="${APKBUILD%/*}" -srcdir=${srcdir:-"$startdir/src"} -pkgbasedir=${pkgbasedir:-"$startdir/pkg"} - -repo=${startdir%/*} -repo=${repo##*/} - -SRCDEST=${SRCDEST:-$startdir} - -BUILD_ROOT= - -# set a default CC -: ${CC:=gcc} -export CC - -cd "$startdir" || die -. "$APKBUILD" - -builddir=${builddir:-"$srcdir/$pkgname-$pkgver"} - -# If REPODEST is set then it will override the PKGDEST -if [ -z "$REPODEST" ]; then - warning "REPODEST is not set and is now required. Defaulting to ~/packages" - [ -n "$PKGDEST" ] && die "PKGDEST is no longer supported." - REPODEST="~/packages" -fi - -# for recursive action -export REPODEST SRCDEST - -# add dbg subpackage if its enabled globally -if [ -n "$DEFAULT_DBG" ] && ! subpackage_types_has "dbg" && ! options_has "!dbg" && [ "$arch" != "noarch" ]; then - subpackages="$pkgname-dbg $subpackages" -fi - -# if we want build debug package -if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then - CFLAGS="$CFLAGS -g" - CXXFLAGS="$CXXFLAGS -g" - options="$options !strip" -fi - -if [ -n "$subpkgname" ]; then - # If we are handling a sub package then reset subpackages and install - origsubpackages="$subpackages" - subpackages= -else - allpackages="$pkgname $subpackages" - for i in $linguas; do - allpackages="$allpackages $pkgname-lang-$i::noarch" - done -fi -apkbuild_arch="$arch" -pkgdir="$pkgbasedir/$pkgname" -if [ -z "$pkgarch" ]; then - pkgarch=$CARCH - list_has noarch $arch && pkgarch=noarch -fi -controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname} - -trap 'die "Aborted by user"' INT - -[ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname" - -if [ -z "$1" ]; then - set all -fi - -while [ $# -gt 0 ]; do - runpart $1 - shift -done - -cleanup