summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Gabriel Drumond Pereira2015-07-29 20:28:50 -0300
committerPedro Gabriel Drumond Pereira2015-07-29 20:28:50 -0300
commit39d9cca00c7a50bdb7f3fa497caf524dceda2938 (patch)
tree6fe60a4018095976dd4ef74427d2b6f76232ca31
downloadaur-39d9cca00c7a50bdb7f3fa497caf524dceda2938.tar.gz
Initial import
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD57
-rw-r--r--ghost.install53
-rw-r--r--ghost.service11
4 files changed, 143 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..182b45cbb178
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = ghost
+ pkgdesc = Free, open, simple blogging platform
+ pkgver = 0.6.4
+ pkgrel = 1
+ url = http://ghost.org
+ install = ghost.install
+ arch = i686
+ arch = x86_64
+ license = MIT
+ makedepends = unzip
+ depends = nodejs>=0.12
+ noextract = ghost-0.6.4.zip
+ backup = srv/ghost/Gruntfile.js
+ backup = srv/ghost/index.js
+ backup = srv/ghost/package.json
+ source = http://ghost.org/zip/ghost-0.6.4.zip
+ source = ghost.service
+ sha256sums = 5bfd95804f39b986fffc4ac266b8e9d800333dfaa034b20a4fec62a7346003e0
+ sha256sums = f6ddfd93a839cadcc34b8b5971948aebad2ab3989210ac04c66b8d681e11d3ee
+
+pkgname = ghost
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8ef9c1c42fd2
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Pedro Gabriel <pedrogabriel@dcc.ufmg.br>
+# Colaborator: Chun Yang <x@cyang.info>
+pkgname=ghost
+pkgver=0.6.4
+pkgrel=1
+pkgdesc="Free, open, simple blogging platform"
+arch=('i686' 'x86_64')
+url="http://ghost.org"
+license=('MIT')
+makedepends=('unzip')
+depends=('nodejs>=0.12')
+backup=('srv/ghost/Gruntfile.js' 'srv/ghost/index.js' 'srv/ghost/package.json')
+install=ghost.install
+source=(http://ghost.org/zip/$pkgname-$pkgver.zip
+ ghost.service)
+noextract=($pkgname-$pkgver.zip)
+sha256sums=('5bfd95804f39b986fffc4ac266b8e9d800333dfaa034b20a4fec62a7346003e0'
+ 'f6ddfd93a839cadcc34b8b5971948aebad2ab3989210ac04c66b8d681e11d3ee')
+
+# Note: You may need to log into ghost.org and download the zip file manually
+# and place it inside the same directory as the PKGBUILD
+
+package() {
+ install -dm755 "$pkgdir/srv/ghost"
+ cd "$pkgdir/srv/ghost"
+
+ # bsdtar is giving an error with the package
+ # ./: Can't remove already-existing dir
+ # bsdtar: Error exit delayed from previous errors.
+ # bsdtar -xf "$srcdir/$pkgname-$pkgver.zip"
+ unzip "$srcdir/$pkgname-$pkgver.zip"
+ npm install --production
+
+ install -Dm644 "$srcdir/ghost.service" "${pkgdir}/usr/lib/systemd/system/ghost.service"
+ install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/ghost/LICENSE"
+ rm LICENSE
+
+ chmod -R g=u "$pkgdir/srv/ghost"
+ find "$pkgdir/srv/ghost" -type d -exec chmod g+s {} \;
+
+ cat <<-EOF
+
+ Upgrading Ghost involves replacing old files with the new files, and
+ restarting the server. However, as the database, image uploads and
+ custom themes are stored alongside Ghost in the content directory,
+ care should be taken to only replace the necessary files as explained at
+ http://support.ghost.org/how-to-upgrade/ .
+
+ It is highly recommended that you make a backup of your data before
+ upgrading. To backup all the data from your database, log into your
+ Ghost install and go to /ghost/debug/. Press the export button to
+ download a JSON file containing all of your data.
+
+ EOF
+
+ chown -R 738:738 "$pkgdir/srv/ghost"
+}
diff --git a/ghost.install b/ghost.install
new file mode 100644
index 000000000000..182b59ab4b0e
--- /dev/null
+++ b/ghost.install
@@ -0,0 +1,53 @@
+post_install() {
+ getent group ghost &>/dev/null || \
+ groupadd --system --gid 738 ghost &>/dev/null
+ getent passwd ghost &>/dev/null || \
+ useradd --system --gid ghost --uid 738 -d /srv/ghost -s /usr/bin/nologin ghost &>/dev/null
+ chown -R ghost:ghost srv/ghost &>/dev/null
+
+ systemctl daemon-reload
+
+ cat <<-EOF
+ To use ghost with systemd, run
+ systemctl enable ghost.service
+
+ By default, Ghost can be accessed at http://localhost:2368/
+ after it is started.
+ EOF
+}
+
+post_upgrade() {
+ # Check if old version < 0.5.8
+ _cmp_ver=0.5.8
+ if [ "$2" = "$(echo -e "$2\n$_cmp_ver" | sort -V | head -n1)" ] \
+ && [ "$2" != "$_cmp_ver" ]; then
+ # 0.5.8 changes ghost UID/GID to a 738
+ # In order to do so, remove old user/group first
+ getent passwd ghost &>/dev/null && userdel -f ghost
+ getent group ghost &>/dev/null && groupdel ghost
+
+ echo "The UID/GID of the ghost user/group has changed"
+ echo "as of ghost-0.5.8. Please update the ownership of"
+ echo "the /srv/ghost directory by running (as root)"
+ echo " chown -R ghost:ghost /srv/ghost"
+ fi
+
+ post_install
+
+ if systemctl is-enabled ghost &>/dev/null || \
+ systemctl is-active ghost &>/dev/null ; then
+ systemctl restart ghost
+ fi
+}
+
+post_remove() {
+ if systemctl is-enabled ghost &>/dev/null || \
+ systemctl is-active ghost &>/dev/null ; then
+ systemctl stop ghost
+ fi
+
+ getent passwd ghost &>/dev/null && userdel -f ghost
+ getent group ghost &>/dev/null && groupdel ghost
+
+ systemctl daemon-reload
+}
diff --git a/ghost.service b/ghost.service
new file mode 100644
index 000000000000..94bc569c20dc
--- /dev/null
+++ b/ghost.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Ghost Blogging Platform
+After=network.target
+
+[Service]
+WorkingDirectory=/srv/ghost
+ExecStart=/usr/bin/npm start --production /srv/ghost
+User=ghost
+
+[Install]
+WantedBy=multi-user.target