Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 1998 20:46:43 -0500
From:      "Scot W. Hetzel" <hetzels@westbend.net>
To:        "Jan B. Koum " <jkb@best.com>
Cc:        <stable@FreeBSD.ORG>
Subject:   Re: cvsup + make world shell script
Message-ID:  <004301bdd86f$0930bb40$c3e0d9cf@westbend.net>

next in thread | raw e-mail | index | archive | help
From: Jan B. Koum <jkb@best.com>
>
> Hello,
>
> Anyone has a script which would CVSup and then make world which
>they run every few days or so? If not, I'll write one. I was thinking of
>having it even fetch(1) cvsup binary if there isn't one already and then
>do CVSup based on uname -r and do some sanity checks...
>
Add to /etc/make.conf

SUP_UPDATE=     yes
SUP=            /usr/local/bin/cvsup
SUPFLAGS=       -g -L 2 -z
SUPFILE=        /etc/cvsupfile

Then Create the /etc/cvsupfile

*default  host=cvsup.freebsd.org
*default  base=/usr
*default  prefix=/usr
*default  release=cvs
*default  tag=RELENG_2_2
*default  delete use-rel-suffix

src-all
*default host=internate.freebsd.org    #Only needed if not cvsuping from the
US/Canada
src-crypto
src-secure
*default tag=.
ports-all
doc-all

Place the following script in the source directory (/usr/src):

#!/bin/sh

#
# clean_obj(): This Routine removes the schg flag and cleans the obj
directory
clean_obj() {
        chflags -R noschg /usr/obj
        rm -r /usr/obj/*
}

#
# make_update(): This routine uses the update target to run cvsup.
make_update() {
        make update
}

#
# patch(): This routine applies any user patches to the source tree.
patch() {
        if [ -d patches ]; then \
                ( cd patches ; make );
        fi
}

#
# make_world():
make_world() {
        make world -DNOGAMES 2>&1 | tee /var/tmp/mw.out
}

#
# make_buildworld():
make_buildworld() {
        make buildworld -DNOGAMES 2>&1 | tee /var/tmp/mw.out
}

#
# make_installworld():
make_installworld() {
        make installworld -DNOGAMES 2>&1 | tee /var/tmp/mw.out
}

#
# make_cf(): Create a new sendmail cf file.
make_cf() {
        SENDMAIL_CF=usr.sbin/sendmail/cf/cf
        ( cd ${SENDMAIL_CF} ; m4 ../m4/cf.m4 ${1}.mc > /etc/${1}.cf )
}

#
#make_kernel(): Creates a new kernel, but doesn't install it.  Also, if the
directories
# for the ETinc HDLC card are present, we append the appropriate device info
to
# the /sys/i386/conf/files.386 file.
make_kernel() {
        ( cd /sys/i386/conf ; \
        if [ -f /usr/hdlc/dev/files.i386 ] ; then \
                cp -rp files.i386 files.i386.orig ; \
                echo "" >> files.i386.orig ; \
                cat files.i386.orig /usr/hdlc/dev/files.i386 > files.i386 ;
\
        fi ; \
        config ${1} ; \
        cd ../../compile/${1} ; \
        make depend ; \
        make  )
}

#
#make_root(): Creates a dummy tree (/var/tmp/root), containing all of the
files
# that are different from the main tree (/)
make_root() {

#
#make_etc(): Backs up the current /etc, runs mtree to create the root, var,
and
# usr trees in the dummy root, and then creates the distribution in the
dummy root
make_etc() {
        ETC="/usr/src/etc"
        MTREE="mtree -deU -f"

        if [ -d /etc.old ] ; then
                rm -r /etc.old
        fi

        cp -rp /etc /etc.old

        if [ ! -d ${1} ] ; then
                mkdir ${1}
        fi

        ${MTREE} ${ETC}/mtree/BSD.root.dist -p ${1}
        ${MTREE} ${ETC}/mtree/BSD.var.dist -p ${1}/var
        ${MTREE} ${ETC}/mtree/BSD.usr.dist -p ${1}/usr

        ( cd ${ETC} ; \
        make DESTDIR=${1} distribution )
}

#
#check_files():  Compares files from the main tree to the dummy tree, and
removes
# any files that are the same from the dummy tree.
check_files() {
        ORIG=/
        ( cd ${1} ; \
        for i in `find -d . -type f` ; \
        do \
                diff -s ${1}/${i} ${ORIG}${i} ; \
                TEST=$? ; \
                if [ ${TEST} = 0 ] ; then \
                        rm ${1}/${i} ; \
                fi ; \
        done )
}

#
#rm_empty_dir(): This routine removes empty directories from the dummy tree.
rm_empty_dir() {
        ( cd ${1}; find -d . -type d | /usr/bin/perl -lne \
        'opendir(D,$_);@f=readdir(D);rmdir if $#f = 1;closedir(D);' )
}

TARGET="/var/tmp/root"

make_etc ${TARGET}
check_files ${TARGET}
rm_empty_dir ${TARGET}
}

#
# main
#
clean_obj
make_update
patch
make_world
#make_buildworld
#make_installworld
make_cf loretta                #Change this to the name of your *.mc file
make_kernel LORETTA    #Change this to the name of your kernel config file
make_root


Scot


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?004301bdd86f$0930bb40$c3e0d9cf>