Minor cleanup and tweaks, be consistent with the other system admin scripts.
This commit is contained in:
parent
3fafe1c29d
commit
3833bb8f30
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/daily.conf"
|
||||
|
@ -13,8 +13,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# temporary files
|
||||
cp -p $BACKUP $BACKUP.new
|
||||
|
@ -30,8 +34,8 @@ do
|
|||
old=`eval echo \\$${i}`
|
||||
if [ "$new" != "$old" ]; then
|
||||
line=`grep -n $i $BACKUP | cut -f1 -d:`
|
||||
# if no line, add new entry, otherwise edit the entry.
|
||||
if [ -z $line ]; then
|
||||
# if no such line, add a new entry, otherwise edit the entry.
|
||||
if [ -z "$line" ]; then
|
||||
if [ "$new" = "YES" -o "$new" = "NO" ]; then
|
||||
echo "$i=$new" >> $BACKUP.new
|
||||
else
|
||||
|
@ -57,7 +61,7 @@ if [ $? -eq 0 ]; then
|
|||
echo ""
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.3 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.4 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BIGLIST=`grep script /usr/share/sushi/system/inetdconf/form | \
|
||||
cut -f2,3 -d, | awk '{print $1}'`
|
||||
cut -f2,3 -d, | awk '{print $1}'`
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
INETDCONF="/etc/inetd.conf"
|
||||
|
@ -14,8 +14,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $INETDCONF $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# temporary files
|
||||
cp -p $BACKUP $BACKUP.new
|
||||
|
@ -73,7 +77,7 @@ cp -p $BACKUP.new $INETDCONF
|
|||
if [ $? -eq 0 ]; then
|
||||
echo "Successfully wrote a new $INETDCONF"
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
MAILERCONF="/etc/mailer.conf"
|
||||
|
@ -11,8 +11,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $MAILERCONF $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "sendmail" ]; then
|
||||
sendmail=0
|
||||
|
@ -25,7 +29,7 @@ if [ "$1" = "sendmail" ]; then
|
|||
fi
|
||||
|
||||
if [ $sendmail -eq 1 ]; then
|
||||
echo "Sendmail is already your default mailer"
|
||||
echo "Sendmail is already your default mailer."
|
||||
exit 0
|
||||
fi
|
||||
echo "sendmail /usr/libexec/sendmail/sendmail" >$MAILERCONF
|
||||
|
@ -51,7 +55,7 @@ if [ "$1" = "postfix" ]; then
|
|||
fi
|
||||
|
||||
if [ $postfix -eq 1 ]; then
|
||||
echo "Postfix is already your default mailer"
|
||||
echo "Postfix is already your default mailer."
|
||||
exit 0
|
||||
fi
|
||||
echo "sendmail /usr/libexec/postfix/sendmail" >$MAILERCONF
|
||||
|
@ -70,7 +74,7 @@ if [ "$1" = "exim" ]; then
|
|||
cp $LOCALBASE/etc/exim/mailer.conf.exim $MAILERCONF
|
||||
chown root:wheel $MAILERCONF
|
||||
chmod 644 $MAILERCONF
|
||||
echo "$PKGNM has now been made your default mailer"
|
||||
echo "$PKGNM has now been made your default mailer."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -80,7 +84,7 @@ if [ "$1" = "postfix-current" ]; then
|
|||
cp $LOCALBASE/etc/mailer.conf.postfix $MAILERCONF
|
||||
chown root:wheel $MAILERCONF
|
||||
chmod 644 $MAILERCONF
|
||||
echo "$PKGNM has now been made your default mailer"
|
||||
echo "$PKGNM has now been made your default mailer."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -90,6 +94,6 @@ if [ "$1" = "sendmail88" ]; then
|
|||
cp $LOCALBASE/etc/mailer.conf.sendmail $MAILERCONF
|
||||
chown root:wheel $MAILERCONF
|
||||
chmod 644 $MAILERCONF
|
||||
echo "$PKGNM has now been made your default mailer"
|
||||
echo "$PKGNM has now been made your default mailer."
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script1,v 1.3 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script1,v 1.4 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BIGLIST="exim postfix-current sendmail88"
|
||||
MAILERCONF="/etc/mailer.conf"
|
||||
|
@ -33,8 +33,7 @@ fi
|
|||
for i in $BIGLIST
|
||||
do
|
||||
pkg_info -e $i >/dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$i"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.4 2005/01/11 22:16:24 peter Exp $
|
||||
# $NetBSD: script,v 1.5 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BIGLIST=`grep -v ^# /usr/share/sushi/system/rcconf/form | \
|
||||
awk '{print $1}' | sed -e 's/.*\,\(.*\)/\1/'`
|
||||
|
@ -64,7 +64,7 @@ if [ $? -eq 0 ]; then
|
|||
echo
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/security.conf"
|
||||
|
@ -13,8 +13,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# temporary files
|
||||
cp -p $BACKUP $BACKUP.new
|
||||
|
@ -30,8 +34,8 @@ do
|
|||
old=`eval echo \\$${i}`
|
||||
if [ "$new" != "$old" ]; then
|
||||
line=`grep -n $i $BACKUP | cut -f1 -d:`
|
||||
# if no line, add new entry, otherwise edit the entry.
|
||||
if [ -z $line ]; then
|
||||
# if no such line, add a new entry, otherwise edit the entry.
|
||||
if [ -z "$line" ]; then
|
||||
if [ "$new" = "YES" -o "$new" = "NO" ]; then
|
||||
echo "$i=$new" >> $BACKUP.new
|
||||
else
|
||||
|
@ -57,7 +61,7 @@ if [ $? -eq 0 ]; then
|
|||
echo ""
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/ssh/sshd_config"
|
||||
|
@ -13,8 +13,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "yes" ]; then
|
||||
RESTART=yes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:55 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/sysctl.conf"
|
||||
|
@ -18,15 +18,19 @@ if [ "$3" = "boot" -o "$3" = "both" ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# temporary file
|
||||
cp -p $BACKUP $BACKUP.new
|
||||
|
||||
line=`grep -n $1 $BACKUP | cut -f1 -d:`
|
||||
# if no line, add new entry, otherwise edit the entry.
|
||||
if [ -z $line ]; then
|
||||
# if no such line, add a new entry, otherwise edit the entry.
|
||||
if [ -z "$line" ]; then
|
||||
echo "$1=$2" >> $BACKUP.new
|
||||
else
|
||||
sed "${line}s/.*/$1=$2/" < $BACKUP > $BACKUP.new
|
||||
|
@ -39,6 +43,8 @@ if [ "$3" = "boot" -o "$3" = "both" ]; then
|
|||
echo "Successfully wrote a new $CONFFILE"
|
||||
echo ""
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:56 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/usermgmt.conf"
|
||||
|
@ -19,8 +19,12 @@ if [ ! -f $CONFFILE ]; then
|
|||
chmod 644 $CONFFILE
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BIGLIST="group class base_dir skel_dir shell inactive expire preserve \
|
||||
password range"
|
||||
|
@ -48,7 +52,7 @@ if [ $? -eq 0 ]; then
|
|||
echo ""
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: script,v 1.2 2004/03/09 21:36:37 garbled Exp $
|
||||
# $NetBSD: script,v 1.3 2005/01/18 18:12:56 peter Exp $
|
||||
|
||||
BACKUPDIR="/var/sushi"
|
||||
CONFFILE="/etc/weekly.conf"
|
||||
|
@ -13,8 +13,12 @@ if [ ! -d $BACKUPDIR ]; then
|
|||
chmod 700 $BACKUPDIR
|
||||
fi
|
||||
|
||||
# backup
|
||||
# create a backup
|
||||
cp -p $CONFFILE $BACKUP
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't create a backup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# temporary files
|
||||
cp -p $BACKUP $BACKUP.new
|
||||
|
@ -30,8 +34,8 @@ do
|
|||
old=`eval echo \\$${i}`
|
||||
if [ "$new" != "$old" ]; then
|
||||
line=`grep -n $i $BACKUP | cut -f1 -d:`
|
||||
# if no line, add new entry, otherwise edit the entry.
|
||||
if [ -z $line ]; then
|
||||
# if no such line, add a new entry, otherwise edit the entry.
|
||||
if [ -z "$line" ]; then
|
||||
if [ "$new" = "YES" -o "$new" = "NO" ]; then
|
||||
echo "$i=$new" >> $BACKUP.new
|
||||
else
|
||||
|
@ -57,7 +61,7 @@ if [ $? -eq 0 ]; then
|
|||
echo ""
|
||||
cat $CONFFILE
|
||||
else
|
||||
echo "Failed"
|
||||
echo "Failed to write a new $CONFFILE"
|
||||
fi
|
||||
|
||||
rm -f $BACKUP.new $BACKUP.old
|
||||
|
|
Loading…
Reference in New Issue