summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Cuneo2024-01-09 01:42:48 +1100
committerMatt Cuneo2024-01-09 01:42:48 +1100
commitc3bbdb2047756b905f7a04830d39be33f9fbe6c2 (patch)
treec4de21e7186f8815a87afc4955ed0f343487f766
downloadaur-c3bbdb2047756b905f7a04830d39be33f9fbe6c2.tar.gz
Initial packaging of photon for lemmy
-rw-r--r--.SRCINFO22
-rw-r--r--.gitignore8
-rw-r--r--PKGBUILD52
-rw-r--r--config.env32
-rw-r--r--systemd.service19
-rw-r--r--sysusers.conf2
-rw-r--r--tmpfiles.conf1
7 files changed, 136 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..a62a6d408d55
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = photon-lemmy
+ pkgdesc = An alternative front end for Lemmy
+ pkgver = 1.25.2
+ pkgrel = 1
+ url = https://github.com/Xyphyn/photon
+ arch = any
+ license = AGPL3
+ makedepends = npm
+ depends = nodejs
+ backup = etc/photon-lemmy/config.env
+ source = photon-1.25.2.tar.gz::https://github.com/Xyphyn/photon/archive/refs/tags/v1.25.2.tar.gz
+ source = systemd.service
+ source = sysusers.conf
+ source = tmpfiles.conf
+ source = config.env
+ b2sums = 387c47736e9a26d2f89947a7ac9e89cd8796ae4d1347100213403d6471cca314c1f60af54e3c1fc416e0959ec122c04b1a7817cc461ecbdc99abf87ec05f9199
+ b2sums = fa15b1362b4a794464577181eada8432bff9842a4f0a29c4096e203139b3f333d2c25d7837f507fbfd0544a2631ed2321409e2b864a85e6faadcbea35345d2cf
+ b2sums = 02f70ad3274186cb9f5ba50e0717ebf17fc76450816174ed761d1c8a37c5f08bd906a1fe0573db647c92d91f900c67f9595478c625c2d22cf98f3769b55198d1
+ b2sums = 5c09b5b05a7e5438912fb73d140683dbaab5a450af194ec97dbc30e4118ce21e769dbb6034c40a7d3ffabfaf3b4bf757ed12d189bd9ae6fe99c084063cc52328
+ b2sums = 22567c2e2fac19a9c1acbb3ea2e811b30847429a2a14fafa21991fc8281a24bc3acb111b78e3a83b9261c193349156ccdd5b0fa20aa7c1fcd2113af47857e053
+
+pkgname = photon-lemmy
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..e5369eb0020e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*
+!.gitignore
+!.SRCINFO
+!PKGBUILD
+!tmpfiles.conf
+!sysusers.conf
+!systemd.service
+!config.env
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..0d04eeb01740
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,52 @@
+# Maintainer: Matt Cuneo <m@cuneo.au>
+
+_name=photon
+pkgname="$_name-lemmy"
+pkgver=1.25.2
+pkgrel=1
+pkgdesc='An alternative front end for Lemmy'
+arch=('any')
+url="https://github.com/Xyphyn/$_name"
+license=('AGPL3')
+depends=(
+ 'nodejs'
+)
+makedepends=(
+ 'npm'
+)
+backup=('etc/photon-lemmy/config.env')
+source=(
+ "$_name-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
+ 'systemd.service'
+ 'sysusers.conf'
+ 'tmpfiles.conf'
+ 'config.env'
+)
+b2sums=('387c47736e9a26d2f89947a7ac9e89cd8796ae4d1347100213403d6471cca314c1f60af54e3c1fc416e0959ec122c04b1a7817cc461ecbdc99abf87ec05f9199'
+ 'fa15b1362b4a794464577181eada8432bff9842a4f0a29c4096e203139b3f333d2c25d7837f507fbfd0544a2631ed2321409e2b864a85e6faadcbea35345d2cf'
+ '02f70ad3274186cb9f5ba50e0717ebf17fc76450816174ed761d1c8a37c5f08bd906a1fe0573db647c92d91f900c67f9595478c625c2d22cf98f3769b55198d1'
+ '5c09b5b05a7e5438912fb73d140683dbaab5a450af194ec97dbc30e4118ce21e769dbb6034c40a7d3ffabfaf3b4bf757ed12d189bd9ae6fe99c084063cc52328'
+ '22567c2e2fac19a9c1acbb3ea2e811b30847429a2a14fafa21991fc8281a24bc3acb111b78e3a83b9261c193349156ccdd5b0fa20aa7c1fcd2113af47857e053')
+
+build() {
+ cd "$_name-$pkgver"
+
+ npm install
+ ADAPTER=node npm run build
+ rm -rf node_modules
+ npm ci --omit dev
+}
+
+package() {
+ # systemd integration
+ install -vDm644 config.env "$pkgdir/etc/$pkgname/config.env"
+ install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+ install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
+ install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+
+ cd "$_name-$pkgver"
+
+ # binary
+ install -vd "$pkgdir/usr/share/$pkgname"
+ cp -R build node_modules package.json "$pkgdir/usr/share/$pkgname"
+}
diff --git a/config.env b/config.env
new file mode 100644
index 000000000000..2d0dc1c10439
--- /dev/null
+++ b/config.env
@@ -0,0 +1,32 @@
+#PUBLIC_INSTANCE_URL=lemmy.ml
+#PUBLIC_INTERNAL_INSTANCE=null
+#PUBLIC_LOCK_TO_INSTANCE=true
+#PUBLIC_SSR_ENABLED=false
+#PUBLIC_MIGRATE_COOKIE=false
+## system | light | dark
+#PUBLIC_THEME=system
+#PUBLIC_EXPANDABLE_IMAGES=true
+#PUBLIC_MARK_READ_POSTS=true
+#PUBLIC_REVERT_VOTE_COLORS=false
+#PUBLIC_SHOW_INSTANCES_USER=false
+#PUBLIC_SHOW_INSTANCES_COMMUNITY=true
+#PUBLIC_SHOW_INSTANCES_COMMENTS=false
+#PUBLIC_SHOW_COMPACT_POSTS=false
+## Active | Hot | New | Old | TopHour
+## TopSixHour | TopDay | TopWeek
+## TopMonth | TopAll
+## MostComments | NewComments
+#PUBLIC_DEFAULT_FEED_SORT=Active
+## All | Local | Subscribed
+#PUBLIC_DEFAULT_FEED=All
+## Hot | Top | New
+#PUBLIC_DEFAULT_COMMENT_SORT=Hot
+#PUBLIC_HIDE_DELETED=true
+#PUBLIC_HIDE_REMOVED=false
+#PUBLIC_FULL_WIDTH_LAYOUT=false
+#PUBLIC_EXPAND_SIDEBAR=true
+#PUBLIC_DISPLAY_NAMES=true
+#PUBLIC_NSFW_BLUR=true
+#PUBLIC_NEW_VOTE_BUTTONS=false
+#PUBLIC_RANDOM_PLACEHOLDERS=true
+#PUBLIC_REMOVE_CREDIT=false
diff --git a/systemd.service b/systemd.service
new file mode 100644
index 000000000000..5e2e5beff84c
--- /dev/null
+++ b/systemd.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Photon Lemmy - An alternative front end to Lemmy
+After=network.target
+
+[Service]
+User=photon-lemmy
+WorkingDirectory=/etc/share/webapps/photon-lemmy
+ExecStart=/usr/bin/node build
+EnvironmentFile=/etc/webapps/photon-lemmy/config.env
+Restart=on-failure
+
+# Hardening
+ProtectSystem=yes
+PrivateTmp=true
+MemoryDenyWriteExecute=true
+NoNewPrivileges=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sysusers.conf b/sysusers.conf
new file mode 100644
index 000000000000..59df29cf16bf
--- /dev/null
+++ b/sysusers.conf
@@ -0,0 +1,2 @@
+u photon-lemmy - "Photon Lemmy daemon user"
+
diff --git a/tmpfiles.conf b/tmpfiles.conf
new file mode 100644
index 000000000000..15cf88e83937
--- /dev/null
+++ b/tmpfiles.conf
@@ -0,0 +1 @@
+z /etc/photon-lemmy/config.env 0640