aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2015-06-27 20:43:29 +0100
committerStuart Shelton <stuart@shelton.me>2015-06-27 20:43:29 +0100
commitb8ab7241d636cfc273499d06bcc98a19abadc9a7 (patch)
tree2d37763cdc471fdac27f20cbf6c737b68667710c
parentUpdate files/apcupsd.init.4, affecting sys-power/apcupsd-3.14.10-r6, sys-powe... (diff)
downloadsrcshelton-b8ab7241d636cfc273499d06bcc98a19abadc9a7.tar.gz
srcshelton-b8ab7241d636cfc273499d06bcc98a19abadc9a7.tar.bz2
srcshelton-b8ab7241d636cfc273499d06bcc98a19abadc9a7.zip
Add additional QA check for scripts containing '/run' being deployed to /etc/{init,conf}.d/
-rw-r--r--README.md2
-rwxr-xr-xmetadata/install-qa-check.d/95run-directory28
2 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7ba8ece0..55d05c57 100644
--- a/README.md
+++ b/README.md
@@ -230,6 +230,8 @@ A similar configuration file could be added for all packages which fail to compi
# Fixes for ebuilds using `/run`
(... rather than `/var/run`)
+Included as `install-qa-check.d/95run-directory` is the repo `metadata` directory is an additional QA check which reports an error if files deployed to `/etc/init.d` or `/etc/conf.d` contain references to `/run`.
+
* app-admin/eselect-php
* app-admin/syslog-ng
* app-admin/ulogd
diff --git a/metadata/install-qa-check.d/95run-directory b/metadata/install-qa-check.d/95run-directory
new file mode 100755
index 00000000..2227eeb3
--- /dev/null
+++ b/metadata/install-qa-check.d/95run-directory
@@ -0,0 +1,28 @@
+# Check for deprecated use of /run in place of /var/run
+
+run_check() {
+ if [[ -d "${D%/}"/etc ]]; then
+ if [[ -d "${D%/}"/etc/init.d || -d "${D%/}"/etc/conf.d ]]; then
+ if grep '/run/' "${D%/}"/etc/{init,conf}.d/* | grep -v '/var/run/' | grep -q '/run/'; then
+ local -A list=()
+ local -a files=()
+ while read -r i; do
+ list["${i#${D}}"]=1
+ done < <(grep -H '/run/' "${D%/}"/etc/{init,conf}.d/* | grep -v '/var/run/' | cut -d':' -f 1)
+ files="${!list[@]}"
+ if (( 1 == ${#files[@]} )) && [[ "${files[*]}" =~ etc/init.d/bootmisc ]]; then
+ :
+ else
+ eqawarn "Repo QA Notice: files referencing /run:"
+ eqatag -v using-run "${files[@]/#//}"
+ die "Aborting due to Repo QA concerns: ${#files[@]} files reference /run"
+ fi
+ fi
+ fi
+ fi
+}
+
+run_check
+: # guarantee successful exit
+
+# vim:ft=sh