diff --git a/cdist/conf/type/__git/explorer/group b/cdist/conf/type/__git/explorer/group deleted file mode 100755 index 938f61d3..00000000 --- a/cdist/conf/type/__git/explorer/group +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -destination="/$__object_id/.git" - -os="$(cat "$__global/explorer/os")" - -case $os in - *bsd) - # Checked on OpenBSD, FreeBSD and NetBSD - stat -f "%Sg" "${destination}" 2>/dev/null || exit 0 - ;; - *) - stat --print "%G" "${destination}" 2>/dev/null || exit 0 - ;; -esac diff --git a/cdist/conf/type/__git/explorer/group b/cdist/conf/type/__git/explorer/group new file mode 120000 index 00000000..dcfd4bb5 --- /dev/null +++ b/cdist/conf/type/__git/explorer/group @@ -0,0 +1 @@ +owner \ No newline at end of file diff --git a/cdist/conf/type/__git/explorer/owner b/cdist/conf/type/__git/explorer/owner index 0442b11a..6187dd82 100755 --- a/cdist/conf/type/__git/explorer/owner +++ b/cdist/conf/type/__git/explorer/owner @@ -2,14 +2,28 @@ destination="/$__object_id/.git" -os="$(cat "$__global/explorer/os")" +action="$(basename "${0}")" + +case $action in + owner) + bsd_fmt="%Su" + linux_fmt="%U" + ;; + group) + bsd_fmt="%Sg" + linux_fmt="%G" + ;; +esac + + +os="$(uname | tr '[:upper:]' '[:lower:]')" case $os in *bsd) # Checked on OpenBSD, FreeBSD and NetBSD - stat -f "%Su" "${destination}" 2>/dev/null || exit 0 + stat -f "${bsd_fmt}" "${destination}" 2>/dev/null || exit 0 ;; *) - stat --print "%U" "${destination}" 2>/dev/null || exit 0 + stat --print "${linux_fmt}" "${destination}" 2>/dev/null || exit 0 ;; esac