Support separate permissions for containing directories.
This commit is contained in:
parent
2b485f7f1d
commit
f1eaaf12b3
@ -22,6 +22,7 @@ let
|
|||||||
source = lib.strings.escapeShellArg "${target.source}";
|
source = lib.strings.escapeShellArg "${target.source}";
|
||||||
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
|
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
|
||||||
mode = lib.strings.escapeShellArg "${target.mode}";
|
mode = lib.strings.escapeShellArg "${target.mode}";
|
||||||
|
dir_mode = lib.strings.escapeShellArg "${target.dir_mode}";
|
||||||
username = lib.strings.escapeShellArg "${target.username}";
|
username = lib.strings.escapeShellArg "${target.username}";
|
||||||
group = lib.strings.escapeShellArg "${group}";
|
group = lib.strings.escapeShellArg "${group}";
|
||||||
};
|
};
|
||||||
@ -42,6 +43,7 @@ let
|
|||||||
source
|
source
|
||||||
destination
|
destination
|
||||||
mode
|
mode
|
||||||
|
dir_mode
|
||||||
username
|
username
|
||||||
group
|
group
|
||||||
;
|
;
|
||||||
@ -50,6 +52,11 @@ let
|
|||||||
(if username != "" then "-o ${username}" else "")
|
(if username != "" then "-o ${username}" else "")
|
||||||
(if group != "" then "-g ${group}" else "")
|
(if group != "" then "-g ${group}" else "")
|
||||||
];
|
];
|
||||||
|
dir_flags = lib.strings.concatStringsSep " " [
|
||||||
|
(if dir_mode != "" then "-m ${dir_mode}" else "")
|
||||||
|
(if username != "" then "-o ${username}" else "")
|
||||||
|
(if group != "" then "-g ${group}" else "")
|
||||||
|
];
|
||||||
in
|
in
|
||||||
if target.recursive then
|
if target.recursive then
|
||||||
[
|
[
|
||||||
@ -59,7 +66,8 @@ let
|
|||||||
full_dest=${destination}/"$relative_path"
|
full_dest=${destination}/"$relative_path"
|
||||||
containing_directory=$(dirname "$full_dest")
|
containing_directory=$(dirname "$full_dest")
|
||||||
if [ ! -e "$containing_directory" ]; then
|
if [ ! -e "$containing_directory" ]; then
|
||||||
$DRY_RUN_CMD install $VERBOSE_ARG -d "$containing_directory"
|
echo ""
|
||||||
|
$DRY_RUN_CMD install $VERBOSE_ARG -d ${dir_flags} "$containing_directory"
|
||||||
fi
|
fi
|
||||||
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare ${flags} "$file" "$full_dest"
|
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare ${flags} "$file" "$full_dest"
|
||||||
done
|
done
|
||||||
@ -107,6 +115,7 @@ let
|
|||||||
source
|
source
|
||||||
destination
|
destination
|
||||||
mode
|
mode
|
||||||
|
dir_mode
|
||||||
username
|
username
|
||||||
group
|
group
|
||||||
;
|
;
|
||||||
@ -116,8 +125,8 @@ let
|
|||||||
group
|
group
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
flags = lib.strings.concatStringsSep " " [
|
dir_flags = lib.strings.concatStringsSep " " [
|
||||||
(if mode != "" then "-m ${mode}" else "")
|
(if dir_mode != "" then "-m ${dir_mode}" else "")
|
||||||
(if username != "" then "-o ${username}" else "")
|
(if username != "" then "-o ${username}" else "")
|
||||||
(if group != "" then "-g ${group}" else "")
|
(if group != "" then "-g ${group}" else "")
|
||||||
];
|
];
|
||||||
@ -130,7 +139,7 @@ let
|
|||||||
full_dest=${destination}/"$relative_path"
|
full_dest=${destination}/"$relative_path"
|
||||||
containing_directory=$(dirname "$full_dest")
|
containing_directory=$(dirname "$full_dest")
|
||||||
if [ ! -e "$containing_directory" ]; then
|
if [ ! -e "$containing_directory" ]; then
|
||||||
$DRY_RUN_CMD install $VERBOSE_ARG -d ${flags} "$containing_directory"
|
$DRY_RUN_CMD install $VERBOSE_ARG -d ${dir_flags} "$containing_directory"
|
||||||
fi
|
fi
|
||||||
$DRY_RUN_CMD ln $VERBOSE_ARG -s "$file" "$full_dest"
|
$DRY_RUN_CMD ln $VERBOSE_ARG -s "$file" "$full_dest"
|
||||||
$DRY_RUN_CMD chown $VERBOSE_ARG -h ${owner} "$full_dest"
|
$DRY_RUN_CMD chown $VERBOSE_ARG -h ${owner} "$full_dest"
|
||||||
@ -239,6 +248,13 @@ in
|
|||||||
example = "0750";
|
example = "0750";
|
||||||
description = "The read, write, execute permission flags.";
|
description = "The read, write, execute permission flags.";
|
||||||
};
|
};
|
||||||
|
dir_mode = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "0755";
|
||||||
|
defaultText = "dir_mode";
|
||||||
|
example = "0755";
|
||||||
|
description = "The read, write, execute permission flags for any parent directories that need to be created.";
|
||||||
|
};
|
||||||
source = lib.mkOption {
|
source = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
defaultText = "me.install.file.‹path›.source";
|
defaultText = "me.install.file.‹path›.source";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user