Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / release / picobsd / mfs_tree / stand / update
1 #!/bin/sh
2 # $FreeBSD: src/release/picobsd/mfs_tree/stand/update,v 1.2.2.3 2002/03/13 18:15:52 luigi Exp $
3 # $DragonFly: src/release/picobsd/mfs_tree/stand/Attic/update,v 1.2 2003/06/17 04:27:20 dillon Exp $
4 # script to edit and save some config file(s).
5 # If called with no arguments, it edits 3 files in /etc
6 thefiles=$*
7 [ -z "$thefiles" ] && \
8     thefiles="/etc/rc.conf /etc/rc.firewall /etc/master.passwd"
9 dev=`sysctl -n machdep.guessed_bootdev`
10 [ -c "${dev}" ] || dev="/dev/fd0"
11 mount ${dev} /mnt
12 if [ "$?" != "0" ] ; then
13         echo ""
14         echo "Cannot mount ${dev} read-write!"
15         exit 1
16 fi
17
18 echo "Updating ${thefiles} on ${dev}: "
19
20 for f in ${thefiles} ; do
21     case $f in
22     /etc )
23         echo  "Update all files in $f :"
24         srcs=`ls $f`
25         for i in $srcs ; do
26             if [ -f /mnt${f}/${i}.gz ]; then
27                 echo -n "$i ..."
28                 gzip < $f/$i > /mnt${f}/${i}.gz
29             fi
30         done
31         echo " Done."
32         ;;
33
34     passwd|master.passwd)
35         mkdir -p /mnt/etc
36         ee /etc/master.passwd
37         pwd_mkdb /etc/master.passwd
38         gzip < /etc/master.passwd > /mnt/etc/master.passwd.gz
39         ;;
40
41     /*) # only absolute pathnames are ok
42         mkdir -p /mnt/etc /mnt/root
43         [ -f $f ] && ee $f && gzip < $f > /mnt${f}.gz
44         ;;
45
46     *)
47         echo "File $f not recognised, you must use an absolute pathname."
48         ;;
49     esac
50 done
51 umount /mnt