# # # patch "contrib/mtn_makepermissions" # from [765d61b2f8eb36791c107b2b390ebdd0e3c21c79] # to [4e026c5a17e341b54b45f6712bffa5a6e9c05219] # ============================================================ --- contrib/mtn_makepermissions 765d61b2f8eb36791c107b2b390ebdd0e3c21c79 +++ contrib/mtn_makepermissions 4e026c5a17e341b54b45f6712bffa5a6e9c05219 @@ -45,28 +45,48 @@ my @files_to_clean_up = (); # my @files_to_clean_up = (); -for my $d (("read-permissions", "write-permissions")) { - if (opendir D,catdir($user_config,$d.".d")) { - if (open OUT_PERM,">".catdir($user_config,$d)) { - my %lines = (); - foreach my $d2 (sort readdir D) { - # Skip over file names starting with ., following Unix standards - if ( $d2 !~ m/^\./ ) { - open IN_PERM,catfile($user_config,$d.".d",$d2); - while () { - chomp; - $lines{$_} = 1; - } - close IN_PERM; +my $d = "read-permissions"; +if (opendir D,catdir($user_config,$d.".d")) { + if (open OUT_PERM,">".catdir($user_config,$d)) { + foreach my $d2 (sort readdir D) { + # Skip over file names starting with ., following Unix standards + if ( $d2 !~ m/^\./ ) { + open IN_PERM,catfile($user_config,$d.".d",$d2); + while () { + print OUT_PERM $_; } + print OUT_PERM "\n"; + close IN_PERM; } - print OUT_PERM join("\n", sort keys %lines), "\n"; - close OUT_PERM; } - closedir D; + close OUT_PERM; } + closedir D; } +# Since write-permissions is just a list of keys, we collect them all, +# make them unique and sort them before writing. Neater that way. +$d = "write-permissions"; +if (opendir D,catdir($user_config,$d.".d")) { + if (open OUT_PERM,">".catdir($user_config,$d)) { + my %lines = (); + foreach my $d2 (sort readdir D) { + # Skip over file names starting with ., following Unix standards + if ( $d2 !~ m/^\./ ) { + open IN_PERM,catfile($user_config,$d.".d",$d2); + while () { + chomp; + $lines{$_} = 1; + } + close IN_PERM; + } + } + print OUT_PERM join("\n", sort keys %lines), "\n"; + close OUT_PERM; + } + closedir D; +} + ###################################################################### # Clean up. #