summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Pagani2017-06-04 19:31:07 +0200
committerBruno Pagani2017-06-04 19:31:07 +0200
commit246f199eb76e588cce7675cc114617efe21becc6 (patch)
tree53ab4532dab128a63ab7299e49e010be21bbf4b8
parent7467d2130697dfbc5a3b14971539cf16dec4b615 (diff)
downloadaur-246f199eb76e588cce7675cc114617efe21becc6.tar.gz
upgpkg: cozy 2.0-1
upstream release
-rw-r--r--.SRCINFO52
-rw-r--r--PKGBUILD73
-rwxr-xr-xconfigure-cozy-domain26
-rw-r--r--controller.json11
-rw-r--r--cozy-controller.service12
-rw-r--r--cozy.install196
-rw-r--r--cozy.sysusers1
-rw-r--r--cozy.tmpfiles7
8 files changed, 96 insertions, 282 deletions
diff --git a/.SRCINFO b/.SRCINFO
index eae42c31280..5f7a410067f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,41 +1,39 @@
-# Generated by mksrcinfo v8
-# Tue Mar 15 18:40:44 UTC 2016
pkgbase = cozy
pkgdesc = A personal cloud you can hack, host and delete.
pkgver = 2.0
- pkgrel = 2
+ pkgrel = 1
url = https://cozy.io/
- install = cozy.install
- arch = any
+ arch = i686
+ arch = x86_64
license = GPL3
- depends = ca-certificates
- depends = couchdb
- depends = supervisor
- depends = bash
- depends = curl
+ depends = python2
depends = git
depends = imagemagick
- depends = coffee-script
- depends = openssl
+ depends = curl
+ depends = sqlite
+ depends = sudo
depends = libxml2
depends = libxslt
- depends = python2
- depends = python2-setuptools
- depends = python2-virtualenv
- depends = sqlite
- depends = nodejs-lts-bin
- depends = pwgen
- depends = pngcrush
- depends = lsof
- depends = cozy-management
+ depends = nodejs-lts-argon
+ depends = npm
+ depends = couchdb
+ depends = coffee-script
+ optdepends = cozy-management: Helper to manage Cozy
optdepends = libjpeg-turbo: Needed for the Kresus app
optdepends = libyaml: Needed for the Kresus app
- provides = cozy
- conflicts = cozy
- source = https://raw.githubusercontent.com/cozy/cozy-debian/master/supervisor-cozy-controller
- source = configure-cozy-domain
- md5sums = SKIP
- md5sums = 603ae0e25b7bf756b3bdc5da20efeec5
+ optdepends = weboob-git: Needed for the Kresus app
+ source = cozy-controller-2.5.10.tar.gz::https://github.com/cozy/cozy-controller/archive/v2.5.10.tar.gz
+ source = cozy-monitor-1.3.9.tar.gz::https://github.com/cozy/cozy-controller/archive/v1.3.9.tar.gz
+ source = cozy.tmpfiles
+ source = cozy.sysusers
+ source = cozy-controller.service
+ source = controller.json
+ sha256sums = 6988e5d1f0a7aa652af3e4dce9fce917de48f79910b853f7941cf84e0c765698
+ sha256sums = 76d0a3e2335a79b653f271c8d4ec1f16ece5dd1fb7fa4091175c6db1b4f8cabb
+ sha256sums = 8866cfac6282d851753c1e124b1c5732688b9e5bc709193fd7b4d9cc4d7bf277
+ sha256sums = 7b6ee2a5b91b900c81df700351ac9f3b6303c7bf3848c6d644a160c6c41e2db1
+ sha256sums = e4f492e528dc83c65424c48b14d26f843f1aa454ab83d5de629e70127053b8d0
+ sha256sums = f7e63b06690ba414f490f0e84bc0a3ca2328f72d690498873f4cafcd34a2749d
pkgname = cozy
diff --git a/PKGBUILD b/PKGBUILD
index 29ae164d226..5d7079b871b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,42 +1,49 @@
-# Maintainer: Brendan Abolivier <brendan@cozycloud.cc>
+# Maintainer: Bruno Pagani (a.k.a. ArchangeGabriel) <bruno.n.pagani@gmail.com>
+# Contributor: Brendan Abolivier <brendan@cozycloud.cc>
+
pkgname=cozy
pkgver=2.0
-pkgrel=2
-epoch=
+_pkgctrl=${pkgname}-controller
+_verctrl=2.5.10
+_pkgmntr=${pkgname}-monitor
+_vermntr=1.3.9
+pkgrel=1
pkgdesc="A personal cloud you can hack, host and delete."
-arch=('any')
+arch=('i686' 'x86_64')
url="https://cozy.io/"
license=('GPL3')
-groups=()
-depends=('ca-certificates' 'couchdb' 'supervisor' 'bash' 'curl' 'git' 'imagemagick' 'coffee-script'
- 'openssl' 'libxml2' 'libxslt' 'python2' 'python2-setuptools' 'python2-virtualenv' 'sqlite'
- 'nodejs-lts-bin' 'pwgen' 'pngcrush' 'lsof' 'cozy-management')
-makedepends=()
-checkdepends=()
-optdepends=('libjpeg-turbo: Needed for the Kresus app'
- 'libyaml: Needed for the Kresus app')
-provides=("cozy")
-conflicts=("cozy")
-replaces=()
-backup=()
-options=()
-install=$pkgname.install
-changelog=
-source=("https://raw.githubusercontent.com/cozy/cozy-debian/master/supervisor-cozy-controller"
- "configure-cozy-domain")
-noextract=()
-md5sums=("SKIP"
- "603ae0e25b7bf756b3bdc5da20efeec5")
-
-build() {
- echo "Hello world" > /dev/null
-}
+depends=('python2' 'git' 'imagemagick' 'curl' 'sqlite' 'sudo'
+ 'libxml2' 'libxslt' 'nodejs-lts-argon' 'npm'
+ 'couchdb' 'coffee-script')
+optdepends=('cozy-management: Helper to manage Cozy'
+ 'libjpeg-turbo: Needed for the Kresus app'
+ 'libyaml: Needed for the Kresus app'
+ 'weboob-git: Needed for the Kresus app')
+source=(${_pkgctrl}-${_verctrl}.tar.gz::"https://github.com/${pkgname}/${_pkgctrl}/archive/v${_verctrl}.tar.gz"
+ ${_pkgmntr}-${_vermntr}.tar.gz::"https://github.com/${pkgname}/${_pkgctrl}/archive/v${_vermntr}.tar.gz"
+ "${pkgname}.tmpfiles"
+ "${pkgname}.sysusers"
+ "${_pkgctrl}.service"
+ 'controller.json')
+sha256sums=('6988e5d1f0a7aa652af3e4dce9fce917de48f79910b853f7941cf84e0c765698'
+ '76d0a3e2335a79b653f271c8d4ec1f16ece5dd1fb7fa4091175c6db1b4f8cabb'
+ '8866cfac6282d851753c1e124b1c5732688b9e5bc709193fd7b4d9cc4d7bf277'
+ '7b6ee2a5b91b900c81df700351ac9f3b6303c7bf3848c6d644a160c6c41e2db1'
+ 'e4f492e528dc83c65424c48b14d26f843f1aa454ab83d5de629e70127053b8d0'
+ 'f7e63b06690ba414f490f0e84bc0a3ca2328f72d690498873f4cafcd34a2749d')
package() {
- mkdir -p $pkgdir/usr/share/cozy
- mkdir -p $pkgdir/etc/cozy
+ cd ${_pkgctrl}-${_verctrl}
+ npm install --cache "${srcdir}"/npm-cache -g --user root --prefix "${pkgdir}"/usr
+
+ cd "${srcdir}"/${_pkgmntr}-${_vermntr}
+ npm install --cache "${srcdir}"/npm-cache -g --user root --prefix "${pkgdir}"/usr
+
+ rmdir "${pkgdir}"/usr/etc
- cp supervisor-cozy-controller $pkgdir/usr/share/cozy
- mkdir -p $pkgdir/usr/bin
- cp configure-cozy-domain $pkgdir/usr/bin
+ cd "${srcdir}"
+ install -Dm644 controller.json -t "${pkgdir}"/etc/cozy/
+ install -Dm644 ${_pkgctrl}.service -t "${pkgdir}"/usr/lib/systemd/system/
+ install -Dm644 ${pkgname}.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/${pkgname}.conf
+ install -Dm644 ${pkgname}.sysusers "${pkgdir}"/usr/lib/sysusers.d/${pkgname}.conf
}
diff --git a/configure-cozy-domain b/configure-cozy-domain
deleted file mode 100755
index 5a7d18bf4f2..00000000000
--- a/configure-cozy-domain
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-if [ $# -eq 1 ]; then
- COZY_DOMAIN=$1
-
- CURRENT_DOMAIN=`/usr/bin/cozy_management get_cozy_param domain`
- if [ "$CURRENT_DOMAIN" = "$COZY_DOMAIN" ]; then
- echo "Cozy already configured with domain: $COZY_DOMAIN"
- else
- echo "Configuring Cozy with domain: $COZY_DOMAIN"
- coffee /usr/local/cozy/apps/home/commands.coffee setdomain $COZY_DOMAIN
- fi
-
- echo 'Generating SSL keys and certificates...'
- if [ ! -f /etc/cozy/dh.pem ]; then
- openssl dhparam -out /etc/cozy/dh.pem -outform PEM -2 2048
- chmod 400 /etc/cozy/dh.pem
- fi
- if [ ! -f /etc/cozy/server.crt ]; then
- cozy_management normalize_cert_dir
- cozy_management generate_certificate ${COZY_DOMAIN}
- fi
-else
- echo "Usage: /usr/bin/configure-cozy-domain cozy.example.tld"
- echo "Replace \"cozy.example.tld\" by your Cozy's own domain"
-fi
diff --git a/controller.json b/controller.json
new file mode 100644
index 00000000000..7d56952261e
--- /dev/null
+++ b/controller.json
@@ -0,0 +1,11 @@
+{
+ "dir_app_log": "/var/log/cozy",
+ "dir_app_bin": "/var/lib/cozy/apps",
+ "dir_app_data": "/var/lib/cozy/data",
+ "restart_cmd": "/usr/bin/systemctl restart cozy-controller",
+ "env": {
+ "kresus": {
+ "KRESUS_WEBOOB_DIR": "/usr/lib/python2.7/site-packages/weboob/"
+ }
+ }
+}
diff --git a/cozy-controller.service b/cozy-controller.service
new file mode 100644
index 00000000000..03b297a9867
--- /dev/null
+++ b/cozy-controller.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Cozy Controller
+Wants=couchdb.service
+After=couchdb.service
+
+[Service]
+Environment=NODE_ENV=production
+Environment=USE_SYSLOG=true
+ExecStart=/usr/bin/cozy-controller
+
+[Install]
+WantedBy=multi-user.target
diff --git a/cozy.install b/cozy.install
deleted file mode 100644
index 97d5fb515c8..00000000000
--- a/cozy.install
+++ /dev/null
@@ -1,196 +0,0 @@
-#!/bin/sh
-# Install scripts for Cozy
-# Maintainer: Brendan Abolivier <brendan@cozycloud.cc>
-
-# Fancy message is fancy
-msg() {
- printf "${blue}==>${bold} $1${all_off}\n"
-}
-
-all_off="$(tput sgr0)"
-bold="${all_off}$(tput bold)"
-blue="${bold}$(tput setaf 4)"
-
-post_install() {
- msg "Please not that this package comes from the Cozy community and is not an official Cozy port. Please report any trouble to the maintainer in the ways discribed at https://github.com/babolivier/cozy-archlinux#get-in-touch"
- msg "Checking ports availability"
- lsof -i :9002 > /dev/null 2>&1
- if [ $? = "0" ]; then
- msg "Port 9002 (used by the Cozy controller) is already in use on this machine."
- exit 1
- fi
- lsof -i :9101 > /dev/null 2>&1
- if [ $? = "0" ]; then
- msg "Port 9101 (used by the Cozy Data System) is already in use on this machine."
- exit 1
- fi
- lsof -i :9103 > /dev/null 2>&1
- if [ $? = "0" ]; then
- msg "Port 9103 (used by the Cozy Home) is already in use on this machine."
- exit 1
- fi
- lsof -i :9104 > /dev/null 2>&1
- if [ $? = "0" ]; then
- msg "Port 9104 (used by the Cozy authentication proxy) is already in use on this machine."
- exit 1
- fi
-
- msg 'Installing NPM dependencies...'
- npm config set python /usr/bin/python2
- [ ! -d /usr/local/lib/node_modules/cozy-controller ] && npm install -g cozy-controller
- [ ! -d /usr/local/lib/node_modules/cozy-monitor ] && npm install -g cozy-monitor
-
- msg 'Creating UNIX users...'
- id cozy >/dev/null 2>&1 || useradd -M cozy
- id cozy-data-system >/dev/null 2>&1 || useradd -M cozy-data-system
- id cozy-home >/dev/null 2>&1 || useradd -M cozy-home
-
- chown -hR cozy /etc/cozy
-
- if [ ! -f /etc/cozy/couchdb.login ]; then
- if [ ! -f /tmp/couchdb.login ]; then
- msg 'Generating CouchDB tokens...'
- pwgen -1 > /etc/cozy/couchdb.login && \
- pwgen -1 >> /etc/cozy/couchdb.login
- else
- msg 'Found tokens from previous installation'
- cp /tmp/couchdb.login /etc/cozy/couchdb.login
- fi
- msg 'Enabling CouchDB'
- systemctl enable couchdb
- systemctl restart couchdb
- COUNT=0;MAX=20
- while ! curl -s 127.0.0.1:5984 >/dev/null; do
- let "COUNT += 1"
- msg "Waiting for CouchDB to start... ($COUNT/$MAX)"
- if [[ $COUNT -ge $MAX ]]; then
- msg "CouchDB is too long to start"
- exit 1
- fi
- sleep 5
- done
- if [ ! -f /tmp/couchdb.login ]; then
- curl -s -X PUT 127.0.0.1:5984/_config/admins/$(head -n1 /etc/cozy/couchdb.login) -d "\"$(tail -n1 /etc/cozy/couchdb.login)\""
- fi
- fi
- chown cozy-data-system /etc/cozy/couchdb.login
- chmod 640 /etc/cozy/couchdb.login
-
- msg 'Configuring Cozy Controller...'
- CONFIGFILE=/etc/supervisor.d/cozy-controller.ini
- if [ -f $CONFIGFILE ]; then
- echo "Old configuration moved to /etc/supervisor.d/cozy-controller.ini.old"
- mv /etc/supervisor.d/cozy-controller.ini /etc/supervisor.d/cozy-controller.ini.old
- fi
- mv /usr/share/cozy/supervisor-cozy-controller /etc/supervisor.d/cozy-controller.ini
-
- msg 'Starting supervisor'
- systemctl enable supervisord
- systemctl restart supervisord
-
- COUNT=0;MAX=20
- while ! curl -s 127.0.0.1:9002 >/dev/null; do
- let "COUNT += 1"
- msg "Waiting for Cozy Controller to start... ($COUNT/$MAX)"
- if [[ $COUNT -ge $MAX ]]; then
- msg "Cozy Controller is too long to start"
- exit 1
- fi
- sleep 5
- done
-
- msg 'Installing Cozy Platform apps...'
- if [ ! -d /usr/local/cozy/apps/data-system ]; then
- cozy-monitor install-cozy-stack
- if [ $? = "1" ]; then echo "Error while installing the platform" && exit 1; fi
- fi
- cozy-monitor start data-system
- if [ ! -d /usr/local/cozy/apps/home ]; then
- cozy-monitor install home
- if [ $? = "1" ]; then echo "Error while installing the platform" && exit 1; fi
- fi
- cozy-monitor start home
- if [ ! -d /usr/local/cozy/apps/proxy ]; then
- cozy-monitor install proxy
- if [ $? = "1" ]; then echo "Error while installing the platform" && exit 1; fi
- fi
- cozy-monitor start proxy
-
-
- CURRENT_BACKGROUND=`/usr/bin/cozy_management get_cozy_param background`
- if [ "$CURRENT_BACKGROUND" != "None" ]; then
- echo "Cozy already configured with a background: $CURRENT_BACKGROUND"
- else
- echo "Configure Cozy with default background"
- curl -X POST http://localhost:9103/api/instance -H "Content-Type: application/json" -d '{"background":"background-07"}'
- fi
-
- # Correcting display here
- echo ""
- msg "Installing default apps"
- for app in calendar contacts photos emails files sync; do
- if [ ! -f /usr/local/cozy/apps/.first-install-$app ]; then
- if [ -d /usr/local/cozy/apps/$app ]; then
- touch /usr/local/cozy/apps/.first-install-$app
- else
- cozy-monitor install $app && touch /usr/local/cozy/apps/.first-install-$app
- fi
- fi
- done
-
- if [ ! -f /usr/local/cozy/apps/.first-install-import-from-google ]; then
- if [ -d /usr/local/cozy/apps/import-from-google ]; then
- touch /usr/local/cozy/apps/.first-install-import-from-google
- else
- cozy-monitor install import-from-google -r https://github.com/cozy-labs/import-from-google.git && touch /usr/local/cozy/apps/.first-install-import-from-google
- fi
- fi
-
-
- msg "This package does not come with any configuration for reverse proxying, which is crucial for Cozy's well behaviour. In order for the platform to work, please configure a reverse proxy.\nFor more information, please visit https://docs.cozy.io/en/host/install/install-on-archlinux.html"
- echo "Before being able to use Cozy, you need to run the first-time-configuration script:"
- echo " # /usr/bin/configure-cozy-domain cozy.example.tld"
- echo "With your Cozy's own domain instead of \"cozy.example.tld\""
-}
-
-pre_remove() {
- which cozy-monitor >/dev/null 2>&1
- RESULT=$?
- if [ "$RESULT" = "0" ]; then
- APPS="$(cozy-monitor status | grep -vE '(mta|postfix|couch|controller|data-system|ds|home|proxy|error)' | sed 's/:.*//;s/\[Error//' | xargs echo)"
- APPS="$APPS proxy home data-system"
- for app in $APPS ; do cozy-monitor uninstall $app ; done
- fi
- which supervisorctl >/dev/null 2>&1 && supervisorctl stop cozy-controller
-}
-
-post_remove() {
- mv /etc/cozy/couchdb.login /tmp/couchdb.login
- [ -d /etc/cozy ] && msg "Deleting /etc/cozy directory" && rm -rf /etc/cozy
- [ -d /usr/local/var/log/cozy ] && msg "Deleting /usr/local/var/log/cozy directory" && rm -rf /usr/local/var/log/cozy
- [ -d /usr/local/cozy ] && msg "Deleting /usr/local/cozy directory" && rm -rf /usr/local/cozy
- msg "Erasing scripts and folders"
- [ -f /usr/local/sbin/debian-reconfigure-cozy-domain.sh ] && rm -f /usr/local/sbin/debian-reconfigure-cozy-domain.sh
- [ -d /usr/local/var/cozy ] && rm -rf /usr/local/var/cozy
- [ -d /usr/share/cozy ] && rm -rf /usr/share/cozy
- msg "Removing NPM dependencies"
- [ -f /usr/bin/cozy-controller ] && npm remove -g cozy-controller
- [ -f /usr/bin/cozy-monitor ] && npm remove -g cozy-monitor
- msg "Removing supervisor configuration"
- test -e /etc/supervisor.d/cozy* && rm /etc/supervisor.d/cozy*
- supervisorctl reload
- echo "The Cozy database contains all your user data. Keeping it could be troublesome for further installations. However, it will not be removed, unless you do it manually."
- echo "Moved the admin logins to /tmp/couchdb.login"
- echo "Please don't forget to move it elsewhere if you don't want to lose access to your whole database."
-}
-
-post_upgrade() {
- # Check if the install went well
- cozy-monitor status > /dev/null 2>&1
- if [ $? != "0" ]; then
- post_install
- else
- # Do update here
- echo "Hello world" > /dev/null
- fi
-}
diff --git a/cozy.sysusers b/cozy.sysusers
new file mode 100644
index 00000000000..1c40293bcdd
--- /dev/null
+++ b/cozy.sysusers
@@ -0,0 +1 @@
+u cozy - "Cozy Cloud" /var/lib/cozy/
diff --git a/cozy.tmpfiles b/cozy.tmpfiles
new file mode 100644
index 00000000000..ad39ebe249a
--- /dev/null
+++ b/cozy.tmpfiles
@@ -0,0 +1,7 @@
+d /var/lib/cozy 0755 cozy cozy
+d /var/log/cozy 0755 cozy cozy
+d /etc/cozy 0755 cozy cozy
+x /var/lib/cozy
+x /var/log/cozy
+x /etc/cozy
+z /etc/cozy/controller.json - cozy cozy