summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2013-08-10 11:14:44 +0200
committerFlorian Bruhin <git@the-compiler.org>2013-08-10 11:14:44 +0200
commit0cccbc298558afda6202f6656a67c7a25439b593 (patch)
tree20094040132b2878894150b30b104a224bfc70b6
parent82d1a404a5296e9c9996e547e2b227e079fc5b39 (diff)
downloadsshtunnel-0cccbc298558afda6202f6656a67c7a25439b593.tar.gz
sshtunnel-0cccbc298558afda6202f6656a67c7a25439b593.zip
Add an extra user/group for sshtunnel
-rw-r--r--pkgbuild/PKGBUILD2
-rw-r--r--pkgbuild/sshtunnel-git.install10
-rw-r--r--sshtunnel@.service2
3 files changed, 12 insertions, 2 deletions
diff --git a/pkgbuild/PKGBUILD b/pkgbuild/PKGBUILD
index 05e6e60..b588d77 100644
--- a/pkgbuild/PKGBUILD
+++ b/pkgbuild/PKGBUILD
@@ -13,6 +13,7 @@ optdepends=('autossh: More stabile connections')
provides=('sshtunnel')
conflicts=('sshtunnel')
backup=('etc/sshtunnel.conf')
+options('emptydirs')
install=$pkgname.install
source=('git://cmpl.cc/sshtunnel')
sha1sums=('SKIP')
@@ -27,6 +28,7 @@ package() {
install -dm755 "$pkgdir/etc"
install -dm755 "$pkgdir/usr/bin"
install -dm755 "$pkgdir/usr/lib/systemd/system"
+ install -o558 -g558 -dm770 "$pkgdir/var/lib/sshtunnel"
install -Dm755 sshtunnel "$pkgdir/usr/bin"
install -Dm644 sshtunnel.conf "$pkgdir/etc"
install -Dm644 sshtunnel@.service "$pkgdir/usr/lib/systemd/system"
diff --git a/pkgbuild/sshtunnel-git.install b/pkgbuild/sshtunnel-git.install
index 972c272..cdf35bd 100644
--- a/pkgbuild/sshtunnel-git.install
+++ b/pkgbuild/sshtunnel-git.install
@@ -1,11 +1,17 @@
# Maintainer: Florian Bruhin (The Compiler) <archlinux.org@the-compiler.org>
post_install() {
- true
+ getent group sshtunnel &>/dev/null || groupadd -r -g 558 sshtunnel >/dev/null
+ getent passwd sshtunnel &>/dev/null || useradd -r -u 558 -g sshtunnel -d /var/lib/sshtunnel -s /bin/false -c sshtunnel sshtunnel >/dev/null
}
post_upgrade() {
- true
+ post_install
+}
+
+post_remove() {
+ getent passwd sshtunnel &>/dev/null && userdel sshtunnel >/dev/null
+ getent group sshtunnel &>/dev/null && groupdel sshtunnel >/dev/null
}
# vim:set ts=2 sw=2 et:
diff --git a/sshtunnel@.service b/sshtunnel@.service
index 47f15b5..e5371b9 100644
--- a/sshtunnel@.service
+++ b/sshtunnel@.service
@@ -5,4 +5,6 @@ After=network.service
[Service]
Type=simple
+User=sshtunnel
+Group=sshtunnel
ExecStart=/usr/bin/sshtunnel-systemd %i