destore() {
  for dst in "$@"; do
    local MAYBESUDO=""
    if test ! -w "$(dirname "$(realpath --no-symlinks $dst)")" ; then
      MAYBESUDO="sudo"
      sudo true || {
        echo >&2 "ERROR: could not destore '$dst' due to lack of sudo"
        break
      }
    fi

    test -L "$dst" || continue
    # TODO: assert dst is in the store
    src="$(realpath "$dst")"
    if test -d "$src"; then
      (set -x
        $MAYBESUDO rm -v "$dst"
        $MAYBESUDO cp -r --dereference --one-file-system "$src/" "$dst/"
        $MAYBESUDO chmod -R +rw "$dst"
        $MAYBESUDO chown "$UID" -R "$dst"
      )
    elif test -f "$src"; then
      (set -x
        $MAYBESUDO rm -v "$dst"
        $MAYBESUDO cp -v "$src" "$dst"
        $MAYBESUDO chmod -v +rw "$dst"
        $MAYBESUDO chown -v "$UID" -v "$dst"
      )
    fi
  done
}

# TODO: "restore"
