From c22acb3072a79c841ad16a333deae42731e3b8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 6 Sep 2022 10:31:17 +0700 Subject: [PATCH] 99-pkglint: forbid /usr/etc data files should go to /usr/share, config files should go to /etc --- common/hooks/pre-pkg/99-pkglint.sh | 2 +- common/wrappers/which.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 common/wrappers/which.sh diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index 325938f5d54..7e40e81f2b4 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -22,7 +22,7 @@ hook() { fi done - for f in var/run usr/local; do + for f in var/run usr/local usr/etc; do if [ -d ${PKGDESTDIR}/${f} ]; then msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n" error=1 diff --git a/common/wrappers/which.sh b/common/wrappers/which.sh new file mode 100644 index 00000000000..3dc47063b2e --- /dev/null +++ b/common/wrappers/which.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +ret=0 + +while test $# != 0; do + case "$1" in + -*) ;; + *) command -v "$1" || ret=1 ;; + esac + shift +done + +exit "$ret"