Subject: Re: Some questions about CVS and keeping up-to-date
To: Gary Parker <G.J.Parker@lboro.ac.uk>
From: Asmodehn Shade <asmodehn@9online.fr>
List: netbsd-users
Date: 01/24/2005 12:53:21
--------------000108060702090302030900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

FYI, My own update script
Use it at your own risks ;p
But advises, and comments are welcome ;)

Regards,
--
Asmodehn

Gary Parker a écrit :

> 
>
>  
>
>>-----Original Message-----
>>From: netbsd-users-owner@NetBSD.org 
>>[mailto:netbsd-users-owner@NetBSD.org] On Behalf Of Robert Elz
>>Sent: 21 January 2005 12:03
>>To: Gary Parker
>>Cc: netbsd-users@NetBSD.org
>>Subject: Re: Some questions about CVS and keeping up-to-date
>>
>>You need to do a "build world" (ie: compile everything) at least once.
>>After that, when updates happen, you will normally be able to just
>>recompile what has changed (but for that, you have to keep all the .o
>>files hanging around).   That's likely to work well if you're just
>>tracking netbsd-2-0 (the 2.0.x versions) - and will probably work for
>>netbsd-2.   Occasionally however, changes happen in such a way that
>>the build system needs everything discarded and a rebuild 
>>from nothing.
>>They shouldn't, and really indicate bugs in the Makefiles, but they
>>do happen, sometimes.
>>
>>kre
>>    
>>
>
>Thanks Robert...all very helpful stuff...
>
>Gary
>
>  
>


--------------000108060702090302030900
Content-Type: text/plain; name=sysupdate
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="sysupdate"

#!/bin/sh
##############################################################################
# System Upgrade
# by Asmodehn 
# Modified 23 March 2004
# Automates source code / ports checkout & update & system rebuild for NetBSD
# from 2.0 release
##############################################################################

#TODO : return correct status after execution

#Setup:
# 1) CVS Option for Tracked Branch (comment it for current branch)
relCVS="-rnetbsd-2-0"
#pkgrelCVS="-rpkgsrc-2004Q4"
menu=1


prepareCVS()
{
export CVS_RSH=ssh
export CVSROOT="anoncvs@anoncvs.fr.NetBSD.org:/pub/NetBSD-CVS"
cd /usr
echo cvsroot : $CVSROOT
}
updatesrc()
{
prepareCVS
if [ -d /usr/src ]
then
cd /usr/src && cvs -q up $relCVS -PAd
else
cd /usr && cvs -q co $relCVS -PA src
fi
if [ $menu -eq 0 ] ;then mainmenu; fi
}
updatepkgsrc()
{
prepareCVS
# Comment out the next lines if you are not tracking pkgsrc:
if [ -d /usr/pkgsrc ]
then
cd /usr/pkgsrc && cvs -q up $pkgrelCVS -PAd
else
cd /usr && cvs -q co $pkgrelCVS -PA pkgsrc
fi

#comment the next 3 lines if you dont want to install the audit package
#dont forget to add it in your pkgchk.conf
echo "Updating the vulnerability list"
/usr/pkg/sbin/download-vulnerability-list

#comment the next 3 lines if you dont want installed packages to be check
echo "Checking if installed packes are older than the ones in pkgsrc..."
/usr/pkg/sbin/pkg_chk -c 
#the next line will automatically update installed package.
#/usr/pkg/sbin/pkg_chk -aku
#you can add -s or -b to force source or binary packages...
echo "Don't forget to update your config files!!!"

if [ $menu -eq 0 ] ;then mainmenu; fi
}
updatexsrc()
{
prepareCVS
# Comment out the next lines if you are not tracking xsrc:
if [ -d /usr/xsrc ]
then
cd /usr/xsrc && cvs -q up $relCVS -PAd
else
cd /usr && cvs -q co $relCVS -PA xsrc
fi
if [ $menu -eq 0 ] ;then mainmenu; fi
}
compilekernel()
{
KERNAME=$1
cd /usr/src/sys/arch/i386/conf/
while [ -z $KERNAME ] || [ ! -r $KERNAME ]
do
echo "No Config File found for this Kernel..."
echo " Type the name of the Kernel to Build or [Ctrl-C] to exit : "
read KERNAME 
done
cd /usr/src && ./build.sh -N 1 tools
#
#Old Kernel compil, for release < 2.0
#if [ ! -z $KERNAME ] && [ -r $KERNAME ]
#then
#echo Compiling Kernel : $KERNAME
#/usr/sbin/config $KERNAME && \
#cd /usr/src/sys/arch/i386/compile/$KERNAME && \
#make clean && \
#make depend && \
#make
#else
#echo "No Config File found for this Kernel. Exiting..."
#fi
#
cd /usr/src && ./build.sh -N 1 kernel=$KERNAME
if [ $menu -eq 0 ] ;then mainmenu; fi
}
compileuserland()
{
cd /usr/src
if [ -d /usr/xsrc ]
then
./build.sh -x -N 1 distribution
else
./build.sh -N 1 distribution
fi
echo "Userland build Done. Going on installation..."
echo "Take care of the instructions in the ouput!"
./build.sh -N 1 install=/; echo "Press Enter to continue..." ; read
if [ $menu -eq 0 ] ;then mainmenu; fi
}
changekernel()
{
KERNAME=$1
cd /usr/src/sys/arch/i386/conf
while [ -z $KERNAME ] || [ ! -r $KERNAME ]
do
echo "No Config File found for this Kernel..."
echo " Type the name of the Kernel to Install or [Ctrl-C] to exit : "
read KERNAME 
done
if [ -d /usr/src/sys/arch/i386/compile/obj/$KERNAME ]
then
cd /usr/src/sys/arch/i386/compile/obj/$KERNAME && \
make install && \
shutdown -r now
else
echo "No Kernel $KERNAME found. Exiting..."
if [ $menu -eq 0 ] ;then mainmenu; fi
fi
}
mergeetc()
{
if [ -e /usr/sbin/etcupdate ]
then
/usr/sbin/etcupdate -al -s /usr/src/etc
else
echo " etcupdate : Not found."
fi
if [ $menu -eq 0 ] ;then mainmenu; fi
}
mainmenu()
{
menu=0
echo "System update, NetBSD 2.X - current"
if [ -z $relCVS ] 
then
echo " CVS Branch : current"
else
echo " CVS Branch : $relCVS"
fi
echo ""
echo " Please choose an option:"
echo ""
#Detection pour savoir si les sources sont deja presentes
if [ -d /usr/src ]
then
echo " 1) Update src"
else
echo " 1) Get src"
fi
if [ -d /usr/pkgsrc ]
then
echo " 2) Update pkgsrc"
else
echo " 2) Get pkgsrc"
fi
if [ -d /usr/xsrc ]
then
echo " 3) Update xsrc"
else
echo " 3) Get xsrc"
fi
echo " 4) Compile Kernel"
echo " 5) Replace Kernel & Reboot"
echo " 6) Compile Userland"
echo " 7) Merge new /etc files"
echo " 0) Exit"
echo ""
echo -n " Option (0-7): "
read UPDT
case $UPDT in
1) updatesrc;;
2) updatepkgsrc;;
3) updatexsrc;;
4) compilekernel;;
5) changekernel;;
6) compileuserland;;
7) mergeetc;;
0) exit 0;;
*) echo "" && echo "Please enter a number between zero and seven."
echo -n "Press enter to continue." && read WT && mainmenu;;
esac
}
#main body
if [ $# -eq 0 ]
then
mainmenu
fi
case $1 in
src) updatesrc;;
pkgsrc) updatepkgsrc;;
xsrc) updatexsrc;;
kernel) compilekernel $2;;
userland) compileuserland;;
newkernel) changekernel $2;;
merge) mergeetc;;
*) echo "Usage:"
echo "sysupdate [src|pkgsrc|xsrc|kernel|newkernel|userland|merge]"
echo ""
echo "src - update /usr/src/ via cvs"
echo "pkgsrc - update /usr/pkgsrc/ via cvs"
echo "xsrc - update /usr/xsrc/ via cvs"
echo "kernel - build a new kernel"
echo "newkernel - install a previously built kernel"
echo "userland - build and install userland from source"
echo "merge - update /etc with new config files"
echo ""
echo "no options - opens selection menu"
echo "";;
esac
exit 2


--------------000108060702090302030900
Content-Type: text/plain; x-avg=cert; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Description: "AVG certification"

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005

--------------000108060702090302030900--