From e1e97fc99c3aa60ca114fcbc0ea458a1a5f5428a Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sat, 6 Oct 2018 16:59:19 +0300 Subject: [PATCH] desktop-file-utils: simplify hooks --- x11-packages/desktop-file-utils/build.sh | 13 +++++++++---- x11-packages/desktop-file-utils/hooks/postinst.in | 7 +++++++ x11-packages/desktop-file-utils/hooks/postrm.in | 10 ++++++++++ x11-packages/desktop-file-utils/hooks/triggers.in | 1 + x11-packages/desktop-file-utils/postinst | 10 ---------- x11-packages/desktop-file-utils/postrm | 12 ------------ x11-packages/desktop-file-utils/triggers | 1 - 7 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 x11-packages/desktop-file-utils/hooks/postinst.in create mode 100644 x11-packages/desktop-file-utils/hooks/postrm.in create mode 100644 x11-packages/desktop-file-utils/hooks/triggers.in delete mode 100755 x11-packages/desktop-file-utils/postinst delete mode 100755 x11-packages/desktop-file-utils/postrm delete mode 100644 x11-packages/desktop-file-utils/triggers diff --git a/x11-packages/desktop-file-utils/build.sh b/x11-packages/desktop-file-utils/build.sh index c0cfd6ca7..b1d6d75e6 100644 --- a/x11-packages/desktop-file-utils/build.sh +++ b/x11-packages/desktop-file-utils/build.sh @@ -3,13 +3,18 @@ TERMUX_PKG_MAINTAINER="Leonid Plyushch @xeffyr" TERMUX_PKG_HOMEPAGE=https://www.freedesktop.org/wiki/Software/desktop-file-utils TERMUX_PKG_DESCRIPTION="Command line utilities for working with desktop entries" TERMUX_PKG_VERSION=0.23 -TERMUX_PKG_REVISION=9 +TERMUX_PKG_REVISION=10 TERMUX_PKG_SRCURL=https://www.freedesktop.org/software/desktop-file-utils/releases/desktop-file-utils-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=6c094031bdec46c9f621708f919084e1cb5294e2c5b1e4c883b3e70cb8903385 TERMUX_PKG_DEPENDS="glib" termux_step_create_debscripts() { - cp "${TERMUX_PKG_BUILDER_DIR}/postinst" ./ - cp "${TERMUX_PKG_BUILDER_DIR}/postrm" ./ - cp "${TERMUX_PKG_BUILDER_DIR}/triggers" ./ + for i in postinst postrm triggers; do + sed \ + "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + "${TERMUX_PKG_BUILDER_DIR}/hooks/${i}.in" > ./${i} + chmod 755 ./${i} + done + unset i + chmod 644 ./triggers } diff --git a/x11-packages/desktop-file-utils/hooks/postinst.in b/x11-packages/desktop-file-utils/hooks/postinst.in new file mode 100644 index 000000000..860925308 --- /dev/null +++ b/x11-packages/desktop-file-utils/hooks/postinst.in @@ -0,0 +1,7 @@ +#!@TERMUX_PREFIX@/bin/sh + +if [ -d "@TERMUX_PREFIX@/share/applications" ]; then + update-desktop-database -q +fi + +exit 0 diff --git a/x11-packages/desktop-file-utils/hooks/postrm.in b/x11-packages/desktop-file-utils/hooks/postrm.in new file mode 100644 index 000000000..c7617b7b1 --- /dev/null +++ b/x11-packages/desktop-file-utils/hooks/postrm.in @@ -0,0 +1,10 @@ +#!@TERMUX_PREFIX@/bin/sh + +if [ "${1}" = "remove" ]; then + if [ -d "@TERMUX_PREFIX@/share/applications" ]; then + rm -f "@TERMUX_PREFIX@/share/applications/mimeinfo.cache" + rmdir --ignore-fail-on-non-empty "@TERMUX_PREFIX@/share/applications" + fi +fi + +exit 0 diff --git a/x11-packages/desktop-file-utils/hooks/triggers.in b/x11-packages/desktop-file-utils/hooks/triggers.in new file mode 100644 index 000000000..040baa742 --- /dev/null +++ b/x11-packages/desktop-file-utils/hooks/triggers.in @@ -0,0 +1 @@ +interest-noawait @TERMUX_PREFIX@/share/applications diff --git a/x11-packages/desktop-file-utils/postinst b/x11-packages/desktop-file-utils/postinst deleted file mode 100755 index 76e6a2d2a..000000000 --- a/x11-packages/desktop-file-utils/postinst +++ /dev/null @@ -1,10 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/sh -set -e - -if [ -d "/data/data/com.termux/files/usr/share/applications" ]; then - update-desktop-database -q -fi - -if [ "${1}" = "triggered" ]; then - exit 0 -fi diff --git a/x11-packages/desktop-file-utils/postrm b/x11-packages/desktop-file-utils/postrm deleted file mode 100755 index 8db6023a8..000000000 --- a/x11-packages/desktop-file-utils/postrm +++ /dev/null @@ -1,12 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/sh -set -e -APPDIR="/data/data/com.termux/files/usr/share/applications" - -if [ "${1}" = "remove" ]; then - if [ -d "${APPDIR}" ]; then - rm -f "${APPDIR}/mimeinfo.cache" - if [ ! -L "${APPDIR}" ]; then - rmdir --ignore-fail-on-non-empty "${APPDIR}" - fi - fi -fi diff --git a/x11-packages/desktop-file-utils/triggers b/x11-packages/desktop-file-utils/triggers deleted file mode 100644 index 32d39b9bc..000000000 --- a/x11-packages/desktop-file-utils/triggers +++ /dev/null @@ -1 +0,0 @@ -interest-noawait /data/data/com.termux/files/usr/share/applications