diff options
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | PKGBUILD | 51 | ||||
-rw-r--r-- | pacman-ps.install | 30 |
3 files changed, 100 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e3538599a8a9 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = pacman-pstatus + pkgdesc = Provides a command to identify which running processes have files that have changed on disk. It also provides a pacman hook and pacman-ps to also show which packages own the files that are still open. (forked from samcv's pacman-ps) + pkgver = 0.1.0 + pkgrel = 0 + url = https://gitlab.com/renyuneyun/pacman-ps + install = pacman-ps.install + arch = any + license = GPLv2 + makedepends = git + depends = python + conflicts = pacman-ps + options = !strip + source = git+https://gitlab.com/renyuneyun/pacman-ps#commit=323c3dc46b59125b68fa808d89316b1f3884248c + source = pacman-ps.install + sha1sums = SKIP + sha1sums = 53dcfea595c1c59cd47ae45c7f083e3e03a5e219 + +pkgname = pacman-pstatus + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..4c33e1f50266 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,51 @@ +# Author and Maintainer: renyuneyun <renyuneyun@gmail.com> +# Original author: Samantha McVey <samantham@posteo.net> +# Copyright (C) 2017 +# This file and project are licensed under the GPLv2 or greater at your choice. +# For more information view the license included or visit: +# https://www.gnu.org/licenses/gpl-2.0.html + +pkgname=('pacman-pstatus') +pkgver=0.1.0 +pkgrel=0 +arch=('any') +url='https://gitlab.com/renyuneyun/pacman-ps' +license=('GPLv2') +depends=('python') +makedepends=('git') +conflicts=('pacman-ps') +pkgdesc="Provides a command to identify which running processes have files that \ + have changed on disk. It also provides a pacman hook and pacman-ps to also show \ + which packages own the files that are still open. (forked from samcv's pacman-ps)" +install='pacman-ps.install' + +options=('!strip') +source=('git+https://gitlab.com/renyuneyun/pacman-ps#commit=323c3dc46b59125b68fa808d89316b1f3884248c' + 'pacman-ps.install') +sha1sums=('SKIP' + '53dcfea595c1c59cd47ae45c7f083e3e03a5e219') + +package() { + LICENSE_DIR="/usr/share/licenses" + BIN_DIR="/usr/bin" + LIB_DIR="/usr/lib/pacman-ps" + HOOK_DIR="/etc/pacman.d/hooks" + MAN_DIR="/usr/share/man/man1" + + repodir=${srcdir}/pacman-ps + + install -D -m 644 ${repodir}/pacman-ps-post.hook ${pkgdir}${HOOK_DIR}/pacman-ps-post.hook + + install -D -m 755 ${repodir}/pacman-ps.py ${pkgdir}${LIB_DIR}/pacman-ps.py + install -D -m 755 ${repodir}/ps-lsof.py ${pkgdir}${LIB_DIR}/ps-lsof.py + + mkdir -p ${pkgdir}${BIN_DIR} + ln -sr ${pkgdir}${LIB_DIR}/pacman-ps.py ${pkgdir}${BIN_DIR}/pacman-ps + ln -sr ${pkgdir}${LIB_DIR}/ps-lsof.py ${pkgdir}${BIN_DIR}/ps-lsof + + install -D -m 755 ${repodir}/pacman-ps-posthook.sh ${pkgdir}${BIN_DIR}/pacman-ps-posthook + + install -D -m 644 ${repodir}/license.txt ${pkgdir}${LICENSE_DIR}/${pkgname}/license.txt + + install -D -m 644 ${repodir}/pacman-ps.1 ${pkgdir}${MAN_DIR}/pacman-ps.1 +} diff --git a/pacman-ps.install b/pacman-ps.install new file mode 100644 index 000000000000..9b5d17ba48cf --- /dev/null +++ b/pacman-ps.install @@ -0,0 +1,30 @@ +# This generated the initial database for pacman-ps +DB_DIR="/var/cache/pacman-ps" +post_install() { + # If the database exists, just update it and keep existing entries + if [ -f "${DB_DIR}/files.db" ]; then + pacman -Ql | sort -u -k 2,2 - "${DB_DIR}/files.db" > "${DB_DIR}/files-temp.db" + # Otherwise create it + else + mkdir -p "${DB_DIR}" + pacman -Ql | sort -u -k 2,2 - > ${DB_DIR}/files-temp.db + fi + rm "${DB_DIR}/files.db" + mv "${DB_DIR}/files-temp.db" "${DB_DIR}/files.db" + printf "Created initial database at %s/files.db\n" "${DB_DIR}" +} + +# On package upgrade if the database doesn't exist, create it +post_upgrade() { + if [ ! -f "${DB_DIR}/files.db" ]; then + printf "Can't find database at %s/files.db\nGenerating one" "${DB_DIR}" + pacman -Ql | sort -u -k 2,2 - > ${DB_DIR}/files-temp.db + fi +} + +# This removes the initial database for pacman-ps if it exists +post_remove() { + if [ -d "${DB_DIR}" ]; then + rm -rf "${DB_DIR}" + fi +} |