File tree 4 files changed +31
-9
lines changed
4 files changed +31
-9
lines changed Original file line number Diff line number Diff line change 527
527
input . gid = ids . gids . input ;
528
528
} ;
529
529
530
- system . activationScripts . users = stringAfter [ "etc " ]
530
+ system . activationScripts . users = stringAfter [ "stdio " ]
531
531
''
532
532
${ pkgs . perl } /bin/perl -w \
533
533
-I${ pkgs . perlPackages . FileSlurp } /lib/perl5/site_perl \
Original file line number Diff line number Diff line change 20
20
sources = map ( x : x . source ) etc' ;
21
21
targets = map ( x : x . target ) etc' ;
22
22
modes = map ( x : x . mode ) etc' ;
23
- uids = map ( x : x . uid ) etc' ;
24
- gids = map ( x : x . gid ) etc' ;
23
+ users = map ( x : x . user ) etc' ;
24
+ groups = map ( x : x . group ) etc' ;
25
25
} ;
26
26
27
27
in
108
108
'' ;
109
109
} ;
110
110
111
+ user = mkOption {
112
+ default = "+${ toString config . uid } " ;
113
+ type = types . str ;
114
+ description = ''
115
+ User name of created file.
116
+ Only takes affect when the file is copied (that is, the mode is not 'symlink').
117
+ Changing this option takes precedence over <literal>uid</literal>.
118
+ '' ;
119
+ } ;
120
+
121
+ group = mkOption {
122
+ default = "+${ toString config . gid } " ;
123
+ type = types . str ;
124
+ description = ''
125
+ Group name of created file.
126
+ Only takes affect when the file is copied (that is, the mode is not 'symlink').
127
+ Changing this option takes precedence over <literal>gid</literal>.
128
+ '' ;
129
+ } ;
130
+
111
131
} ;
112
132
113
133
config = {
130
150
131
151
system . build . etc = etc ;
132
152
133
- system . activationScripts . etc = stringAfter [ "stdio " ]
153
+ system . activationScripts . etc = stringAfter [ "users" "groups " ]
134
154
''
135
155
# Set up the statically computed bits of /etc.
136
156
echo "setting up /etc..."
Original file line number Diff line number Diff line change 6
6
sources_=($sources )
7
7
targets_=($targets )
8
8
modes_=($modes )
9
- uids_ =($uids )
10
- gids_ =($gids )
9
+ users_ =($users )
10
+ groups_ =($groups )
11
11
set +f
12
12
13
13
for (( i = 0 ; i < ${# targets_[@]} ; i++ )) ; do
@@ -36,9 +36,9 @@ for ((i = 0; i < ${#targets_[@]}; i++)); do
36
36
fi
37
37
38
38
if test " ${modes_[$i]} " ! = symlink; then
39
- echo " ${modes_[$i]} " > $out /etc/$target .mode
40
- echo " ${uids_ [$i]} " > $out /etc/$target .uid
41
- echo " ${gids_ [$i]} " > $out /etc/$target .gid
39
+ echo " ${modes_[$i]} " > $out /etc/$target .mode
40
+ echo " ${users_ [$i]} " > $out /etc/$target .uid
41
+ echo " ${groups_ [$i]} " > $out /etc/$target .gid
42
42
fi
43
43
44
44
fi
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ sub link {
108
108
my $uid = read_file(" $_ .uid" ); chomp $uid ;
109
109
my $gid = read_file(" $_ .gid" ); chomp $gid ;
110
110
copy " $static /$fn " , " $target .tmp" or warn ;
111
+ $uid = getpwnam $uid unless $uid =~ / ^\+ / ;
112
+ $gid = getgrnam $gid unless $gid =~ / ^\+ / ;
111
113
chown int ($uid ), int ($gid ), " $target .tmp" or warn ;
112
114
chmod oct ($mode ), " $target .tmp" or warn ;
113
115
rename " $target .tmp" , $target or warn ;
You can’t perform that action at this time.
0 commit comments