summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlphaJack2022-04-13 09:48:25 +0200
committerAlphaJack2022-04-13 09:48:25 +0200
commit2dd2fa1d7b201c3a0b519b65e6187939152e69ef (patch)
treefb358dc71b527f30d9489f328590ad8d0ec3052a
parent98d76658d1e76e3d130e762ceec0840e24a78e82 (diff)
downloadaur-2dd2fa1d7b201c3a0b519b65e6187939152e69ef.tar.gz
Added systemd unit for unprivileged users, changed working dir and configuration file path
-rw-r--r--PKGBUILD39
-rw-r--r--olivetin.service11
-rw-r--r--olivetin@.service11
3 files changed, 46 insertions, 15 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 63dab72af220..d3ac70dc34fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname="olivetin-bin"
_pkgver=2022-04-07
-pkgver="${_pkgver//-/}"
+pkgver="${_pkgver//-/.}"
pkgrel=1
pkgdesc="Safe and simple access to predefined shell commands from a web interface"
url="https://www.olivetin.app/"
@@ -15,14 +15,19 @@ source_armv5h=("https://github.com/OliveTin/OliveTin/releases/download/$_pkgver/
source_armv6h=("https://github.com/OliveTin/OliveTin/releases/download/$_pkgver/OliveTin-$_pkgver-linux-arm32v6.tar.gz")
source_armv7h=("https://github.com/OliveTin/OliveTin/releases/download/$_pkgver/OliveTin-$_pkgver-linux-arm32v7.tar.gz")
source_aarch64=("https://github.com/OliveTin/OliveTin/releases/download/$_pkgver/OliveTin-$_pkgver-linux-arm64.tar.gz")
+source=("olivetin.service"
+ "olivetin@.service")
sha256sums_x86_64=('834adb89db7bed9819c8a600b8e368145019b84db9d53b0b7cecf0c7ca1b9115')
sha256sums_armv5h=('b767a246b516741afcc2f491519aba88c2b78f8da0f299f5c99c8896136cade5')
sha256sums_armv6h=('a31d9f61323ec9ae9f46f6dba6292214c84a0d9fbd70ac067b289618a972286c')
sha256sums_armv7h=('0e3a748b1f0ef453bf4821ebd65b0b33e114de16e56b37ffa05a29f607897f0f')
sha256sums_aarch64=('43554c7194200adf912981c4fc0ff8c479ba2d1c39a7f65517666014cfa3d120')
-backup=("etc/OliveTin/config.yaml")
+sha256sums=('7d69ac6da345c383b616df7bab83257efa63c7c3574991dfe6e7b8976664ddb3'
+ '23d7f8b5bdc5d508cb8c23efd356d99ea5ad6d29f79c1cd4084f7d0f302ac49a')
+backup=("etc/olivetin/config.yaml")
prepare(){
+ # enter the proper directory
case "$CARCH" in
"x86_64") cd "OliveTin-$_pkgver-linux-amd64";;
"armv5h") cd "OliveTin-$_pkgver-linux-arm32v5";;
@@ -32,11 +37,12 @@ prepare(){
*) echo "[KO] Unsupported architecture provided" && return 1;;
esac
- # additional configurations defaults
+ # additional configuration defaults
cat >> "config.yaml" <<CONTENT
# see https://docs.olivetin.app/hide-nav.html
-hideNavigation: false
+ShowNavigation: true
+ShowFooter: true
# see https://docs.olivetin.app/network-ports.html
listenAddressRestActions: localhost:1338
@@ -47,14 +53,10 @@ listenAddressWebUI: localhost:1340
checkForUpdates: true
showNewVersions: true
CONTENT
-
- # use arch paths
- sed -i "OliveTin.service" \
- -e "s|\[Service\]|&\nWorkingDirectory=/var/lib/olivetin\nUser=root\nGroup=root|" \
- -e "s|/usr/local/bin/OliveTin|/usr/bin/olivetin|"
}
package(){
+ # enter the proper directory
case "$CARCH" in
"x86_64") cd "OliveTin-$_pkgver-linux-amd64";;
"armv5h") cd "OliveTin-$_pkgver-linux-arm32v5";;
@@ -63,12 +65,19 @@ package(){
"aarch64") cd "OliveTin-$_pkgver-linux-arm64";;
*) echo "[KO] Unsupported architecture provided" && return 1;;
esac
- install -d -m 755 "$pkgdir/etc/OliveTin"
- install -d -m 755 "$pkgdir/usr/share/webapps"
- install -d -m 755 "$pkgdir/var/lib/olivetin"
+
+ # binary
install -D -m 755 "OliveTin" "$pkgdir/usr/bin/olivetin"
- install -D -m 644 "OliveTin.service" "$pkgdir/usr/lib/systemd/system/olivetin.service"
- install -D -m 644 "config.yaml" "$pkgdir/etc/OliveTin/config.yaml"
+
+ # configuration
+ install -d -m 755 "$pkgdir/etc/olivetin"
+ install -D -m 644 "config.yaml" "$pkgdir/etc/olivetin/config.yaml"
+
+ # webui files
+ install -d -m 755 "$pkgdir/usr/share/webapps/olivetin"
cp -r "webui" "$pkgdir/usr/share/webapps/olivetin"
- ln -s "/usr/share/webapps/olivetin" "$pkgdir/var/lib/olivetin/webui"
+
+ # systemd unit
+ install -D -m 644 "$srcdir/olivetin.service" "$pkgdir/usr/lib/systemd/system/olivetin.service"
+ install -D -m 644 "$srcdir/olivetin@.service" "$pkgdir/usr/lib/systemd/system/olivetin@.service"
}
diff --git a/olivetin.service b/olivetin.service
new file mode 100644
index 000000000000..0e41a5bbea85
--- /dev/null
+++ b/olivetin.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OliveTin
+
+[Service]
+WorkingDirectory=/usr/share/webapps/olivetin
+User=root
+ExecStart=/usr/bin/olivetin -configdir /etc/olivetin
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/olivetin@.service b/olivetin@.service
new file mode 100644
index 000000000000..0350e7420f1a
--- /dev/null
+++ b/olivetin@.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OliveTin run by %I
+
+[Service]
+WorkingDirectory=/usr/share/webapps/olivetin
+User=%i
+ExecStart=/usr/bin/olivetin -configdir /etc/olivetin/%i
+Restart=always
+
+[Install]
+WantedBy=multi-user.target