git » picocom.git » commit 9476dd4

/run/lock is no more world writable

author Sébastien Luttringer
2012-08-12 14:03:45 UTC
committer Sébastien Luttringer
2012-08-12 14:03:45 UTC
parent 59b07310af98b5c631dcd07484d5ffbd91b50266

/run/lock is no more world writable

PKGBUILD +8 -2
picocom.install +19 -0

diff --git a/PKGBUILD b/PKGBUILD
index 97587aa..3d44636 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,24 +3,30 @@
 
 pkgname=picocom
 pkgver=1.7
-pkgrel=1
+pkgrel=2
 pkgdesc='Minimal dumb-terminal emulation program, very much like minicom'
 url='http://code.google.com/p/picocom/'
 license=('GPL2')
 arch=('i686' 'x86_64')
 depends=('glibc')
+install=$pkgname.install
 source=("http://$pkgname.googlecode.com/files/$pkgname-$pkgver.tar.gz")
 sha1sums=('bde6e36af71db845913f9d61f28dee1b485218fa')
 
 build() {
   cd $pkgname-$pkgver
-  make --environment-overrides UUCP_LOCK_DIR=/run/lock
+  make --environment-overrides UUCP_LOCK_DIR=/run/lock/picocom
 }
 
 package() {
   cd $pkgname-$pkgver
   install -D -m 755 picocom "$pkgdir/usr/bin/picocom"
   install -D -m 644 picocom.8 "$pkgdir/usr/share/man/man8/picocom.8"
+  # install tmpfiles for lock files
+  # http://lists.freedesktop.org/archives/systemd-devel/2011-March/001823.html
+  install -D -m 644 /dev/null "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+  echo "d /run/lock/$pkgname 0770 root uucp" \
+    > "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
 }
 
 # vim:set ts=2 sw=2 ft=sh et:
diff --git a/picocom.install b/picocom.install
new file mode 100644
index 0000000..4d2f2ed
--- /dev/null
+++ b/picocom.install
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+## arg 1:  the new package version
+post_install() {
+  type systemd-tmpfiles >/dev/null && systemd-tmpfiles --create picocom.conf
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  post_install "$1"
+}
+
+## arg 1:  the old package version
+post_remove() {
+ type systemd-tmpfiles >/dev/null && systemd-tmpfiles --clean --remove picocom.conf
+}
+
+# vim:set ts=2 sw=2 ft=sh et: