diff options
author | B. Watson <yalhcru@gmail.com> | 2022-04-04 14:07:14 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2022-04-04 14:07:14 -0400 |
commit | 533599f74e56dc42bdac215e2d152f9769b6b56e (patch) | |
tree | 9a8d349d138937a7c2880589ae16078b68f4009e /sbopkglint.d/45-doinst.t.sh | |
download | sbo-maintainer-tools-533599f74e56dc42bdac215e2d152f9769b6b56e.tar.gz |
initial commit
Diffstat (limited to 'sbopkglint.d/45-doinst.t.sh')
-rw-r--r-- | sbopkglint.d/45-doinst.t.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sbopkglint.d/45-doinst.t.sh b/sbopkglint.d/45-doinst.t.sh new file mode 100644 index 0000000..ae47c72 --- /dev/null +++ b/sbopkglint.d/45-doinst.t.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +# sbopkglint test, must be sourced by sbopkglint (not run standalone). + +# PKG, PRGNAM, VERSION, ARCH are set by sbopkglint. also the current +# directory is the root of the installed package tree. This test +# also uses the filename variable. + +####################################################################### +# check the doinst.sh. its job is to generate various files by running +# e.g. update-desktop-database, which creates a cache file. if the +# cache file exists, and doinst.sh either doesn't exist, or doesn't +# contain an update-desktop-database, that's very bad: it means +# the cache file is actually included in the package. which means, +# installing such a package would overwrite the user's local cache, +# breaking his desktop, until he fixes it (either manually or giving +# up and logging out or rebooting). + +doinst=var/lib/pkgtools/scripts/"$( echo $filename | sed 's,\.[^.]*$,,' )" + +have_doinst() { + [ -e "$doinst" ] + return $? +} + +grep_doinst() { + have_doinst && grep -q "$@" $doinst + return $? +} + +doinst_warn() { + local msg="doinst.sh is missing, package needs one, with" + have_doinst && msg="doinst.sh exists, but is missing" + warn "$msg $@" +} + +doinst_chk_command() { + local cmd="$1" + grep_doinst "$cmd" || doinst_warn "$cmd" +} + +[ "$( find -L usr/share/icons -type f 2>/dev/null )" != "" ] && \ + doinst_chk_command "gtk-update-icon-cache" + +[ "$( find -L usr/share/applications -type f 2>/dev/null )" != "" ] && \ + doinst_chk_command "update-desktop-database" + +[ "$( find -L usr/share/glib-2.0/schemas -type f 2>/dev/null )" != "" ] && \ + doinst_chk_command "glib-compile-schemas" + +[ "$( find -L usr/share/fonts -type f 2>/dev/null )" != "" ] && \ + doinst_chk_command "fc-cache" + |