head	1.6;
access;
symbols
	perseant-exfatfs-base-20250801:1.6
	perseant-exfatfs-base-20240630:1.6
	cjep_sun2x:1.6.0.44
	cjep_sun2x-base:1.6
	cjep_staticlib_x-base1:1.6
	cjep_staticlib_x:1.6.0.42
	cjep_staticlib_x-base:1.6
	phil-wifi-20200421:1.6
	phil-wifi-20200411:1.6
	phil-wifi-20200406:1.6
	pgoyette-compat-merge-20190127:1.6
	pgoyette-compat-20190127:1.6
	pgoyette-compat-20190118:1.6
	pgoyette-compat-1226:1.6
	pgoyette-compat-1126:1.6
	pgoyette-compat-1020:1.6
	pgoyette-compat-0930:1.6
	pgoyette-compat-0906:1.6
	pgoyette-compat-0728:1.6
	pgoyette-compat-0625:1.6
	pgoyette-compat-0521:1.6
	pgoyette-compat-0502:1.6
	pgoyette-compat-0422:1.6
	pgoyette-compat-0415:1.6
	pgoyette-compat-0407:1.6
	pgoyette-compat-0330:1.6
	pgoyette-compat-0322:1.6
	pgoyette-compat-0315:1.6
	pgoyette-compat:1.6.0.40
	pgoyette-compat-base:1.6
	perseant-stdc-iso10646:1.6.0.38
	perseant-stdc-iso10646-base:1.6
	prg-localcount2-base3:1.6
	prg-localcount2-base2:1.6
	prg-localcount2-base1:1.6
	prg-localcount2:1.6.0.36
	prg-localcount2-base:1.6
	pgoyette-localcount-20170426:1.6
	bouyer-socketcan-base1:1.6
	pgoyette-localcount-20170320:1.6
	bouyer-socketcan:1.6.0.34
	bouyer-socketcan-base:1.6
	pgoyette-localcount-20170107:1.6
	pgoyette-localcount-20161104:1.6
	localcount-20160914:1.6
	pgoyette-localcount-20160806:1.6
	pgoyette-localcount-20160726:1.6
	pgoyette-localcount:1.6.0.32
	pgoyette-localcount-base:1.6
	netbsd-5-2-3-RELEASE:1.6
	netbsd-5-1-5-RELEASE:1.6
	yamt-pagecache-base9:1.6
	yamt-pagecache-tag8:1.6
	tls-earlyentropy:1.6.0.28
	tls-earlyentropy-base:1.6
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.6
	riastradh-drm2-base3:1.6
	netbsd-5-2-2-RELEASE:1.6
	netbsd-5-1-4-RELEASE:1.6
	netbsd-5-2-1-RELEASE:1.6
	netbsd-5-1-3-RELEASE:1.6
	agc-symver:1.6.0.30
	agc-symver-base:1.6
	tls-maxphys-base:1.6
	yamt-pagecache-base8:1.6
	netbsd-5-2:1.6.0.26
	yamt-pagecache-base7:1.6
	netbsd-5-2-RELEASE:1.6
	netbsd-5-2-RC1:1.6
	yamt-pagecache-base6:1.6
	yamt-pagecache-base5:1.6
	yamt-pagecache-base4:1.6
	netbsd-5-1-2-RELEASE:1.6
	netbsd-5-1-1-RELEASE:1.6
	yamt-pagecache-base3:1.6
	yamt-pagecache-base2:1.6
	yamt-pagecache:1.6.0.24
	yamt-pagecache-base:1.6
	bouyer-quota2-nbase:1.6
	bouyer-quota2:1.6.0.22
	bouyer-quota2-base:1.6
	matt-nb5-pq3:1.6.0.20
	matt-nb5-pq3-base:1.6
	netbsd-5-1:1.6.0.18
	netbsd-5-1-RELEASE:1.6
	netbsd-5-1-RC4:1.6
	netbsd-5-1-RC3:1.6
	netbsd-5-1-RC2:1.6
	netbsd-5-1-RC1:1.6
	netbsd-5-0-2-RELEASE:1.6
	netbsd-5-0-1-RELEASE:1.6
	jym-xensuspend-nbase:1.6
	netbsd-5-0:1.6.0.16
	netbsd-5-0-RELEASE:1.6
	netbsd-5-0-RC4:1.6
	netbsd-5-0-RC3:1.6
	netbsd-5-0-RC2:1.6
	jym-xensuspend:1.6.0.14
	jym-xensuspend-base:1.6
	netbsd-5-0-RC1:1.6
	netbsd-5:1.6.0.12
	netbsd-5-base:1.6
	yamt-pf42-base4:1.6
	yamt-pf42-base3:1.6
	hpcarm-cleanup-nbase:1.6
	yamt-pf42-base2:1.6
	yamt-pf42:1.6.0.10
	yamt-pf42-base:1.6
	mjf-devfs2:1.6.0.8
	mjf-devfs2-base:1.6
	keiichi-mipv6-nbase:1.6
	keiichi-mipv6:1.6.0.6
	keiichi-mipv6-base:1.6
	cube-autoconf:1.6.0.4
	cube-autoconf-base:1.6
	hpcarm-cleanup:1.6.0.2
	hpcarm-cleanup-base:1.6
	netbsd-3-1-1-RELEASE:1.5
	netbsd-3-0-3-RELEASE:1.5
	netbsd-3-1:1.5.0.6
	netbsd-3-1-RELEASE:1.5
	netbsd-3-0-2-RELEASE:1.5
	netbsd-3-1-RC4:1.5
	netbsd-3-1-RC3:1.5
	netbsd-3-1-RC2:1.5
	netbsd-3-1-RC1:1.5
	netbsd-3-0-1-RELEASE:1.5
	netbsd-3-0:1.5.0.4
	netbsd-3-0-RELEASE:1.5
	netbsd-3-0-RC6:1.5
	netbsd-3-0-RC5:1.5
	netbsd-3-0-RC4:1.5
	netbsd-3-0-RC3:1.5
	netbsd-3-0-RC2:1.5
	netbsd-3-0-RC1:1.5
	netbsd-2-0-3-RELEASE:1.3
	netbsd-2-1:1.3.0.6
	netbsd-2-1-RELEASE:1.3
	netbsd-2-1-RC6:1.3
	netbsd-2-1-RC5:1.3
	netbsd-2-1-RC4:1.3
	netbsd-2-1-RC3:1.3
	netbsd-2-1-RC2:1.3
	netbsd-2-1-RC1:1.3
	netbsd-2-0-2-RELEASE:1.3
	netbsd-3:1.5.0.2
	netbsd-3-base:1.5
	netbsd-2-0-1-RELEASE:1.3
	netbsd-2:1.3.0.4
	netbsd-2-base:1.3
	netbsd-2-0-RELEASE:1.3
	netbsd-2-0-RC5:1.3
	netbsd-2-0-RC4:1.3
	netbsd-2-0-RC3:1.3
	netbsd-2-0-RC2:1.3
	netbsd-2-0-RC1:1.3
	netbsd-2-0:1.3.0.2
	netbsd-2-0-base:1.3
	netbsd-1-6-PATCH002-RELEASE:1.2
	netbsd-1-6-PATCH002:1.2
	netbsd-1-6-PATCH002-RC4:1.2
	netbsd-1-6-PATCH002-RC3:1.2
	netbsd-1-6-PATCH002-RC2:1.2
	netbsd-1-6-PATCH002-RC1:1.2
	netbsd-1-6-PATCH001:1.2
	netbsd-1-6-PATCH001-RELEASE:1.2
	netbsd-1-6-PATCH001-RC3:1.2
	netbsd-1-6-PATCH001-RC2:1.2
	netbsd-1-6-PATCH001-RC1:1.2
	fvdl_fs64_base:1.2
	netbsd-1-6-RELEASE:1.2
	netbsd-1-6-RC3:1.2
	netbsd-1-6-RC2:1.2
	netbsd-1-6-RC1:1.2
	netbsd-1-6:1.2.0.2
	netbsd-1-6-base:1.2;
locks; strict;
comment	@# @;


1.6
date	2006.02.08.00.47.33;	author christos;	state dead;
branches;
next	1.5;

1.5
date	2005.01.18.18.12.55;	author peter;	state Exp;
branches;
next	1.4;

1.4
date	2005.01.11.22.16.24;	author peter;	state Exp;
branches;
next	1.3;

1.3
date	2004.03.09.21.36.37;	author garbled;	state Exp;
branches;
next	1.2;

1.2
date	2001.01.06.07.31.03;	author garbled;	state Exp;
branches;
next	1.1;

1.1
date	2001.01.05.02.06.59;	author garbled;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Bye bye sushi config files (moved to othersrc via repository copy)
@
text
@#!/bin/sh
# $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/'`

BACKUPDIR="/var/sushi"
CONFFILE="/etc/rc.conf"
BACKUP="${BACKUPDIR}/rc.conf"

echo "Saving changes..."

if [ ! -d $BACKUPDIR ]; then
	mkdir $BACKUPDIR
	chown root:wheel $BACKUPDIR
	chmod 700 $BACKUPDIR
fi

# 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
cp -p $BACKUP $BACKUP.old

. /etc/defaults/rc.conf
. $CONFFILE

a=1
for i in $BIGLIST
do
	new=$(echo `eval echo \\$${a}` | sed -e 's/ $//')
	old=`eval echo \\$${i}`
	if [ "$new" != "$old" ]; then
		line=`grep -n "^${i}=" $BACKUP | cut -f1 -d:`
		# 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
				echo "$i=\"$new\"" >> $BACKUP.new
			fi
		else
			sed "${line}s/$old/$new/" < $BACKUP.old > $BACKUP.new
			if [ $? -ne 0 ]; then
				echo "sed failed"
				rm -f $BACKUP.new $BACKUP.old
				exit 1
			fi
		fi
		cp -p $BACKUP.new $BACKUP.old
	fi
	a=`expr $a + 1`
done

cp -p $BACKUP.new $CONFFILE

if [ $? -eq 0 ]; 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

exit 0
@


1.5
log
@Minor cleanup and tweaks, be consistent with the other system admin scripts.
@
text
@d2 1
a2 1
# $NetBSD: script,v 1.4 2005/01/11 22:16:24 peter Exp $
@


1.4
log
@Only try to change/update the settings listed in the form.
This stops sushi from mangling rc.conf when the form becomes out-of-sync
with /etc/defaults/rc.conf.

Reviewed by garbled.
@
text
@d2 1
a2 1
# $NetBSD: script,v 1.3 2004/03/09 21:36:37 garbled Exp $
d67 1
a67 1
	echo "Failed"
@


1.3
log
@Apply patches in PR bin/24645 by Peter Postma:
	Here are some enhancements to sushi's System Maintenance menu.
	To summarize the changes:

	* Make a backup of the file before modifying it.
	* Fixes to get all menus/forms working.
	* Missing/invalid settings (like in rc.conf and inetd.conf)
	  have been added/removed.
	* Most files don't get overwritten now but are edited instead.
	  So specials settings in e.g. /etc/rc.conf don't get lost now.
	* Some help menu fixes. ($NetBSD$ tag has been removed because I
	  don't see how it would be useful for either user or developer).
@
text
@d2 4
a5 1
# $NetBSD: script,v 1.2 2001/01/06 07:31:03 garbled Exp $
d19 1
a19 1
# backup
d21 4
d34 1
a34 1
for i in `/usr/share/sushi/system/rcconf/script3`
d39 3
a41 3
		line=`grep -n $i $BACKUP | cut -f1 -d:`
		# if no line, add new entry, otherwise edit the entry.
		if [ -z $line ]; then
d64 1
a64 1
	echo ""
@


1.2
log
@Fix some stupidity in here.  There seem to be some definate problems with
this script, that didn't exist before..  It's going to take some doing to
figure them out..
@
text
@d2 21
a22 1
# $NetBSD: script,v 1.1 2001/01/05 02:06:59 garbled Exp $
d24 2
a25 7
CONFFILE="/etc/rc.conf"
echo -n "#Generated by sushi on " >$CONFFILE
date >>$CONFFILE
echo "if [ -r /etc/defaults/rc.conf ]; then" >>$CONFFILE
echo "	. /etc/defaults/rc.conf" >>$CONFFILE
echo "fi" >>$CONFFILE
echo "rc_configured=YES" >>$CONFFILE
a26 2
IFS="
"
d29 11
a39 4
	ANS=$(echo `eval echo \\$${a}` | sed -e 's/ $//')
	if [ "$ANS" != "`eval echo \\$${i}`" ]; then
		if [ "$ANS" = "YES" -o "$ANS" = "NO" ]; then
			echo "$i=$ANS" >>$CONFFILE
d41 6
a46 1
			echo "$i=\"$ANS\"" >>$CONFFILE
d48 1
d52 14
a65 2
echo "successfully wrote a new $CONFFILE"
cat $CONFFILE
@


1.1
log
@Add all the help menus, and working menu items I currently have for sushi.

Note, these directories are missing Makefiles..  I know that.. and I'm
working on it.
@
text
@d2 2
a3 2
# $NetBSD$
. /etc/default/rc.conf
d5 1
a5 1
echo -n "#Generated by smit on " >$CONFFILE
d7 2
a8 2
echo "if [ -r /etc/default/rc.conf ]; then" >>$CONFFILE
echo "	. /etc/default/rc.conf" >>$CONFFILE
d14 1
a14 1
for i in `smitty/system/rcconf/script3`
@

