Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
#!/bin/sh | ||
|
||
perm() { | ||
# Keep same perms on file | ||
NEW="$1" | ||
OLD="$(dirname $NEW)/$(basename $NEW .new)" | ||
if [ -e $OLD ]; then | ||
cp -a $OLD $NEW.incoming | ||
cat $NEW > $NEW.incoming | ||
mv $NEW.incoming $NEW | ||
else | ||
chmod 0755 $NEW | ||
fi | ||
} | ||
|
||
config() { | ||
NEW="$1" | ||
OLD="$(dirname $NEW)/$(basename $NEW .new)" | ||
# If there's no config file by that name, mv it over: | ||
if [ ! -r $OLD ]; then | ||
mv $NEW $OLD | ||
mv $NEW $OLD | ||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then | ||
# toss the redundant copy | ||
rm $NEW | ||
# toss the redundant copy | ||
rm $NEW | ||
fi | ||
# Otherwise, we leave the .new copy for the admin to consider... | ||
} | ||
|
||
perm etc/rc.d/rc.arpwatch.new | ||
config etc/rc.d/rc.arpwatch.new | ||
|
||
perms() { | ||
# Keep same perms on file | ||
NEW="$1" | ||
OLD="$(dirname $NEW)/$(basename $NEW .new)" | ||
if [ -e $OLD ]; then | ||
cp -a $OLD $NEW.incoming | ||
cat $NEW > $NEW.incoming | ||
mv $NEW.incoming $NEW | ||
fi | ||
config $NEW | ||
} | ||
|
||
perms etc/rc.d/rc.arpwatch.new |
File renamed without changes.