diff options
author | ivan <ivan> | 2006-10-09 01:05:27 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-10-09 01:05:27 +0000 |
commit | 5ca0a811040aa6037b8423571236705df4bd3db1 (patch) | |
tree | 82b0754849be748caacc9f4eddc1c1790a22678d /FS/bin/freeside-adduser | |
parent | 9186ed8ab4b2b25e91efe6d0dcabeaef191a2709 (diff) |
update the tools for dev installs
Diffstat (limited to 'FS/bin/freeside-adduser')
-rw-r--r-- | FS/bin/freeside-adduser | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/FS/bin/freeside-adduser b/FS/bin/freeside-adduser index 8f9d4a33f..a315f1082 100644 --- a/FS/bin/freeside-adduser +++ b/FS/bin/freeside-adduser @@ -22,11 +22,22 @@ if ( $opt_s ) { # close MAPSECRETS; #} - open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets") + #insert new entry before a wildcard... + open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets") and flock(MAPSECRETS,LOCK_EX) or die "can't open $FREESIDE_CONF/mapsecrets: $!"; - print MAPSECRETS "$user $opt_s\n"; + open(NEW,">$FREESIDE_CONF/mapsecrets.new") + or die "can't open $FREESIDE_CONF/mapsecrets.new: $!"; + while(<MAPSECRETS>) { + if ( /^\*\s/ ) { + print NEW "$user $opt_s\n"; + } + print NEW $_; + } close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!"; + close NEW or die "can't close $FREESIDE_CONF/mapsecrets.new: $!"; + rename("$FREESIDE_CONF/mapsecrets.new", "$FREESIDE_CONF/mapsecrets") + or die "can't move mapsecrets.new into place: $!"; } |