Hi 777,
On Tue, 22 Feb 2000 15:11:39 GMT, drwxrwxrwx wrote:
> >I scripted a framework which automates the following tasks (based on
> >3.3 STABLE):
> >- synching the "src" tree (should be installed, otherwise will be
> > completely downloaded)
> >- synching the "crypto" tree (dito)
> >- synching the "doc" tree (english only)
> >- remake world
> >- remake and install kernel
> >Nothing very big, but maybe helpful for people who want to play safe.
> >Feel free to ask for it!
> >If the respective scripts are invoked by cron, you should not need to
> >care for them again.
> >Hope that helps,
> >Ulf
> post it if ya dont mind..
I dont, but it's a little work - and the tarball I made contains a lot
of additional documentation (the cvsup tutorial by Ben Fennema,
<bfenn...@galaxy.csc.calpoly.edu> and the cvsup FAQ by John D. Polstra
<cvsup-b...@polstra.com>) - look at
http://www.freebsd.org/handbook/synching.html#CVSUP
(this can/should be on your HDD, too!) or / and
http://www.polstra.com/projects/freeware/CVSup/
OK, here we go:
0) - First make sure you have the complete sources installed. In the
following they are assumed to be in "/usr/src". The first sync
might take a longer time, subsequent syncs take not too much time
- clickedy-click, ok, *my* last one was 10 min at a maximum rate
of 64 MBit/s, and I update once a week).
- Note that the documentation for 3.3 is installed in /usr/share/doc,
so you have to use two supfiles.
- Make sure your /var/log can bear about 15 MB of extra data -
otherwise you could log somewhere else or direct output to
/dev/null (IMO *not* a good idea, since you cannot trace down the
cause of errors if they appear).
1) Copy the following files into a directory of your choice (if you
*don't* use /etc/local/sbin, you *must* change the respective
paths:
-----------------------------------------------------------------------
#!/bin/sh
#
# /etc/local/sbin/rebuild_system
#
# calls a set of scripts for peacefully remaking
# everything in the background, complete logging
# is provided in /var/log/remake_*
#
echo "====== $(date) ====== rotate /var/log/remake_doc =========="
mv /var/log/remake_doc /var/log/last_remake_doc
echo "====== $(date) ====== call remake_doc ====================="
echo " "
/etc/local/sbin/remake_doc > /var/log/remake_doc 2>&1
echo "====== $(date) ====== rotate /var/log/remake_cvsup ========"
mv /var/log/remake_cvsup /var/log/last_remake_cvsup
echo "====== $(date) ====== call remake_cvsup ==================="
echo " "
/etc/local/sbin/remake_cvsup > /var/log/remake_cvsup 2>&1
echo "====== $(date) ====== rotate /var/log/remake_world ========"
mv /var/log/remake_world /var/log/last_remake_world
echo "====== $(date) ====== call remake_world ==================="
echo " "
/etc/local/sbin/remake_world > /var/log/remake_world 2>&1
echo "====== $(date) ====== rotate /var/log/remake_kernel ======="
mv /var/log/remake_kernel /var/log/last_remake_kernel
echo "====== $(date) ====== call remake_kernel =================="
echo " "
/etc/local/sbin/remake_kernel > /var/log/remake_kernel 2>&1
echo "====== $(date) ====== locate.updatedb (no logging) ========"
echo " "
/usr/libexec/locate.updatedb > /dev/null 2>&1
echo "====== $(date) ====== makewhatis ==== (no logging) ========"
echo " "
/usr/bin/makewhatis $manpath > /dev/null 2>&1
##################################################################
##### Start: This will *not* work on your system !!! #############
##################################################################
echo "====== $(date) ====== rotate /var/log/remake_daemons_stop ="
mv /var/log/remake_daemons_stop /var/log/last_remake_daemons_stop
echo "====== $(date) ====== call local_daemons stop ============="
echo " "
/etc/local/sbin/local_daemons stop > /var/log/remake_daemons_stop 2>&1
##################################################################
##### Stop: This will *not* work on your system !!! #############
##################################################################
echo "====== $(date) ====== done = complete logs in /var/log/ ==="
echo " "
-----------------------------------------------------------------------
#!/bin/sh
#
# /etc/local/sbin/remake_doc
#
# sync the documentation - english only
# please refer to /usr/sup/doc-all/refuse
# for details
echo "====== $(date) ====== updating sourcetree by cvs ======"
/usr/local/bin/cvsup -g -L 2 /etc/doc-supfile
echo "====== $(date) ====== done ============================"
-----------------------------------------------------------------------
#!/bin/sh
#
# /etc/local/sbin/remake_cvsup
# sync the source tree via cvsup
echo "====== $(date) ====== updating sourcetree by cvs ======"
/usr/local/bin/cvsup -g -L 2 /etc/stable-supfile
echo "====== $(date) ====== done ============================"
-----------------------------------------------------------------------
#!/bin/sh
#
# /etc/local/sbin/remake_world
#
# sic.
echo "====== $(date) ====== make a new world ==============="
cd /usr/src
make world
echo "====== $(date) ====== done ============================"
-----------------------------------------------------------------------
#!/bin/sh
#
# /etc/local/sbin/remake_kernel
#
# sic. the string "ULFBSD" should be
# changed to whatever you call your
# config.
echo "====== $(date) ====== make a new kernel ==============="
echo "====== $(date) ====== backup old kernel ==============="
cp /kernel /kernel.yesterday
echo "====== $(date) ====== cd /usr/src/sys/i386/conf/ ======"
cd /usr/src/sys/i386/conf/
echo "====== $(date) ====== config ULFBSD ==================="
config ULFBSD
echo "====== $(date) ====== cd /usr/src/sys/compile/ULFBSD =="
cd /usr/src/sys/compile/ULFBSD/
echo "====== $(date) ====== make depend ====================="
make depend
echo "====== $(date) ====== make ============================"
make
echo "====== $(date) ====== make install ===================="
make install
echo "====== $(date) ====== done ============================"
-----------------------------------------------------------------------
2) copy these files to /etc:
-----------------------------------------------------------------------
#
# /etc/stable-supfile
#
# tracks the 3.x STABLE sources.
#
# depending on from where you cvsup you should
# change the host and eventually the crypto settings
*default host=cvsup.de.freebsd.org
*default base=/usr
*default prefix=/usr
*default release=cvs
# The following line is for 3-stable. If you want 2.2-stable, change
# "RELENG_3" to "RELENG_2_2".
*default tag=RELENG_3
*default delete
*default use-rel-suffix
*default compress
## Main Source Tree.
#
# The easiest way to get the main source tree is to use the
# "src-all" mega-collection. It includes all of the individual "src-*"
# collections, except the export-restricted collections.
src-all
# The easiest way to get the export-restricted code is to use the
# "cvs-crypto" mega-collection.
cvs-crypto
# Have the ports collection synched? Yo man.
ports-all tag=.
-----------------------------------------------------------------------
#
# /etc/doc-supfile
#
# for restrictions, like *not* tracking
# russian documentation, refer to
#
# /usr/sup/doc-all/refuse
#
# personally I only track the english doc, so my
# refuse-file looks like:
#
# -----------
# doc/es* spanish
# doc/fr* french
# doc/ja* japanese
# doc/ru* russian
# doc/zh* thai
# -----------
*default host=cvsup.de.FreeBSD.org
*default base=/usr
*default prefix=/usr/share
*default release=cvs tag=.
*default delete use-rel-suffix
doc-all
-----------------------------------------------------------------------
3) copy the following lines into a file /usr/sup/doc-all/refuse :
-----------------------------------------------------------------------
doc/es*
doc/fr*
doc/ja*
doc/ru*
doc/zh*
-----------------------------------------------------------------------
4) add a line to your crontab where rebuild_system is called
(typically overnight, since the overall procedure takes quite a
while - on my 200 MHz PPro with 64 MB RAM about 2 1/2 hours and
working on the system is *no* fun then).
Example:
00 20 * * sat root \
/etc/local/sbin/rebuild_system | mail -s "system rebuild" root \
&& sleep 300 && shutdown -r now
Note that the rebuild_system calls a script "local_daemons" which
cleanly shuts down running processes like postgresql, innd, ...
But that is another story.
You should make sure that all processes which do not like being
killed are shut down cleanly.
That's it. Note that the scripts are useful in another manner too:
If you change your kernel config, you simply call remake_kernel
which does the work for you.
Or, another example: If you have a longer online session, you call
remake_doc, remake_cvsup and do the remake_world, remake_kernel later.
Hope that helps, Ulf