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}"; | ||||
|       destination = lib.strings.escapeShellArg "${homedir}/${target.target}"; | ||||
|       mode = lib.strings.escapeShellArg "${target.mode}"; | ||||
|       dir_mode = lib.strings.escapeShellArg "${target.dir_mode}"; | ||||
|       username = lib.strings.escapeShellArg "${target.username}"; | ||||
|       group = lib.strings.escapeShellArg "${group}"; | ||||
|     }; | ||||
| @ -42,6 +43,7 @@ let | ||||
|           source | ||||
|           destination | ||||
|           mode | ||||
|           dir_mode | ||||
|           username | ||||
|           group | ||||
|           ; | ||||
| @ -50,6 +52,11 @@ let | ||||
|           (if username != "" then "-o ${username}" 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 | ||||
|       if target.recursive then | ||||
|         [ | ||||
| @ -59,7 +66,8 @@ let | ||||
|                 full_dest=${destination}/"$relative_path" | ||||
|                 containing_directory=$(dirname "$full_dest") | ||||
|                 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 | ||||
|                 $DRY_RUN_CMD install $VERBOSE_ARG -D --compare ${flags} "$file" "$full_dest" | ||||
|             done | ||||
| @ -107,6 +115,7 @@ let | ||||
|           source | ||||
|           destination | ||||
|           mode | ||||
|           dir_mode | ||||
|           username | ||||
|           group | ||||
|           ; | ||||
| @ -116,8 +125,8 @@ let | ||||
|             group | ||||
|           ] | ||||
|         ); | ||||
|         flags = lib.strings.concatStringsSep " " [ | ||||
|           (if mode != "" then "-m ${mode}" 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 "") | ||||
|         ]; | ||||
| @ -130,7 +139,7 @@ let | ||||
|                 full_dest=${destination}/"$relative_path" | ||||
|                 containing_directory=$(dirname "$full_dest") | ||||
|                 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 | ||||
|                 $DRY_RUN_CMD ln $VERBOSE_ARG -s "$file" "$full_dest" | ||||
|                 $DRY_RUN_CMD chown $VERBOSE_ARG -h ${owner} "$full_dest" | ||||
| @ -239,6 +248,13 @@ in | ||||
|                           example = "0750"; | ||||
|                           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 { | ||||
|                           type = lib.types.path; | ||||
|                           defaultText = "me.install.file.‹path›.source"; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander