scripts/functions: Use stat correctly on non-GNU (BSD/Darwin) systems.
authorTitus von Boxberg <titus@v9g.de>
Wed May 19 18:22:32 2010 +0200 (2010-05-19)
changeset 195679de82f5843d
parent 1955 7d3e9e91dd9a
child 1957 0b638721bff2
scripts/functions: Use stat correctly on non-GNU (BSD/Darwin) systems.

Call to get the directory mode depending on $CT_SYS_OS

yann.morin.1998@anciens.enib.fr:
CT_SYS_OS has changed on Linuxsystem, it only gets the kernel name "Linux",
and not the system name, 'GNU/'.
scripts/functions
     1.1 --- a/scripts/functions	Wed May 19 18:08:23 2010 +0200
     1.2 +++ b/scripts/functions	Wed May 19 18:22:32 2010 +0200
     1.3 @@ -252,7 +252,17 @@
     1.4      local mode
     1.5      for dir in "${@}"; do
     1.6          [ -d "${dir}" ] || continue
     1.7 -        mode="$(stat -c '%a' "$(dirname "${dir}")")"
     1.8 +        case "$CT_SYS_OS" in
     1.9 +            Linux)
    1.10 +                mode="$(stat -c '%a' "$(dirname "${dir}")")"
    1.11 +                ;;
    1.12 +            Darwin|*BSD)
    1.13 +                mode="$(stat -f '%Lp' "$(dirname "${dir}")")"
    1.14 +                ;;
    1.15 +            *)
    1.16 +                CT_Abort "Unhandled host OS $CT_SYS_OS"
    1.17 +                ;;
    1.18 +        esac
    1.19          CT_DoExecLog ALL chmod u+w "$(dirname "${dir}")"
    1.20          CT_DoExecLog ALL chmod -R u+w "${dir}"
    1.21          CT_DoExecLog ALL rm -rf "${dir}"