Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jun 2002 04:02:41 +0900
From:      Hiroharu Tamaru <tamaru@myn.rcast.u-tokyo.ac.jp>
To:        freebsd-arch@FreeBSD.ORG
Subject:   Re: Configuration management
Message-ID:  <sa6sn3j5bxq.wl@amulet.ht.myn.rcast.u-tokyo.ac.jp>
In-Reply-To: <20020619031533.2c302e68.makonnen@pacbell.net>
References:  <20020619031533.2c302e68.makonnen@pacbell.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Multipart_Thu_Jun_20_04:02:41_2002-1
Content-Type: text/plain; charset=US-ASCII

Hi,

At Wed, 19 Jun 2002 03:15:33 -0700,
Mike Makonnen wrote:

> I am of a different opinion. I happen to like plain-text configuration files.
> The problem is not that we need an easier way to _edit_ the files,
> but rather we need a better way to manage all those files and the changes
> we make to them. For example, I have a haphazard collection of rcs files

I totally agree.  In fact I have been using cvs for this
task since FreeBSD 2.2.x days.  I track -stable every
several months.  As the buildworld Makefiles evolve, things
has become easier, and never harder.  I am not using
mergemaster at all in the process (no offense here too; I
just adopted a way without it before it appeared).
I have always found the "cvs diff" abilty invaluable. 

For what it's worth, I will attach my helper scripts (mainly
for bootstraping the repository on a newly installed
machine) to give you an idea.  It's not fully automated nor
complete nor clean, but has served me quite well for a long
time.  These is no script for automating updates; I type
them manually following my memo:


# cvsup the source, then

cd /usr/src
make -j4 buildworld < /dev/null >& build.2001.02.02 &
make -j4 buildkernel < /dev/null >& kernel.2001.02.02 &

cd /w/4src
rm -rf config
mkdir config
cd /usr/src/etc
make distrib-dirs distribution DESTDIR=/w/4src/config

cd /w/4src/config
/w/4src/tools/clean-etc-distrib-check | less
/w/4src/tools/clean-etc-distrib

cvs -d /var/cvs import -m "import after cvsup" config FreeBSD_core RELENG_4_20010202

suspend

cd ~
mkdir cvstmp
chmod go-rwx cvstmp
cd cvstmp
cvs -d /var/cvs co -jFreeBSD_core:yesterday -jFreeBSD_core config

....

cd ~/cvstmp/config/
cvs diff -u

cvs commit -m "merged after cvsup" 

fg

cd /usr/src
make installworld < /dev/null >& install.2001.02.02 &
make installkernel < /dev/null >>& install.2001.02.02 &
cd /
cvs update

cd /dev
./MAKEDEV all

shutdown -r +1





Oh, by the way, on my machines, the following links exist:
/usr/src -> /w/4src/src
/usr/obj -> /w/4src/i386 or /w/4src/alpha 
and I have
/w/4src/config as the teporary install space for /etc stuff
and
/w/4src/tools for the scripts I have.

/w is nfs mounted all around the place and the clients
simple use what the build machine has built here.

The repository is at /var/cvs with the module name "config"

The clean-etc-distrib stuff was mainly for the very old days
when "make distribution" installed binary programs in
/w/4src/config/ . I was too lazy to update my scripts.

-- 
Hiroharu Tamaru


--Multipart_Thu_Jun_20_04:02:41_2002-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="bootstrap-etc-cvs"
Content-Transfer-Encoding: 7bit

#!/bin/sh

ERR=0

if [ ! -d /w/4src/config/etc -o -e /w/4src/config/dev/null ]; then
  cat <<EOF
Before using this script kit, you need some tweeking:
1) install all "src" distributions from sysinstall
2) mkdir /w/4src/config
3) change dir to /usr/src/etc and execute
   make distrib-dirs distribution DESTDIR=/w/4src/config
4) change dir to /w/4src/config and execute
   ../tools/clean-etc-distrib-check | less
   then
   ../tools/clean-etc-distrib
EOF
  exit
fi

if [ ! -d /var/cvs ]; then
  if [ -e /var/cvs ]; then
    echo "/var/cvs is not a directory"
    ERR=1
  else
    echo "creating /var/cvs/"
    mkdir /var/cvs || ERR=1
  fi
fi

echo "chown root:wheel /var/cvs/."
chown root:wheel /var/cvs/. || ERR=1
echo "chmod -R 770 /var/cvs/."
chmod -R 770 /var/cvs/. || ERR=1
echo "cvs -d /var/cvs init"
echo "=================================================================="
cvs -d /var/cvs init || ERR=1
echo "=================================================================="

if [ $ERR = 1 ]; then
  exit
fi

echo "changing dir to /w/4src/config"
cd /w/4src/config
echo "=================================================================="
cvs -d /var/cvs import -m "installed" config FreeBSD_core INSTALLED
echo "=================================================================="

DIR="/tmp/etccvs.$$"

echo "mkdir $DIR"
mkdir $DIR || exit

echo "changing dir to $DIR"
cd $DIR || exit
echo "=================================================================="
cvs -d /var/cvs checkout config
echo "=================================================================="
cd config || exit

echo "creating list of CVS controlled files at $DIR/files.list"

find . \( -type d -name CVS -prune \) -o \( -type f -print \) \
  | grep -v "root/distribution.files" \
  | grep -v "root/mtree.modes" > ../files.list
filelist=`cat ../files.list`

echo "copying all CVS controlled files for / to  $DIR/config/"
echo "diffs are available at $DIR/files.diff"

for i in ${filelist}; do
  diff -u $i /$i >> ../files.diff
  cp /$i $i
done

echo "change dir to $DIR/config/etc"
cd etc
echo "rm passwd master.passwd pwd.db spwd.db"
rm passwd master.passwd pwd.db spwd.db
echo "cvs remove passwd master.passwd pwd.db spwd.db"
cvs remove passwd master.passwd pwd.db spwd.db

echo ""
echo "Invoking /bin/csh"
echo "You can check up using cvs commands now."
echo "Exit this shell to continue."
echo "Commit will follow exit and then $DIR will be removed."

csh

cd $DIR/config

echo "=================================================================="
cvs commit -m "newly installed"
echo "=================================================================="

rm -rf $DIR || exit
mkdir $DIR || exit
cd $DIR || exit
echo "=================================================================="
cvs -d /var/cvs checkout config
echo "=================================================================="
cd config || exit
cp -RPpv . /
rm -rf $DIR || exit

echo "everything is copyed to /"
echo "try cvs update at / and also run 'recover.modes'"


--Multipart_Thu_Jun_20_04:02:41_2002-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="clean-etc-distrib-check"
Content-Transfer-Encoding: 7bit

#!/bin/sh -
rm -f ./root/distribution.files
find . -ls \
 | awk '{if ($7~/,/){print $3,$4,$5,$6,$7$8,$12}else if($12~/-/){print $3,$4,$5,$6,$7,$11,$12,$13}else{print $3,$4,$5,$6,$7,$11}}' \
 | sort +5 > ./root/distribution.files

echo "===== differences in distribution files"
diff -u0 /root/distribution.files ./root/distribution.files

echo "===== everything but files and dirs"
find . \! \( -type d -o -type f \) | xargs ls -dl

echo "===== empty files"
find . -type f -size 0 | xargs ls -dl

echo "===== executable binaries"
find . -type f -perm -100 | xargs file | grep 'executable$' | grep -v ' text '


--Multipart_Thu_Jun_20_04:02:41_2002-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="clean-etc-distrib"
Content-Transfer-Encoding: 7bit

#!/bin/sh -
echo "===== generate ./root/distribution.files"
rm -f ./root/distribution.files
find . -ls \
 | awk '{if ($7~/,/){print $3,$4,$5,$6,$7$8,$12}else if($12~/-/){print $3,$4,$5,$6,$7,$11,$12,$13}else{print $3,$4,$5,$6,$7,$11}}' \
 | sort +5 > ./root/distribution.files

echo "===== remove everything but files and dirs"
find . \! \( -type d -o -type f \) | xargs rm -f

echo "===== remove empty files"
find . -type f -size 0 | xargs rm -f

echo "===== remove executable binaries"
find . -type f -perm -100 | xargs file | grep 'executable$' | grep -v ' text '\
 | sed 's/:[^:]*$//' | xargs rm -f

echo "===== remove empty directories .. don't bother about the errors!"
find . -type d | sort -r | xargs rmdir

echo "===== generate ./root/mtree.modes"
mtree -c -kuid,gid,mode > ./root/mtree.modes

echo "===== done"


--Multipart_Thu_Jun_20_04:02:41_2002-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="recover.modes"
Content-Transfer-Encoding: 7bit

#!/bin/sh -
# execute this from root directory, or where ever you want it to root at.
cd /
mtree -U -e -f ./root/mtree.modes
#

--Multipart_Thu_Jun_20_04:02:41_2002-1--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?sa6sn3j5bxq.wl>