1998-08-31 03:08:08 +02:00
|
|
|
#
|
1999-03-23 09:09:25 +01:00
|
|
|
# $Id: Makefile.upgrade,v 1.15 1999/02/17 20:56:09 msmith Exp $
|
1998-08-31 03:08:08 +02:00
|
|
|
#
|
|
|
|
# This makefile contains rules for preforming upgrades that are outside
|
|
|
|
# the scope of the normal build world process.
|
|
|
|
#
|
|
|
|
|
1999-02-13 19:49:02 +01:00
|
|
|
#
|
|
|
|
# Make sure the PATH is set correctly
|
|
|
|
#
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
|
|
1998-08-31 03:08:08 +02:00
|
|
|
#
|
|
|
|
# Build things relative to the user's preferred object directory,
|
|
|
|
# defaulting to /usr/obj if not defined.
|
|
|
|
#
|
|
|
|
MAKEOBJDIRPREFIX?=/usr/obj
|
|
|
|
|
|
|
|
#
|
|
|
|
# The installed operating system release gives us the hint as to whether
|
|
|
|
# we need to build a kernel too.
|
|
|
|
#
|
1998-10-17 07:40:46 +02:00
|
|
|
INSTALLEDVERSION!=sh ${.CURDIR}/tools/tools/upgrade/getosreldate.sh
|
|
|
|
INSTALLEDNAME!=uname -r
|
1998-08-31 03:08:08 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Upgrade the installed make to the current version using the installed
|
|
|
|
# headers, libraries and build tools. This is required on installed versions
|
|
|
|
# prior to 2.2.5 in which the installed make doesn't support the -m argument.
|
|
|
|
#
|
|
|
|
make :
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Upgrading the installed make"
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@cd ${.CURDIR}/usr.bin/make; \
|
|
|
|
make obj && make depend && make all && make install
|
|
|
|
|
|
|
|
#
|
|
|
|
# Upgrade from aout to elf, doing an aout build first to ensure that there
|
|
|
|
# are up-to-date tools before building the initial elf world. The aout
|
|
|
|
# tools just built into the object directory tree and executed from there
|
|
|
|
# during the elf build. Then install the aout tools, build an aout kernel
|
|
|
|
# with them (in case the installed kernel is an older version), then
|
|
|
|
# install the elf world.
|
|
|
|
#
|
1999-01-26 10:12:21 +01:00
|
|
|
aout-to-elf aout-to-elf-install : /var/db/update.cfg \
|
1998-08-31 03:08:08 +02:00
|
|
|
${MAKEOBJDIRPREFIX}/do_aout_buildworld \
|
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_buildworld \
|
1998-09-09 08:02:31 +02:00
|
|
|
${MAKEOBJDIRPREFIX}/do_move_aout_libs \
|
1998-08-31 03:08:08 +02:00
|
|
|
${MAKEOBJDIRPREFIX}/do_aout_installworld \
|
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_installworld \
|
1999-01-26 10:12:21 +01:00
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_kernel \
|
1998-08-31 03:08:08 +02:00
|
|
|
${MAKEOBJDIRPREFIX}/do_set_objformat \
|
1999-01-26 10:12:21 +01:00
|
|
|
${MAKEOBJDIRPREFIX}/do_reboot
|
|
|
|
|
|
|
|
# front-load all the information we're going to need.
|
|
|
|
/var/db/update.cfg:
|
|
|
|
@if [ -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
|
|
|
|
env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 1 /var/db/update.cfg; \
|
|
|
|
else \
|
|
|
|
echo "Your source tree must not be fully populated; unable to find upgrade script"; echo "in ${.CURDIR}/tools/tools/upgrade/doupgrade.sh."; exit 1; \
|
|
|
|
fi
|
1998-08-31 03:08:08 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Just do the build parts of the transition build.
|
|
|
|
#
|
|
|
|
aout-to-elf-build : \
|
|
|
|
${MAKEOBJDIRPREFIX}/do_aout_buildworld \
|
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_buildworld
|
|
|
|
|
|
|
|
#
|
|
|
|
# The installed system may not have tools capable of building an elf
|
|
|
|
# aware world, so a complete aout buildworld is required to get a known
|
|
|
|
# set of tools.
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_aout_buildworld :
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Doing an aout buildworld to get an up-to-date set of tools"
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout \
|
1999-01-07 07:30:14 +01:00
|
|
|
OBJFORMAT=aout REALLY_WANT_DEPRECIATED_AOUT=yes \
|
1999-02-17 21:56:09 +01:00
|
|
|
${MAKE} -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
|
1998-08-31 03:08:08 +02:00
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_aout_buildworld
|
|
|
|
|
|
|
|
#
|
|
|
|
# Temporary path for initial elf build.
|
|
|
|
#
|
|
|
|
AOUTTMPPATH= ${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/sbin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/bin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/sbin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/bin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/games
|
|
|
|
|
|
|
|
#
|
|
|
|
# Use the aout tools from the aout buildworld to do an elf buildworld.
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_buildworld :
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Doing an elf buildworld using the aout tools in the aout"
|
|
|
|
@echo " obj tree."
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
|
|
|
|
PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
|
|
|
|
TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
|
1999-03-23 09:09:25 +01:00
|
|
|
X11BASE=/nonexistent \
|
1999-02-17 21:56:09 +01:00
|
|
|
${MAKE} -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
|
1998-08-31 03:08:08 +02:00
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_elf_buildworld
|
|
|
|
|
1998-09-09 08:02:31 +02:00
|
|
|
#
|
|
|
|
# ldconfig should list the directories that the system is currently using.
|
|
|
|
#
|
|
|
|
CUSTOM_LIBDIRS!=ldconfig -r | grep search | sed "s/search directories: //" | sed "s/:/ /g"
|
|
|
|
|
|
|
|
#
|
|
|
|
# These are the standard library directories that should end up containing
|
|
|
|
# just elf libraries.
|
|
|
|
#
|
|
|
|
LIBDIRS=/usr/lib /usr/lib/compat /usr/local/lib /usr/X11R6/lib
|
|
|
|
|
|
|
|
#
|
|
|
|
# Go through the list of library directories from ldconfig and add any
|
|
|
|
# directory that doesn't contain an aout path component to the list of
|
|
|
|
# library directories to search.
|
|
|
|
#
|
|
|
|
.for _lib in ${CUSTOM_LIBDIRS}
|
|
|
|
_lib1=${_lib:S/\/aout//}
|
|
|
|
.if ${_lib1} == ${_lib}
|
|
|
|
.if ${LIBDIRS:R:M${_lib:R}} == ""
|
|
|
|
LIBDIRS+=${_lib}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
#
|
|
|
|
# Go through the list of library directories and prepare a list of
|
|
|
|
# aout directories.
|
|
|
|
#
|
|
|
|
AOUTLIBDIRS=
|
|
|
|
.for _lib in ${LIBDIRS}
|
|
|
|
AOUTLIBDIRS+=${_lib}/aout
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
#
|
|
|
|
# Move the aout libraries into an aout sub-directory of each elf library
|
|
|
|
# directory.
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_move_aout_libs move-aout-libs :
|
1998-09-23 03:46:25 +02:00
|
|
|
.if !defined(NOCONFIRM)
|
1998-09-09 08:02:31 +02:00
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " You are about to move all the installed a.out libraries into"
|
|
|
|
@echo " an aout sub-directory of each elf library directory. You can"
|
|
|
|
@echo " type Ctrl-C to abort now or press return to start the moving"
|
|
|
|
@echo " the libraries."
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo Directories to search: ${LIBDIRS}
|
|
|
|
@/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
|
|
|
|
@sh ${.CURDIR}/tools/tools/upgrade/move_aout_libs.sh ${LIBDIRS}
|
1998-09-23 03:46:25 +02:00
|
|
|
.else
|
|
|
|
@NOCONFIRM=1 sh ${.CURDIR}/tools/tools/upgrade/move_aout_libs.sh ${LIBDIRS}
|
|
|
|
.endif
|
1998-09-09 08:02:31 +02:00
|
|
|
@ldconfig ${AOUTLIBDIRS}
|
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_move_aout_libs
|
|
|
|
|
1998-08-31 03:08:08 +02:00
|
|
|
#
|
|
|
|
# Before installing the aout world, allow for the possibility that the
|
|
|
|
# world about to be installed has some different syscalls to the installed
|
|
|
|
# kernel which will make shutting the system down problematic. We set aside
|
|
|
|
# copies of certain programs which match the running kernel.
|
|
|
|
#
|
|
|
|
# Install the aout world so that anything that isn't replaced by the
|
|
|
|
# elf world will be updated.
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_aout_installworld :
|
1998-10-17 07:40:46 +02:00
|
|
|
.if ${INSTALLEDVERSION} < 300003
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Saving a copy of programs required to shut the system down"
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@cp /bin/sh ${MAKEOBJDIRPREFIX}
|
|
|
|
@cp /sbin/reboot ${MAKEOBJDIRPREFIX}
|
|
|
|
.endif
|
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_aout_installworld
|
|
|
|
|
|
|
|
#
|
1999-01-26 10:12:21 +01:00
|
|
|
# Build and install a new kernel, as well as the boot blocks necessary to
|
|
|
|
# boot it.
|
1998-08-31 03:08:08 +02:00
|
|
|
#
|
1999-01-26 10:12:21 +01:00
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_kernel :
|
|
|
|
@if [ -f /var/db/update.cfg -a -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
|
|
|
|
env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 2 /var/db/update.cfg; \
|
|
|
|
fi
|
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_elf_kernel
|
|
|
|
@rm -f /var/db/update.cfg
|
1998-08-31 03:08:08 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install the elf world overwriting just about all the previously installed
|
|
|
|
# aout world. Any aout things that need to be kept have already been
|
|
|
|
# installed in different places (typically in aout subdirectories).
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_elf_installworld :
|
1998-09-23 03:46:25 +02:00
|
|
|
.if !defined(NOCONFIRM)
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " You are about to update the installed system (or the system"
|
|
|
|
@echo " that your DESTDIR points to) with the elf versions of"
|
|
|
|
@echo " everything, replacing the aout versions. You can type Ctrl-C"
|
|
|
|
@echo " to abort now, leaving just the aout world installed, or"
|
|
|
|
@echo " press return to start the second phase of the update."
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
|
1998-09-23 03:46:25 +02:00
|
|
|
.endif
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Doing an elf installworld using the aout tools in the aout"
|
|
|
|
@echo " obj tree."
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
|
|
|
|
PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
|
|
|
|
TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
|
1999-02-17 21:56:09 +01:00
|
|
|
${MAKE} -f Makefile.inc1 -m ${.CURDIR}/share/mk installworld
|
1999-01-26 10:12:21 +01:00
|
|
|
@if [ ! -f /etc/pam.conf ]; then cp ${.CURDIR}/etc/pam.conf /etc; fi
|
|
|
|
@if [ ! -f /etc/auth.conf ]; then cp ${.CURDIR}/etc/auth.conf /etc; fi
|
|
|
|
@if [ ! -f /etc/login.conf ]; then cp ${.CURDIR}/etc/login.conf /etc; fi
|
1998-08-31 03:08:08 +02:00
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_elf_installworld
|
|
|
|
|
|
|
|
#
|
|
|
|
# Now that the elf world has been installed, we can set the default
|
|
|
|
# object format to elf.
|
|
|
|
#
|
|
|
|
${MAKEOBJDIRPREFIX}/do_set_objformat :
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo " Setting the default object format to elf"
|
|
|
|
@echo "--------------------------------------------------------------"
|
1998-09-03 23:16:15 +02:00
|
|
|
@echo "OBJFORMAT=elf" > ${DESTDIR}/etc/objformat
|
1998-08-31 03:08:08 +02:00
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_set_objformat
|
|
|
|
|
|
|
|
#
|
1999-01-26 10:12:21 +01:00
|
|
|
# Time to reboot!
|
|
|
|
${MAKEOBJDIRPREFIX}/do_reboot :
|
1998-09-23 03:46:25 +02:00
|
|
|
.if !defined(NOCONFIRM)
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
1999-01-26 10:12:21 +01:00
|
|
|
@echo " Your system has now been fully updated to elf!"
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo
|
1999-01-27 09:49:53 +01:00
|
|
|
@echo " It's now time to reboot from your new ELF kernel."
|
|
|
|
@echo " You can type Ctrl-C to abort this (at your own risk)"
|
|
|
|
@echo " or press return to reboot the system."
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@${MAKEOBJDIRPREFIX}/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
|
1998-09-23 03:46:25 +02:00
|
|
|
.endif
|
1998-08-31 03:08:08 +02:00
|
|
|
@echo " Rebooting......."
|
|
|
|
@echo "--------------------------------------------------------------"
|
1999-01-27 09:49:53 +01:00
|
|
|
@touch ${MAKEOBJDIRPREFIX}/do_reboot
|
1998-08-31 03:08:08 +02:00
|
|
|
@-${MAKEOBJDIRPREFIX}/reboot
|