diff options
author | Owen Trigueros | 2019-05-15 21:19:53 +0200 |
---|---|---|
committer | Owen Trigueros | 2019-05-15 21:19:53 +0200 |
commit | 225318c66fb2e054a09aa81dc29e376ea241ae7e (patch) | |
tree | 0da69be45eedeb72d28ea1bc085578575777a9a1 | |
parent | c6c6bcee01f7048f0972b18e80f366a7992c14c9 (diff) | |
download | aur-225318c66fb2e054a09aa81dc29e376ea241ae7e.tar.gz |
Add backup(), replace cp w/ install, remove references to $pkgdir, mv config to /etc/
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 58 | ||||
-rw-r--r-- | turtl-server-git.install | 6 | ||||
-rw-r--r-- | turtl.conf | 2 | ||||
-rw-r--r-- | turtl.service | 2 | ||||
-rw-r--r-- | turtl.sysusers | 1 |
6 files changed, 48 insertions, 32 deletions
@@ -1,7 +1,7 @@ pkgbase = turtl-server-git pkgdesc = The secure, collaborative notebook's server pkgver = r209.f37f183 - pkgrel = 1 + pkgrel = 2 url = https://turtlapp.com/ install = turtl-server-git.install arch = any @@ -11,13 +11,14 @@ pkgbase = turtl-server-git depends = nodejs depends = postgresql source = turtl-server-git::git+https://github.com/turtl/server.git - source = turtl.conf source = turtl-server-git.install source = turtl.service + source = turtl.sysusers md5sums = SKIP - md5sums = 7436fec3178f4204a0bda9519dcc8f08 - md5sums = d91669b7799dea106b8e7f0e5d14e9a7 - md5sums = 222f09bb6a654caa705e14a82ad8db8a + md5sums = 2277c97e9f9ea821b35f5f4215e5ff9b + md5sums = ef593935d035ae7df448dbb18aaed70f + md5sums = c6727740e7165fa825bc011ec5f50f78 pkgname = turtl-server-git + backup = etc/webapps/turtl/config.yaml @@ -2,7 +2,7 @@ pkgname=turtl-server-git pkgver=r209.f37f183 -pkgrel=1 +pkgrel=2 pkgdesc="The secure, collaborative notebook's server" arch=('any') url="https://turtlapp.com/" @@ -11,14 +11,14 @@ depends=('nodejs' 'postgresql') makedepends=('git' 'npm') install=$pkgname.install source=("$pkgname::git+https://github.com/turtl/server.git" - "turtl.conf" "turtl-server-git.install" - "turtl.service") + "turtl.service" + "turtl.sysusers") md5sums=('SKIP' - '7436fec3178f4204a0bda9519dcc8f08' - 'd91669b7799dea106b8e7f0e5d14e9a7' - '222f09bb6a654caa705e14a82ad8db8a') + '2277c97e9f9ea821b35f5f4215e5ff9b' + 'ef593935d035ae7df448dbb18aaed70f' + 'c6727740e7165fa825bc011ec5f50f78') pkgver() { cd "$pkgname" @@ -31,20 +31,38 @@ build() { } package() { - mkdir -p "$pkgdir"/var/www/turtl/server - mkdir -p "$pkgdir"/var/www/turtl/server/plugins + cd "$srcdir"/"$pkgname" + backup=('etc/webapps/turtl/config.yaml') - install -Dm644 turtl.service "$pkgdir"/usr/lib/systemd/system/turtl.service - install -Dm644 turtl.conf "$pkgdir"/usr/lib/sysusers.d/turtl.conf + # install service file and systemd-sysusers config + install -Dm644 "$srcdir"/turtl.service "$pkgdir"/usr/lib/systemd/system/turtl.service + install -Dm644 "$srcdir"/turtl.sysusers "$pkgdir"/usr/lib/sysusers.d/turtl.conf - cd "$srcdir"/"$pkgname" - cp -r controllers $pkgdir/var/www/turtl/server - cp -r helpers "$pkgdir"/var/www/turtl/server - cp -r models "$pkgdir"/var/www/turtl/server - cp -r node_modules "$pkgdir"/var/www/turtl/server - cp -r scripts "$pkgdir"/var/www/turtl/server - cp -r tools "$pkgdir"/var/www/turtl/server - - install -Dm644 config/config.yaml.default "$pkgdir"/var/www/turtl/server/config/config.yaml - install -Dm644 server.js "$pkgdir"/var/www/turtl/server/server.js + # install server files + find controllers/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + find helpers/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + find models/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + find scripts/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + find tools/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + find node_modules/ -type f -exec install -Dm644 {} "$pkgdir"/usr/share/webapps/turtl/{} \; + install -Dm644 server.js "$pkgdir"/usr/share/webapps/turtl/server.js + install -d "$pkgdir"/usr/share/webapps/turtl/plugins + install -d "$pkgdir"/var/lib/turtl/public/uploads + ln -s /var/lib/turtl/public "$pkgdir"/usr/share/webapps/turtl/public + + # install config file + install -Dm644 config/config.yaml.default "$pkgdir"/etc/webapps/turtl/config.yaml + mkdir -p "$pkgdir"/usr/share/webapps/turtl/config + ln -s /etc/webapps/turtl/config.yaml "$pkgdir"/usr/share/webapps/turtl/config/config.yaml + + # remove references to $pkgdir and $srcdir + find "$pkgdir" -name package.json -print0 | xargs -0 sed -i '/_where/d' + + # change 'loglevel' to 'info' + sed -i "s/loglevel: 'debug'/loglevel: 'info'/" \ + "$pkgdir"/etc/webapps/turtl/config.yaml + + # change data dir + sed -i "s/\/var\/www\/turtl\/server/usr\/share\/webapps\/turtl/g" \ + "$pkgdir"/etc/webapps/turtl/config.yaml } diff --git a/turtl-server-git.install b/turtl-server-git.install index 6d53e2cd1591..e9a25341585a 100644 --- a/turtl-server-git.install +++ b/turtl-server-git.install @@ -1,9 +1,7 @@ #!/bin/sh post_install() { - echo ":: Changing the ownership of Turtl's main directory" - chown -R turtl:turtl /var/www/turtl - echo + chown -R turtl:turtl /var/lib/turtl echo ":: Turtle needs a dedicated PostgreSQL user/db set up for it." echo " Once it's set up, edit /var/www/turtl/server/config/config.yaml" echo " to make 'connstr' match your user/db." @@ -19,5 +17,5 @@ post_install() { echo " cd /var/www/turtl/server" echo " ./scripts/init-db.sh" echo - echo ":: Finnaly, start the server: systemctl start turtle.service" + echo ":: Finnaly, start the server: systemctl start turtl.service" } diff --git a/turtl.conf b/turtl.conf deleted file mode 100644 index 7a1e5dba027a..000000000000 --- a/turtl.conf +++ /dev/null @@ -1,2 +0,0 @@ -u turtl - "The secure, collaborative notebook's server" /var/www/turtl -m turtl diff --git a/turtl.service b/turtl.service index 201e2dc51209..3d18b548c84a 100644 --- a/turtl.service +++ b/turtl.service @@ -4,7 +4,7 @@ Description=turtl server [Service] User=turtl Group=turtl -ExecStart=/usr/bin/node /var/www/turtl/server/server.js +ExecStart=/usr/bin/node /usr/share/webapps/turtl/server.js [Install] WantedBy=multi-user.target diff --git a/turtl.sysusers b/turtl.sysusers new file mode 100644 index 000000000000..57e07e9f86db --- /dev/null +++ b/turtl.sysusers @@ -0,0 +1 @@ +u turtl - "The secure, collaborative notebook's server" /var/lib/turtl |