chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
53dfb82
)
Preserve permissions on /etc/shadow etc.
author
ian
<ian>
Sun, 3 Jan 1999 02:16:49 +0000
(
02:16
+0000)
committer
ian
<ian>
Sun, 3 Jan 1999 02:16:49 +0000
(
02:16
+0000)
sync-accounts/sync-accounts
patch
|
blob
|
history
diff --git
a/sync-accounts/sync-accounts
b/sync-accounts/sync-accounts
index 6acfe4bf7e3625145761a72d63045008fca38c4a..1f48714c991a4b610bd8d26a08e1e304ce594e0d 100755
(executable)
--- a/
sync-accounts/sync-accounts
+++ b/
sync-accounts/sync-accounts
@@
-1,5
+1,5
@@
#!/usr/bin/perl
#!/usr/bin/perl
-# $Id: sync-accounts,v 1.
9 1999-01-03 01:56:57
ian Exp $
+# $Id: sync-accounts,v 1.
10 1999-01-03 02:16:49
ian Exp $
# usage: sync-accounts [-n] [-C<config-file>] [<host> ...]
# options:
# -n do not really do anything
# usage: sync-accounts [-n] [-C<config-file>] [<host> ...]
# options:
# -n do not really do anything
@@
-547,13
+547,9
@@
sub finish () {
close NF or die $!;
system "diff -U0 /etc/$file $newfile"; $?==256 or die $?;
if (!$no_act) {
close NF or die $!;
system "diff -U0 /etc/$file $newfile"; $?==256 or die $?;
if (!$no_act) {
- if ($file eq 'shadow') {
- system "chown root.shadow $newfile"; $? and die $?;
- chmod 0640, $newfile or die $!;
- } else {
- chown 0,0, $newfile or die $!;
- chmod 0644, $newfile or die $!;
- }
+ (@stats= stat $file) or die "$file: $!";
+ chown $stats[4],$stats[5], $newfile or die $!;
+ chmod $stats[2] & 07777, $newfile or die $!;
rename $newfile, "/etc/$file" or die $!;
}
}
rename $newfile, "/etc/$file" or die $!;
}
}