#! /bin/sh # upgrade a libc5 (bo) machine to libc6 (hamm). # The cd version of this script is designed to be located in a top # level directory of the Official Debian 2.0 CD. It may be run from # anywhere (with appropriate pathname) without requiring any input # from the user except as required by dpkg installation scripts. # $Id: cd_autoup.sh,v 1.0 1998/09/05 14:59:03 bob Exp bob $ # # derived from Craig Sanders' autoup.sh script # Original Author: Craig Sanders # and many others. see changelog for details. # Modified for use on the Official CD by Bob Hilliard # # Copyright Status: This script is hereby placed in the public domain # # Revision History: # see autoup.changelog # 0.1 - 1988-06-29 02:53:18 # - removed all ftp and most interactive stuff # # 0.2 - 1998/07/01 02:10:39 # - Commented out debugging statments; typo in final message # # 0.3 - 1998/07/01 03:37:27 # - minor changes in messages # 0.4 - 1998/07/01 19:40 # - added note about running from CD # 0.5 - 1998/07/01 21:46:13 # - updated changelog, minor changes in text # 0.6 - 1998/08/20 19:47:05 # - libstdc++2.8 has moved from libs/ to base/ # - libnet-perl has moved from interpreters/ to base/ # - fixed PKGS_NET problem (should have been $PKGS_NETBASE and # $PKGS_NETSTD) # - changed "^ii" search pattern to "^.i" when searching for installed -dev # pkgs # - Added message about upgrading to bo version of dpkg. # - changed definition of DM so script may be called from any directory # 0.7 - 1988/08/20 22:30 # - Changed note about running from CD # 0.8 - 1988/08/21 21:08 # - fixed uncommented comment, added comment on packages on hold # 0.9 - 1988/08/26 09:18 # - Changed DPKG_ARGS to DPKG_ARGS="-iBE --force-overwrite --force-hold" # - Removed note about testing for packages on hold # 1.0 - 1998/09/05 10:50 # - Commented out rev 0.9 description # misc tweakable variables DPKG="$(which dpkg)" LDCONFIG=$(which ldconfig) # uncomment for debugging # set -x # DPKG="echo dpkg" # LDCONFIG="echo ldconfig" DPKG_ARGS="-iBE --force-overwrite --force-hold" DATE=$(date +%m%d-%T) ARCH="binary-$(dpkg --print-installation-architecture)" # package variables PKGS_LDSO="base/ldso_*.deb" PKGS_LIBC5="oldlibs/libc5_*.deb" PKGS_LIBC6="base/libc6_*.deb base/timezones_*.deb admin/locales_*.deb" PKGS_NCURSES="oldlibs/ncurses3.0_*.deb base/ncurses3.4_*.deb" PKGS_LIBRL="oldlibs/libreadline2_*.deb" PKGS_LIBRLG="base/libreadlineg2_*.deb" PKGS_BASH="base/bash_*.deb" PKGS_LIBGPP="oldlibs/libg++27_*.deb libs/libg++272_*.deb \ base/libstdc++2.8_*.deb" PKGS_DPKG="base/dpkg_*.deb utils/dpkg-dev_*.deb" PKGS_SLANG="oldlibs/slang0.99.34_*.deb base/slang0.99.38_*.deb" PKGS_LIBGDBM="oldlibs/libgdbm1_*.deb base/libgdbmg1_*.deb" PKGS_PERLBASE="base/perl-base_*.deb" PKGS_PERL="interpreters/perl_*.deb" PKGS_MOREDPKG="interpreters/data-dumper_*.deb base/libnet-perl_*.deb \ base/dpkg-ftp_*.deb admin/dpkg-mountable_*.deb" PKGS_NETBASE="net/netbase_*.deb" PKGS_NETSTD="net/netstd_*.deb" ALLPKGS="$PKGS_LDSO $PKGS_LIBC5 $PKGS_LIBC6 $PKGS_NCURSES $PKGS_LIBRL $PKGS_LIBRLG $PKGS_BASH $PKGS_LIBGPP $PKGS_DPKG $PKGS_SLANG $PKGS_LIBGDBM $PKGS_PERLBASE $PKGS_PERL $PKGS_MOREDPKG $PKGS_NETBASE $PKGS_NETSTD" DM=`dirname $0`/../debian/hamm/hamm/$ARCH SEDSCRIPT="s:\([^ /]*/\):$DM/\1:g" # convert PKGS_ variables to correct directory location PKGS_LDSO=$( echo "$PKGS_LDSO" | sed -e "$SEDSCRIPT" ) PKGS_LIBC5=$( echo "$PKGS_LIBC5" | sed -e "$SEDSCRIPT" ) PKGS_LIBC6=$( echo "$PKGS_LIBC6" | sed -e "$SEDSCRIPT" ) PKGS_NCURSES=$( echo "$PKGS_NCURSES" | sed -e "$SEDSCRIPT" ) PKGS_LIBRL=$( echo "$PKGS_LIBRL" | sed -e "$SEDSCRIPT" ) PKGS_LIBRLG=$( echo "$PKGS_LIBRLG" | sed -e "$SEDSCRIPT" ) PKGS_BASH=$( echo "$PKGS_BASH" | sed -e "$SEDSCRIPT" ) PKGS_LIBGPP=$( echo "$PKGS_LIBGPP" | sed -e "$SEDSCRIPT" ) PKGS_SLANG=$( echo "$PKGS_SLANG" | sed -e "$SEDSCRIPT" ) PKGS_DPKG=$( echo "$PKGS_DPKG" | sed -e "$SEDSCRIPT" ) PKGS_LIBGDBM=$( echo "$PKGS_LIBGDBM" | sed -e "$SEDSCRIPT" ) PKGS_PERLBASE=$( echo "$PKGS_PERLBASE" | sed -e "$SEDSCRIPT" ) PKGS_PERL=$( echo "$PKGS_PERL" | sed -e "$SEDSCRIPT" ) PKGS_MOREDPKG=$( echo "$PKGS_MOREDPKG" | sed -e "$SEDSCRIPT" ) PKGS_NETBASE=$( echo "$PKGS_NETBASE" | sed -e "$SEDSCRIPT" ) PKGS_NETSTD=$( echo "$PKGS_NETSTD" | sed -e "$SEDSCRIPT" ) # sanity check that we can find the packages ALLPKGS=$( echo "$ALLPKGS" | sed -e "$SEDSCRIPT" ) for i in $ALLPKGS ; do echo -n "$(basename $i) " if [ ! -f $i ] ; then echo echo "Can't find $i!" echo aborting upgrade. exit 100 fi done echo echo echo "all needed files found." echo # # libc5 # echo "installing libc5." $DPKG $DPKG_ARGS $PKGS_LIBC5 || exit 2 # # if this is a buzz system, then first upgrade dpkg to version 1.4.0.8 # DPKG_VER=$(dpkg -s dpkg | grep Version: | awk '{print $2}') DPKG_MINOR=$(echo $DPKG_VER | awk -F"." '{print $2}') if [ $DPKG_MINOR -lt 4 ] ; then echo "The version of dpkg on this system cannot be used to upgrade to hamm" echo "Please upgrade dpkg to ver. 1.4.0.8 as described in README-upgrade" echo "After upgrading dpkg, re-run this script." exit 2 fi RMFILE="/root/removed-$DATE" # Now we start the install # First get rid of essential package timezone to permit installation of # replacement timezones. # # I don't like forcing dpkg, but I can see no alternative. timezone is # required, but shouldn't really be "essential", and this was corrected # in bo. $DPKG -l timezone | grep -q "^.i" && TIMEZONE=1 if [ "$TIMEZONE" = "1" ] ; then echo echo "Removing package timezone to permit replacing it with timezones." echo $DPKG --force-remove-essential -r timezone fi # Now build list of incompatible packages to be removed if installed. RMPKGS="xmanpages perl-suid perl-debug wg15-locale libpthread0 xslib splay boot-floppies localebin" RMGREP=$(echo "$RMPKGS" | xargs echo | sed -e 's/ /\\\|/g') PKGS_RM=$(dpkg -l | grep "^.i" | grep -w "$RMGREP" | awk '{print $2}') # build up a list of installed -dev packages so that we can remove them. # # this is necessary even on machines which aren't doing libc6 # development because libc5 can't be upgraded to latest version without # removal of libc5-dev which also necessitates removal of other -dev # packages like libdb1-dev and libdl1-dev if they are installed. DEVPACKAGES=$( dpkg --get-selections | grep -v "dpkg-dev\|deinstall" | cut -f1 | grep -- "-dev$\|-pic$\|-dbg$" ) # don't bother running 'dpkg -r' if there's nothing to remove. RM_LIST="$DEVPACKAGES $PKGS_RM" if [ ! "$RM_LIST" = " " ] ; then # log what gets removed. echo "Packages Removed by autopup script on $DATE :" > $RMFILE echo "Development packages: " >> $RMFILE echo "$DEVPACKAGES" >> $RMFILE echo "Other packages that were incompatible with the upgrade:" >> $RMFILE echo -n "timezone " >> $RMFILE echo $PKGS_RM >> $RMFILE # and finally remove them. echo echo "removing incompatible and development packages." $DPKG --remove -B $RM_LIST || exit 1 fi # now install the new versions of things. Just the bare minimum to let # the user safely run dselect for the rest of the upgrade. echo echo "installing packages." # libc # $DPKG $DPKG_ARGS $PKGS_LDSO || exit 2 $DPKG $DPKG_ARGS $PKGS_LIBC6 || exit 2 # libreadline, ncurses, and bash # $DPKG $DPKG_ARGS $PKGS_NCURSES || exit 3 $DPKG $DPKG_ARGS $PKGS_LIBRL || exit 4 $DPKG $DPKG_ARGS $PKGS_LIBRLG || exit 5 # paranoia says run ldconfig NOW. don't laugh, i've needed to do this on # some libc5-libc6 upgrades. i know that the postinst scripts for the # libs are supposed to do it but .... $LDCONFIG $DPKG $DPKG_ARGS $PKGS_BASH || exit 6 # new dpkg # $DPKG $DPKG_ARGS $PKGS_LIBGPP || exit 7 $DPKG $DPKG_ARGS $PKGS_DPKG # slang $DPKG $DPKG_ARGS $PKGS_SLANG || exit 7 # perl # $DPKG $DPKG_ARGS $PKGS_LIBGDBM || exit 8 # paranoia says "run ldconfig now". $LDCONFIG # Unlike a bo installation, in rex, dpkg removes perl when installing # perl-base, and must de-configure many packages (9 on my system) # first. Since these packages can not be re-configured until perl is # installed and configured, the following line will always cause an # error, therefore the "|| exit 9" is commented out in this line. $DPKG $DPKG_ARGS $PKGS_PERLBASE # || exit 9 [ -e /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist ] && rm -f /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist $DPKG $DPKG_ARGS $PKGS_PERL # || exit 9 # When perl is setup, it should(?) configure the de-configured packages. # However, paranoia says to comment out the "|| exit 9" and run # configure. exit at this point if there are packages which failed to # configure. $DPKG --configure --pending || exit 9 cat<". You will have to install the libc6 equivalents of any of these packages that you need. If you will be doing any libc5 development work, you will also want to re-install (from the old-libs directory) any of these libc5 packages you need. Finally, remember to fix up wtmp and utmp, otherwise last and who and sac, etc. won't work. Here's what Miquel van Smoorenburg had to say about this recently in debian-user mailing list: > 1. You need to update ALL your packages to hamm > 2. Reboot if you haven't done that already > 3. You need to move the wtmp file and truncate the utmp file: > cd /var/log > mv wtmp wtmp.libc5 > touch wtmp > cd /var/run > cp /dev/null utmp > 4. You might want to reboot again to make sure > > This is because the "struct utmp" and thus the utmp and wtmp > "databases" are different between libc5 and libc6 You now have a Debian Gnu/Linux v2.0 system. Have fun! __EOF__