# complain (tag) when we encounters some commands on maintainer script
# format is:
# tag ~~in cat string ~~ package exception ~~ only in file ~~ regexp
#
# Where:
#   - tag is the tag to emit
#   - when in cat string is true check in HERE document
#   - ignore sections automatically generated by debhelper
#   - package exception is a regexp for checking only in some package
#     Use empty string for checking in all packages.
#   - only in file is a regexp for checking only in some maintainer script
#     Empty means check in all files.
#   - regexp is the regexp to check. First group ($1) will be printed if found as extra tag info
#     You could use the special variable ${LEADING_PATTERN} if needed (see below).
#
# ${LEADING_PATTERN}:
# When detecting commands inside shell scripts, use this regex to match the
# beginning of the command rather than checking whether the command is at the
# beginning of a line.
#
# Please alpha sort by tag
#
# Please use maintainer-script-should-not- for tag name. This will
# automatically pass the "tag coverage" tests.

# ftpmaster auto reject so do not rename
install-info-used-in-maintainer-script                          ~~ 1 ~~ 0 ~~                    ~~          ~~\binstall-info\b
# ftpmaster auto reject so do not rename
maintainer-script-removes-device-files                          ~~ 0 ~~ 0 ~~                    ~~          ~~^\s*rm\s+(?:[^>]*\s)?(/dev/(?!(?:shm/|\.[^.]+))[^/ ]+)

maintainer-script-hides-init-failure                            ~~ 0 ~~ 0 ~~                    ~~          ~~invoke-rc.d.*\|\| \s+ exit \s+ 0
maintainer-script-changes-ld-so-conf                            ~~ 0 ~~ 0 ~~^libc               ~~          ~~(?:\A\s*(?:cp|mv)\s+.*\s+|>\s*)/etc/ld\.so\.conf\s*(?:\s|\Z)
maintainer-script-changes-netbase                               ~~ 0 ~~ 0 ~~                    ~~          ~~(?:\A\s*(?:cp|mv)\s+.*\s+|>\s*)(/etc/(?:services|protocols|rpc))\s*(?:\s|\Z)
maintainer-script-should-not-parse-etc-passwd-or-group          ~~ 0 ~~ 0 ~~                    ~~          ~~\b([ef]?grep\b.*/etc/(?:passwd|group))\b
maintainer-script-calls-chown-improperly                        ~~ 0 ~~ 0 ~~                    ~~          ~~(chown(?:\s+--?[A-Za-z-]+)*\s+[-_A-Za-z0-9]+\.[-_A-Za-z0-9]+)\s+
maintainer-script-should-not-use-dpkg-maintscript-helper        ~~ 1 ~~ 1 ~~                    ~~          ~~dpkg-maintscript-helper
maintainer-script-updates-fontconfig-cache-improperly           ~~ 0 ~~ 0 ~~^(fontconfig)$      ~~          ~~${LEADING_PATTERN}(?:/usr/bin/)?fc-cache(?:\s|\Z)
maintainer-script-calls-gconftool                               ~~ 1 ~~ 0 ~~^(gconf\d)$         ~~          ~~(?:/usr/bin/)?gconftool(?:-\d)?(?:\s|\Z)
maintainer-script-calls-install-sgmlcatalog                     ~~ 1 ~~ 0 ~~                    ~~          ~~\binstall-sgmlcatalog\b
recursive-privilege-change                                      ~~ 1 ~~ 0 ~~                    ~~          ~~\b(?:(?:chmod|chown).*(?:-R|--recursive)|find(?:(?!-maxdepth[[:space:]]+1).)*exec.*(?:chmod|chown))\b
maintainer-script-should-not-use-piuparts-variable              ~~ 0 ~~ 0 ~~                    ~~          ~~(PIUPARTS_(?:TEST|OBJECTS|PHASE|DISTRIBUTION(?:_PREV|_NEXT)?))\b
maintainer-script-calls-service                                 ~~ 1 ~~ 0 ~~                    ~~          ~~${LEADING_PATTERN}service\s+
maintainer-script-calls-start-stop-daemon                       ~~ 0 ~~ 0 ~~                    ~~          ~~\bstart-stop-daemon(?=\s)(?!.*\s--stop\b)
postrm-removes-alternative                                      ~~ 1 ~~ 0 ~~                    ~~^postrm$  ~~\b update\-alternatives\s+\-\-remove\b
maintainer-script-sets-alternative-improperly                   ~~ 1 ~~ 0 ~~                    ~~          ~~^(?!\s*echo\s+["'][^'"]*)\bupdate\-alternatives\s+\-\-(?:set|set\-selections|config)\b
trailing-slash-for-dpkg-maintscript-helper-symlink_to_dir       ~~ 1 ~~ 0 ~~                    ~~          ~~ dpkg-maintscript-helper\s+symlink_to_dir\s+[^\s]+/\s
maintainer-script-switches-dir-to-symlink-unsafely              ~~ 1 ~~ 0 ~~                    ~~          ~~ ln[ ]*-f?s.*doc
systemd-alternatives                                            ~~ 1 ~~ 0 ~~                    ~~          ~~update-alternatives\s+--install\s+(/usr)?/lib/(systemd|udev|tmpfiles.d|sysusers.d|repart.d|modules-load.d)
