diff options
author | Đoàn Trần Công Danh <congdanhqx@gmail.com> | 2020-05-23 11:55:59 +0000 |
---|---|---|
committer | Danh Doan <congdanhqx@gmail.com> | 2020-05-31 02:11:11 +0000 |
commit | 91c0eaa5a711cb028a0473669fe13468db872f1f (patch) | |
tree | a83e080293aa299fd635f7d17225b4e9c355f5be | |
parent | 4ad0e936b1e2cdc1d11109cd2cea3cdd8cf309d1 (diff) | |
download | void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar.gz void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar.bz2 void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar.lz void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar.xz void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.tar.zst void-packages-91c0eaa5a711cb028a0473669fe13468db872f1f.zip |
xbps-src: pre-pkg: allow only white-listed directories.
-rw-r--r-- | common/hooks/pre-pkg/99-pkglint.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index d2c281e39db..e17c5231a14 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -21,13 +21,38 @@ hook() { fi done - for f in sys dev home root run var/run tmp usr/local destdir; do + for f in var/run usr/local; do if [ -d ${PKGDESTDIR}/${f} ]; then msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n" error=1 fi done + for f in "$PKGDESTDIR"/*; do + f="${f##*/}" + case "$f" in + '*') # The filename is exactly '*' + if [ -e "${PKGDESTDIR}/*" ]; then + msg_red "${pkgver}: File /* is not allowed\n" + error=1 + fi + # Empty meta package is fine + ;; + lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv) + ;; + INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides) + if [ ! -f "${PKGDESTDIR}/$f" ]; then + msg_red "${pkgver}: /${f} is not allowed\n" + error=1 + fi + ;; + *) + msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n" + error=1 + ;; + esac + done + # Check that configuration files really exist. for f in $(expand_destdir "${conf_files}"); do if [ ! -f "${PKGDESTDIR}/${f}" ]; then |