Fix @exec not respecting @cwd by calling cd(1) before @exec entries

@cwd /
@exec mkdir -pm 0770 var/audit/dist
@exec mkdir -pm 0700 var/audit/remote
@exec chown %%USERS%%:%%GROUPS%% var/audit/dist
@exec chown %%USERS%%:wheel var/audit/remote

scripts:
  post-install: |
    echo "===> Creating users and/or groups."
    if ! /usr/sbin/pw groupshow audit >/dev/null 2>&1; then  echo "Creating group 'audit' with gid '77'.";  /usr/sbin/pw groupadd audit -g 77; else echo "Using existing group 'audit'."; fi
    if ! /usr/sbin/pw usershow auditdistd >/dev/null 2>&1; then  echo "Creating user 'auditdistd' with uid '78'.";  /usr/sbin/pw useradd auditdistd -u 78 -g 77  -c "Auditdistd unprivileged user" -d /var/empty -s /usr/sbin/nologin;  else echo "Using existing user 'auditdistd'."; fi
    cd /
    mkdir -m 0770 var/audit/dist 2>/dev/null
    mkdir -m 0700 var/audit/remote 2>/dev/null
    chown auditdistd:%25GROUPS var/audit/dist
    chown auditdistd:wheel var/audit/remote
    /sbin/ldconfig -m /usr/local/lib
    cd /usr/local
    cd /usr/local
  pre-deinstall: |

Issue:	#465
Fix @unexec not respecting @cwd by calling cd(1) before @unexec entries

@unexec echo "before @cwd /"
@unexec echo "before @cwd / gtk-update-icon-cache"
@cwd /
@unexec rmdir var/audit/dist 2>/dev/null || true
@unexec rmdir var/audit/remote 2>/dev/null || true
@unexec echo "after @cwd / gtk-update-icon-cache"
@unexec echo "after @cwd /"

scripts:
  pre-deinstall: |
    cd /
    cd /usr/local
    cd /usr/local
    echo "before @cwd /"
    echo "after @cwd /"
    /sbin/ldconfig -R
  post-deinstall: |
    echo "before @cwd / gtk-update-icon-cache"
    cd /
    echo "after @cwd / gtk-update-icon-cache"
    cd /usr/local

Note that the pre-deinstall has the wrong ordering which will
be fixed in the next commit.

Issue:	#465
Fix @unexec not respecting plist order (which breaks @cwd expecations)

@unexec echo "before @cwd /"
@unexec echo "before @cwd / gtk-update-icon-cache"
@cwd /
@unexec rmdir var/audit/dist 2>/dev/null || true
@unexec rmdir var/audit/remote 2>/dev/null || true
@unexec echo "after @cwd / gtk-update-icon-cache"
@unexec echo "after @cwd /"

scripts:
  pre-deinstall: |
    echo "before @cwd /"
    cd /
    echo "after @cwd /"
    /sbin/ldconfig -R
    cd /usr/local
    cd /usr/local
  post-deinstall: |
    echo "before @cwd / gtk-update-icon-cache"
    cd /
    echo "after @cwd / gtk-update-icon-cache"
    cd /usr/local
    cd /usr/local

Issue:	#465
rquery: Return EX_UNAVAILABLE to be more consistent with pkg-query
Respect destdir
Merge branch '465-plist-cwd-exec-ordering'

* 465-plist-cwd-exec-ordering:
  Fix @unexec not respecting plist order (which breaks @cwd expecations)
  Fix @unexec not respecting @cwd by calling cd(1) before @unexec entries
  Fix @exec not respecting @cwd by calling cd(1) before @exec entries
The general case does not need PKGDB_CREATE access

Reported by:	Matthew Seaman
Move write check into pkgcli_update()

Suggested by:	Matthew Seaman
pkg-shell.8: Be more specific on why this command should not be used and given hints on other options
Merge remote-tracking branch 'upstream/master'