Commit the first set of files for changing time_t on freebsd/sparc64

from a 32-bit value to a 64-bit value.  This commit does not actually
change anything.  It merely provides instructions, scripts, and a safety
measure in Makefile.inc1 for people who want to make the change.

The real change to 64-bit time_t's on sparc64 is scheduled to happen
on March 10th, assuming that so major problems are found between now
and then by early-adopters.

Reviewed by:	freebsd-sparc64
This commit is contained in:
Garance A Drosehn 2004-03-03 19:36:20 +00:00
parent c310653ea1
commit afc6f08629
4 changed files with 1226 additions and 3 deletions

View File

@ -342,12 +342,71 @@ WMAKE_TGTS+= _includes _libraries _depend everything
buildworld: ${WMAKE_TGTS} buildworld: ${WMAKE_TGTS}
.ORDER: ${WMAKE_TGTS} .ORDER: ${WMAKE_TGTS}
#
# Use this to add checks to installworld/installkernel targets.
#
SPECIAL_INSTALLCHECKS=
#
# The following install-time check will see if the installation will
# change the type used for time_t, and if it will, the target makes
# sure that the user is expecting to make that change.
#
.if ${TARGET_ARCH} == "sparc64"
SPECIAL_INSTALLCHECKS+=sparc64_installcheck
CUR_TIMETYPE!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
SRC_TIMETYPE!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | awk '{print $$2}'
NEWSPARC_TIMETYPE?=${CUR_TIMETYPE}
THISHOST!= hostname -s
.if ${THISHOST} == ""
THISHOST="name not set yet"
.endif
sparc64_installcheck:
.if ${CUR_TIMETYPE} != ${SRC_TIMETYPE}
@echo ""
.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMETYPE}
@echo "*** ERROR: This target would change the type used for time_t! ***"
.else
@echo "* Note: This installation changes the type used for time_t"
.endif
@echo "* "
@echo "* This host (${THISHOST}) presently has a time_t of type ${CUR_TIMETYPE},"
@echo "* and this installation will switch time_t to be type ${SRC_TIMETYPE}."
.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMETYPE}
@echo "* "
@echo "* If that is *NOT* what you wanted, then you need to change the"
@echo "* typedef for __time_t in: ${.CURDIR}/sys/sparc64/include/_types.h"
@echo "* from '${SRC_TIMETYPE}' to '${CUR_TIMETYPE}'. After that you *MUST* do a"
@echo "* complete cleanworld, buildworld, buildkernel before you retry"
@echo "* your 'make' command. Also read /usr/src/UPDATING.64BTT."
@echo "* "
@echo "* If that *is* what you want, then enter the commands:"
@echo " NEWSPARC_TIMETYPE=${SRC_TIMETYPE}"
@echo " export NEWSPARC_TIMETYPE"
@echo "* and repeat your 'make' command."
@echo ""
@false
.endif
@echo ""
.elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMETYPE}
@echo ""
@echo "*** ERROR: The variable NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
@echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
@echo "*** has __time_t defined as: '${SRC_TIMETYPE}'"
@false
.else
@# in sparc64_installcheck, all TIMETYPEs == '${NEWSPARC_TIMETYPE}'
.endif
.endif
# #
# installcheck # installcheck
# #
# Checks to be sure system is ready for installworld # Checks to be sure system is ready for installworld
# #
installcheck: installcheck: ${SPECIAL_INSTALLCHECKS}
.if !defined(NO_SENDMAIL) .if !defined(NO_SENDMAIL)
@if ! `id -u smmsp > /dev/null`; then \ @if ! `id -u smmsp > /dev/null`; then \
echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \ echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
@ -386,7 +445,7 @@ distributeworld installworld: installcheck
# and do a 'make reinstall' on the *client* to install new binaries from the # and do a 'make reinstall' on the *client* to install new binaries from the
# most recent server build. # most recent server build.
# #
reinstall: reinstall: ${SPECIAL_INSTALLCHECKS}
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Making hierarchy" @echo ">>> Making hierarchy"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@ -503,7 +562,8 @@ buildkernel:
# #
# Install the kernel defined by INSTALLKERNEL # Install the kernel defined by INSTALLKERNEL
# #
installkernel reinstallkernel installkernel.debug reinstallkernel.debug: installkernel installkernel.debug \
reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
.if empty(INSTALLKERNEL) .if empty(INSTALLKERNEL)
@echo "ERROR: No kernel \"${KERNCONF}\" to install." @echo "ERROR: No kernel \"${KERNCONF}\" to install."
@false @false

361
UPDATING.64BTT Normal file
View File

@ -0,0 +1,361 @@
# -------+---------+---------+---------+---------+---------+---------+---------+
The FreeBSD/sparc64 port is going to change time_t from 32-bits to 64-bits.
This file explains the exact steps that users should follow to update their
sparc64 systems for this change. People running FreeBSD on other types of
hardware, such as CPU's from Intel or AMD, can ignore this file. For now,
this change is only happening for people running FreeBSD on Sparc hardware.
# -------+---------+---------+---------+---------+---------+---------+---------+
# Copyright (c) 2004 - Garance Alistair Drosehn <gad@FreeBSD.org>.
#
# All rights reserved.
#
# Redistribution, publication, translation and use, with or without
# modification, in full or in part, in any form or format of this
# document are permitted without further permission from the author.
#
# THIS DOCUMENT IS PROVIDED BY GARANCE DROSEHN ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GARANCE DROSEHN BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# -------+---------+---------+---------+---------+---------+---------+---------+
# $FreeBSD$
# -------+---------+---------+---------+---------+---------+---------+---------+
If you are in too much of a hurry to read this file, then this is not the
time for you to upgrade to a 64-bit time_t. Period. Stick with a system
using 32-bit time_t until you have plenty of time to perform an upgrade.
This statement is true even if you have performed a thousand system upgrades
in the past, and you are certain that you know everything there is to know
about upgrades. This upgrade *will* take you more time than previous system
upgrades, simply because you must recompile at least some of your ports after
upgrading the base system.
Do not start this update unless you have the extra time.
* READ THIS ENTIRE DOCUMENT at least once before starting the upgrade. *
This is a major change. This change will *not* be backwards-compatible.
Any programs which call system-routines for handling time-values will
have to be recompiled after this change is made.
Because this change is not backwards-compatible, it is important that
the following steps be used when upgrading the system. "Shortcuts" that
have worked for EVERY SINGLE UPGRADE YOU HAVE EVER DONE IN YOUR LIFE are
probably irrelevant. This change is more disruptive than most of the
changes which are normally done on freebsd.
These steps are designed to minimize the chance of you running into any
trouble. We can not guarantee that these steps will avoid all possible
problems, but if you ignore these steps you are very likely to run into
some very painful and time-consuming headaches when upgrading.
Step Pre-1: Update to a recent snapshot of -current, keeping it as
a system with 32-bit time_t.
Step Pre-2: Install that system, using whatever steps you normally
use, and make sure that installation seems to work okay.
Step Pre-3: While still running that 32-bit time_t system, it would
probably be a good idea to cvsup your ports tree, and
then upgrade portupgrade (if you use it) and upgrade any
shells that you use. Eg:
portupgrade -Rr -f ruby portupgrade
portupgrade -Rr -f bash
That way you know you have the latest versions, and you
will also know you have the most-recent distfiles on
your machine.
Step Pre-4: For sparc64 machines which need DHCP:
The 'dhclient' in the base system is known to be unreliable
on a system which is upgraded to 64-bit time_t's. It may
work for you, but it probably will not.
As of March 3rd 2004, we have no fix for that.
However, the net/isc-dhcp3-client port does seem to work.
IF your machine needs DHCP, then you should probably install
that port and make sure you can get it working *before* you
make the change to use 64-bit time_t's.
<instructions for early-adopters>
edit the file /usr/src/sys/sparc64/include/_types.h
find the line:
typedef __int32_t __time_t; /* time()... */
and change '__int32_t' to '__int64_t'
For best results, do NOT make any other changes. Do NOT cvsup the
source tree trying to pick up any other changes. At this point you
know that you have a source tree that does work for your system, so
stick with that source tree (except for making the above 1-line
change, of course).
At one point in my testing, I did do a 'cvsup' which just happened
to pull in one bad commit that broke 'make buildworld', and a second
bad commit that broke 'make installworld'. Believe me, you REALLY
REALLY do *not* want to risk problems like that!
I am not suggesting that you have to do two whole buildworld/
installworld cycles in a single day. You could easily wait a few
days, or even a week between them. What I am suggesting is that
you should not 'cvsup' your sources inbetween the two buildworlds.
</instructions for early-adopters>
cd /usr/src #- 1.
make cleanworld #- 2. or 'rm -Rf /usr/obj/usr/src/*'
make buildworld #- 3.
make buildkernel #- 4. Add KERNCONF if you usually do.
NEWSPARC_TIMETYPE=__int64_t #- 5. (Used by a safety-check done
export NEWSPARC_TIMETYPE #- 5a. by installkernel)
make installkernel #- 6. Add KERNCONF if you usually do.
mergemaster -p #- 7.
# - - A section required for installs over NFS-mounts - - #
ifconfig -a #- NFS 8a. See note below.
shutdown now #- NFS 8b. NOT 'shutdown -r now'
cd /usr/src #- NFS 8c.
./installworld_oldk #- NFS 8d. See note below.
# - - End of this section for NFS-mounts - - #
reboot #- 9. MUST go into single-user mode
For many upgrades, it is true that you can "cheat" at this point, and
get away without actually going into single-user mode straight from
the reboot. But for this upgrade, you REALLY MUST start up straight
into single user mode. So, reboot the machine, type a space (or
anything other than 'Enter') when the boot-loader is counting down.
And then:
boot -s #- 10. (command to boot-loader)
The system will ask you if you want to use /bin/sh or some other shell.
For this upgrade, just hit enter, even if you usually prefer like some
other shell instead of /bin/sh.
fsck -p #- 11.
# - - A section required for installs over NFS-mounts - - #
PATH=/boot/kernel/bin:$PATH #- NFS 12.
# - - End of this section for NFS-mounts - - #
mount -a -t ufs #- 13.
swapon -a #- 14.
# - - A section required for installs over NFS-mounts - - #
ifconfig hme0 inet .... #- NFS 15a. See note below.
mount_nfs host:srcdir /usr/src #- NFS 15b. See note below.
mount_nfs host:objdir /usr/obj #- NFS 15c.
# - - End of this section for NFS-mounts - - #
cd /usr/src #- 16.
./installworld_newk #- 17. Might want to add -S
mergemaster #- 18.
rm -f /var/db/dhclient.leases #- 19. If this host uses DHCP
reboot #- 20.
At this point, you should be up-and-running on a system that has 64-bit
values for time_t. You will have to rebuild anything which depends on
time_t. Later in this file is a suggested order for upgrading ports.
If you have a lot of ports which start up daemons or do other processing
at system-startup, then you might want to have this reboot also go into
single-user mode for upgrading all of the ports. In my case, I've always
done a standard reboot at this point and did not run into problems, but
then I only have 25 ports installed on my SPARC64 system.
Aside: It is slightly more reasonable to use the 'reboot' command, although
you may be more familar with using 'shutdown -r now'. The shutdown command
just turns around and executes '/sbin/reboot', and with this upgrade it is
best to avoid such redirection.
# -------+---------+--------- Notes on the above -------+---------+---------+
General notes on NFS issues:
For this upgrade to 64-bit time_t's, the change is so disruptive that I
couldn't get NFS-mounts to work if I booted a "32-bit time_t system"
(ie: 32-bit versions of /bin, /sbin, /lib, ...) on a 64-bit kernel. So,
I added the installworld_oldk script. This script does two things:
1) Creates a mini-/bin inside /boot/kernel.
2) Does a minimal installworld (while still on the old kernel),
thus making it possible for NFS-mounts to work when you reboot.
The first half is a step that would be perfectly safe to do, for any
upgrade (including non-NFS ones), at any time. It is a generally safe
and interesting idea, although it really should be implemented as an
official target in /usr/src/Makefile to be done right.
The second half would USUALLY be a bad idea to do, but I think it's the
only way I can get this specific upgrade to work for people that install
from NFS-mounted directories. It is bad because you are clobbering parts
of your system even though (in the usual case) you would not know that
the new kernel actually works on your system. It also does not do a
full-install, so you end up booting into a system which is part old-
world, and part new-world. It looks like we can get away with that for
this upgrade, but the tactic would be too risky for "standard upgrades".
These instructions assume that you are already familiar with how to do
installations over NFS-mounted partitions. If you are not, you might
want to read other references, such as 'man development'.
Notes on step NFS 8a: ifconfig -a
This shows to the configuration of all your ethernet interfaces. Write
down the IP address and netmask of your main interface. This is
particularly important if the machine obtains its address via DHCP.
You will not be running dhclient after the reboot in step 8, so just
re-use the IP address that the machine is using for the present reboot.
Notes on step NFS 8b: shutdown now
This will drop you into single-user mode, without rebooting. It
will ask if you want to use /bin/sh for your shell. You do.
Notes on step NFS 8d: installworld_oldk
Note that this script only installs *part* of the new world. You will
still have to reboot into single-user mode and do the full installworld.
The installworld_oldk script will ask you if you want to build a
mini-/bin. For this upgrade, you should say "yes".
Notes on step NFS 15a:
On my Ultra-10, I have the 'hme0' device as my ethernet card. The output
of 'ifconfig -a' (from step 'NFS 7a') included the lines:
hme0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.1.18 netmask 0xffffffe0 broadcast 192.168.1.31
So for this step, I typed in the command:
ifconfig hme0 inet 192.168.1.18 netmask 0xffffff00
Notes on step NFS 15b: mount_nfs
At this step, you may need to specify the host as an IP address instead
of a hostname, because the machine will only be able to resolve hostnames
that are in /etc/hosts.
In my case, I found it easier to create a source file ahead of time
which included the ifconfig and mount_nfs commands that I knew I would
need, and then I just sourced that file after rebooting into single user
mode. If you made such a source file and put it in your root partition,
perhaps under /boot, then that file could also include all of the steps
from 11 through 15c.
Also, it is best use the 'mount_nfs' command, instead of 'mount -t nfs'.
If you use the 'mount' command for NFS mounts, it will turn around and
directly execute /sbin/mount_nfs, and that is not desirable in this case.
Notes on step 17: ./installworld_newk
This script will do some setup work, and then ask you if want it to run
'make installworld'. Most people should just answer "y" (yes) to that
prompt. You can avoid the prompt by including "-y" or "-n" on the
command. If you say "n" (no), then it will tell you what commands
you must type to do the actual installworld.
The script also recognizes a "-S" parameter, which causes it to use
symlinks instead of making copies of programs used by the installation
process. This option will cause less filespace to be used up in /tmp,
but it might be slower in some cases (especially for installs using
an NFS-mounted directory for /usr/obj).
Both this script and the installworld_oldk script also recognize a "-M"
option. This option causes the script to use the absolute minimum PATH
setting that "should" be needed to complete an install. This option is
mainly just for debugging the scripts, though. If you request the
minimum PATH, and some important file was NOT properly copied, then the
installworld will immediately die at that point. This might be painful.
Without "-M", the same oversight would mean that you will run the wrong
*version* of the command, but that older version might actually work
perfectly fine. I did all my testing with "-M" to make sure I had
found all important programs, but there is probably no advantage for
using it for standard system upgrades. Also, if there are no important
files overlooked, then "-M" will not make any difference at all.
# -------+---------+---------+ Upgrading Ports +---------+---------+---------+
Similar to the recommendation for the upgrading the system, I suggest that
you do not 'cvsup' your local copy of the ports collection before trying to
rebuild everything for 64-bit time_t. For one thing, you will have a cvsup
compiled for 32-bTT (32-bit time_t's), and that will not work well on a
system which is using 64-bTT. You might find that you have to 'cvsup' for
some ports, but you will need to get a 64-bTT version of cvsup before you
can do that.
One tactic to use for upgrading ports is to rebuild your already-installed
ports one-at-a-time. If you want to do that, and if you use portupgrade
to upgrade your ports, then I suggest the first thing you should do is:
portupgrade -Rr -f ruby portupgrade #- Ports 1.
Aside: if you get an error about the "ruby-rdoc" port,
then enter: pkg_deinstall ruby-rdoc
and repeat the original command.
portupgrade -Rr -f bash #- Ports 2.
If you have 'bash' installed, or include any other shells
which you have installed from the ports collection. If
your session is *using* one of these shells, then logout
and log back in after recompiling that shell.
portupgrade -Rr -f ezm3 cvsup-without-gui #- Ports 3 (maybe).
If you want to rebuild a 64-bit time_t version of cvsup.
Note: ezm3 (modula-3) needs a patch to work correctly after
the change to 64-BTT. That fix has not been commited to the
port yet [as of Mar 3rd], but it should be commited soon.
There are pre-built packages available for ezm3 and cvsup-without-gui on
the new 64-bTT systems. This ezm3 package *does* include the necessarily
patch. These files are available on the standard ftp servers for FreeBSD.
If you have previous versions installed, then remove them with:
pkg_delete cvsup\*
pkg_delete ezm3\*
If you get warnings about "unable to completely remove" some
lib/m3 directories when deleting ezm3, then also enter:
rm -rf /usr/local/lib/m3
You can install the new packages with:
pkg_add ftp://ftp3.FreeBSD.org/pub/FreeBSD/ports/local-distfiles/gad/ez...
pkg_add ftp://ftp3.FreeBSD.org/pub/FreeBSD/ports/local-distfiles/gad/cv...
Replacing "ez..." with "ezm3-64btt-1.1_1.tbz" and "cv..."
with "cvsup-without-gui-64btt-16.1h.tbz". You can also use
some other standard ftp server, instead of ftp3.FreeBSD.org.
"Now look over all the other ports you have installed, and
re-compile everything that probably needs to be recompiled".
If you are going to do it piecemeal, the next ports to force-recompile
would probably be languages like perl and python, if you have them
installed. Or you might want to play it safe at this point, and simply
recompile *every* port that you have installed.
A different tactic to use for ports is to remove *all* ports before you
do the installkernel/installworld step (while you're still on a 32-bTT
system). Then, once you're up on the 64-bTT system, start making them
one-by-one. If you follow this tactic, you might want to save the output
of a 'pkg_info' command before you start removing ports.
# -------+---------+---------+---------+---------+---------+---------+---------+
If you run into problems when making this change, please report them to
the mailing list freebsd-sparc64@FreeBSD.org .
# -------+---------+---------+---------+---------+---------+---------+---------+
<Final notes for early-adopters>
For people who are helping out by testing these instructions, note
that once you make this change, you must remember to KEEP changing
__time_t in _types.h after every time you 'cvs update' or cvsup
your /usr/src tree. If you forget, and end up building a world
with 32-bit time_t's, you will probably have a very very bad day.
Once this change is committed for real (which is scheduled for
March 10th), you will not need to care about this issue as much.
Also, a change has been committed to /usr/src/Makefile.inc1 which
does try to protect you from making this mistake.
</final notes for early-adopters>
# -------+---------+---------+---------+---------+---------+---------+---------+
# Notice that the following command can be useful in some settings:
grep '#\- ' UPDATING.64BTT

348
installworld_newk Executable file
View File

@ -0,0 +1,348 @@
#!/bin/sh
# -------+---------+---------+---------+---------+---------+---------+---------+
# Copyright (c) 2004 - Garance Alistair Drosehn <gad@FreeBSD.org>.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# -------+---------+---------+---------+---------+---------+---------+---------+
# $FreeBSD$
# -------+---------+---------+---------+---------+---------+---------+---------+
#
# This script does a 'make installworld' using the *new* versions of all
# commands to do the work. This is important when a major incompatible
# change is made, a change such that the old-binaries won't work when
# running on the new-kernel. This script was written for the change to
# 64-bit time_t on FreeBSD/Sparc64, but it is not specific to that.
#
# IMPORTANT: This script does require that you ARE RUNNING ON the
# new kernel that matches the 'world' that you want to install.
#
# -------+---------+---------+---------+---------+---------+---------+---------+
# This script expects that it will be run from /usr/src, or an
# equivalent (perhaps NFS-mounted) directory.
if [ -f MAINTAINERS -a -f UPDATING -a -f Makefile -a -f Makefile.inc1 ] ; then
SOURCE_BWDIR="`make -V .OBJDIR`"
else
echo "This script must be run from /usr/src! (or equivalent)"
exit 1
fi
DOMAKE=
DOMINI=
SETMINPATH=
SYMLINKS=
VERBOSE=
BADOPT=
while test $# != 0
do
case "$1" in
-M) SETMINPATH=yes ;;
-S) SYMLINKS=yes ;;
-y) DOMAKE=yes ;;
-n) DOMAKE=no ;;
-v) VERBOSE=yes ;;
*) echo "Invalid option: $1" ; BADOPT=yes ;;
esac
shift 1
done
if [ -n "$BADOPT" ] ; then
exit 1
fi
echo "* + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - *"
echo "* This script expects that a 'make installkernel' has already"
echo "* been done, and that you HAVE rebooted, and you ARE running"
echo "* on that new kernel."
echo "* + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - *"
echo ""
# Start out with no PATH at all.
PATH=
# Where all the binaries should be coming from.
BW_BIN="${SOURCE_BWDIR}/bin"
BW_SBIN="${SOURCE_BWDIR}/sbin"
BW_UBIN="${SOURCE_BWDIR}/usr.bin"
BW_USBIN="${SOURCE_BWDIR}/usr.sbin"
BW_GUBIN="${SOURCE_BWDIR}/gnu/usr.bin"
MKTEMPCMD=/usr/bin/mktemp
chkfile="${BW_UBIN}/mktemp/mktemp"
if [ -f "${chkfile}" -a -x "${chkfile}" ] ; then
MKTEMPCMD="${chkfile}"
else
echo "** Cannot find ${chkfile}?"
echo "** Will use ${MKTEMPCMD}"
fi
# I intentionally prefer to have a shorter name here... We just need a
# unique name, we're not likely to be under attack during installworld!
TMPHOLD=`"${MKTEMPCMD}" -q -d ${TMPDIR:-/tmp}/install-newk.XXX`
if [ $? -ne 0 ] ; then
echo "** Unable to create temp program-holding directory"
exit 1
fi
# Set the most-restrictive value for PATH that the user is willing to
# shoot for. The more restrictive we are here, the more likely we
# will catch all references to "old version" executables.
PATH=${TMPHOLD}:/sbin:/bin:/usr/sbin:/usr/bin
if [ -n "$SETMINPATH" ] ; then
PATH=${TMPHOLD}
fi
# Find the most-appropriate version of key commands for this script.
# XXX - It would be nice if we could reliably find the exact kernel that
# we booted up with, and check for the optional mini-/bin in it.
COPYCMD=/missing/cp
for chkexec in "${BW_BIN}/cp/cp" /bin/cp ; do
if [ -f "${chkexec}" ] ; then
COPYCMD="${chkexec} -p"
break
fi
done
LINKCMD=/missing/ln
for chkexec in "${BW_BIN}/ln/ln" /bin/ln ; do
if [ -f "${chkexec}" ] ; then
LINKCMD="${chkexec}"
break
fi
done
COPYINFO="Copying"
copy_exec () {
srcdir="$1"
cmdname="$2"
alsoln="$3"
srcfile="${srcdir}/${cmdname}"
if [ -f "${srcfile}" -a -x "${srcfile}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. ${COPYINFO} ${srcfile}"
fi
${COPYCMD} "${srcfile}" "${TMPHOLD}"
if [ $? -ne 0 ] ; then
echo "** Error ${COPYINFO} '${srcfile}'"
exit 1
fi
else
echo "** Cannot find ${cmdname} in ${srcdir}?"
exit 1
fi
if [ -n "${alsoln}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking '${cmdname}' as '${alsoln}' "
fi
${LINKCMD} "${TMPHOLD}/${cmdname}" "${TMPHOLD}/${alsoln}"
if [ $? -ne 0 ] ; then
echo "** Error Linking '${cmdname}'"
exit 1
fi
fi
}
# The programs listed in the following `do' loop are all the same programs
# that the standard 'installworld' target wants to make copies of, except
# that this has special-cases for `awk', `[', and `egrep'. This script
# also adds the commands `cp', `install', `id' and `which', because those
# are also *used* by the standard `make installworld' target, although
# that target doesn't bother to make copies of those programs. The `sleep'
# command is also added, but only because it is used in this script. And
# `script' is included just because it can be useful when testing this script.
#
# Note that this means there will be two copies made of these files
# (because the 'make installworld' target is still going to copy them a
# second time).
# XXX - also remember that these are dynamically-linked, so this is not
# necessarily a perfect solution for the 'general case', but it
# does seem to work correctly for the switch to 64-bit time_t.
# Do the `cp' command first, because this script does so much with it.
chkfile="${BW_BIN}/cp/cp"
if [ -f "${chkfile}" -a -x "${chkfile}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Copying ${chkfile}"
fi
${COPYCMD} "${chkfile}" ${TMPHOLD}
else
echo "** Cannot find ${chkfile}?"
exit 1
fi
# Do the `ln' command as the second one, for similar reasons.
copy_exec "${BW_BIN}/ln" ln
# Awk is also called 'nawk'
copy_exec "${BW_UBIN}/awk" nawk awk
# The `install' comand is also is a special case, because
# the program is actually built under the name 'xinstall'.
copy_exec "${BW_UBIN}/xinstall" xinstall install
# Mergemaster is another special case, because it's a script which is
# pulled from the /usr/src directory (not from /usr/obj/usr/src/...).
# Strictly speaking we shouldn't need to pull this in, but I do in
# case someone says 'no' to the automatic-installworld at the end
# if this script. If they also specified -M, then they end up with
# a PATH which will have only our TMPHOLD directory when they get
# to the mergemaster step.
copy_exec "`pwd`/usr.sbin/mergemaster" mergemaster.sh mergemaster
# Worried about the extra disk space that this script uses up in /tmp? Well,
# just specify the -S option, and this script will create symlinks instead of
# copying the files. Note that the original files might be NFS-mounted, and
# /tmp might be a memory-based file system, so the `installworld' might go
# much faster when copies are done here instead of symlinks.
if [ -n "$SYMLINKS" ] ; then
COPYINFO="Linking to"
COPYCMD="ln -s"
LINKCMD="ln -s"
fi
for prog in cap_mkdb cat chflags chmod chown date \
echo find grep make mkdir mtree mv \
pwd_mkdb rm sed sh sysctl test true uname wc zic \
hostname id ls sleep script umount which xargs
do
gotmatch=
for chkdir in "${BW_BIN}" "${BW_SBIN}" "${BW_UBIN}" "${BW_GUBIN}" \
"${BW_USBIN}" "${BW_USBIN}/${prog}"
do
# (the above extra-${prog} case is only needed for 'zic')
chkdir="${chkdir}/${prog}"
if [ -f "${chkdir}/${prog}" -a -x "${chkdir}/${prog}" ] ; then
gotmatch=yes
copy_exec "${chkdir}" "${prog}"
if [ $? -ne 0 ] ; then
exit 1
fi
break
fi
done
if [ -z "$gotmatch" ] ; then
echo "** Did not find '${prog}' ?"
fi
done
# Special case to handle '[', which we know is the same as 'test'
if [ -x ${TMPHOLD}/test ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking 'test' as '[' "
fi
${LINKCMD} ${TMPHOLD}/test ${TMPHOLD}/[
fi
# Special case for 'egrep', which is the same as 'grep'
if [ -x ${TMPHOLD}/grep ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking 'grep' as 'egrep' "
fi
${LINKCMD} ${TMPHOLD}/grep ${TMPHOLD}/egrep
fi
# Have to duplicate the standard makefile, to make a few changes.
# First find the setting of PATH. Insert a line in front of that
# which uses the (undocumented) .SHELL feature to get 'make' to
# use the newer version of /bin/sh that we just made a copy of.
# Then alter the PATH setting so that all make targets check our
# directory of copied files first. If '-M' was given, then have
# a PATH setting that looks ONLY at our copied files.
#
# XXX - the .SHELL feature did NOT seem to work the way that I
# wanted it to, but that is not a problem for now. It can
# be looked into at some later date...
nawk '/^PATH=/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
if (WANTMIN == "yes") \
sub(/^PATH *=[ \t]*.*/, "PATH=\t" TDIR ); \
else \
sub(/^PATH *=[ \t]*/, "PATH=\t" TDIR ":"); \
} \
/-f Makefile.inc1/ { \
sub(/Makefile.inc1/, TDIR "/Makefile.inc1" ); \
} \
{ print $0 }' \
"TDIR=${TMPHOLD}" "WANTMIN=${SETMINPATH}" Makefile > ${TMPHOLD}/Makefile
# In the case of this script, we also change Makefile.inc1, just to
# set the .SHELL target, and to make it (Makefile.inc1) reference
# the modified version in 'make -f' references. Someone recently
# committed a total restructuring of Makefile.inc1, so the following
# has to be setup such that it works with both formats.
nawk '/^# Put initial settings/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
} \
/^SUBDIR=[\t ]*share\/info .*bin/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
} \
/-f Makefile.inc1/ { \
sub(/Makefile.inc1/, TDIR "/Makefile.inc1" ); \
} \
{ print $0 }' \
"TDIR=${TMPHOLD}" Makefile.inc1 > "${TMPHOLD}/Makefile.inc1"
echo ""
echo "The key programs needed by 'make installworld' have been copied."
if [ -n "$VERBOSE" ] ; then
ls -C ${TMPHOLD}
echo ""
fi
# The sparc64_installcheck will want this in the environment.
NEWSPARC_TIMETYPE=__int64_t
export NEWSPARC_TIMETYPE
# See if the user wants us to go ahead with 'installworld',
# or just tell them what steps they need to do.
if [ -z "${DOMAKE}" ] ; then
echo "Do you want to proceed with 'installworld'? "
read -p "(y/n) ? " DOMAKE remline
echo " "
fi
if [ -n "`echo /y/yes/okay/ok/ | grep -i \"/${DOMAKE}/\"`" ] ; then
echo "Okay then, this script has set:"
echo " NEWSPARC_TIMETYPE=__int64_t"
echo " PATH=${PATH}"
echo "and will now execute the command:"
echo " make -f ${TMPHOLD}/Makefile installworld"
sleep 4
make -f ${TMPHOLD}/Makefile installworld
else
echo "When you are ready to continue, enter the commands:"
echo " PATH=${PATH}"
echo "or:"
echo " PATH=${TMPHOLD}:\${PATH}"
echo "and:"
echo " NEWSPARC_TIMETYPE=__int64_t"
echo " export NEWSPARC_TIMETYPE"
echo " make -f ${TMPHOLD}/Makefile installworld"
fi

454
installworld_oldk Executable file
View File

@ -0,0 +1,454 @@
#!/bin/sh
# -------+---------+---------+---------+---------+---------+---------+---------+
# Copyright (c) 2004 - Garance Alistair Drosehn <gad@FreeBSD.org>.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# -------+---------+---------+---------+---------+---------+---------+---------+
# $FreeBSD$
# -------+---------+---------+---------+---------+---------+---------+---------+
#
# This script does a 'make installworld' using the *old* versions of all
# commands to do the work. It expects that the new kernel has been installed,
# but that the system has not been rebooted (and is thus still running on the
# previous kernel). This is useful when a major incompatible change is made,
# and you want to do an installworld that uses NFS-mounted directories for
# /usr/src and /usr/obj. This script was written for the change to
# 64-bit time_t on FreeBSD/Sparc64, but it is not specific to that.
#
# IMPORTANT: This script does require that you are NOT YET running on
# the new kernel that matches the 'world' that you want to install.
#
# -------+---------+---------+---------+---------+---------+---------+---------+
# This script expects that it will be run from /usr/src, or an
# equivalent (perhaps NFS-mounted) directory.
if [ -f MAINTAINERS -a -f UPDATING -a -f Makefile -a -f Makefile.inc1 ] ; then
SOURCE_BWDIR="`make -V .OBJDIR`"
else
echo "This script must be run from /usr/src! (or equivalent)"
exit 1
fi
DOMAKE=
DOMINI=
SETMINPATH=
SYMLINKS=
VERBOSE=
BADOPT=
while test $# != 0
do
case "$1" in
-M) SETMINPATH=yes ;;
-N) DOMINI=no ;;
-S) echo "-S (symlinks) is ignored in installworld_oldk." ;;
-Y) DOMINI=yes ;;
-y) DOMAKE=yes ;;
-n) DOMAKE=no ;;
-v) VERBOSE=yes ;;
*) echo "Invalid option: $1" ; BADOPT=yes ;;
esac
shift 1
done
if [ -n "$BADOPT" ] ; then
exit 1
fi
echo "* + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - *"
echo "* This script expects that a 'make installkernel' has already"
echo "* been done, but that the system is still running the previous"
echo "* kernel. Ie, that you have not rebooted."
echo "*"
echo "* Also note that this only does a PARTIAL installworld. You"
echo "* will still have to do a full installworld after rebooting."
echo "* + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - *"
echo ""
# See if the user wants us to create a mini-/bin inside of the
# newly-installed kernel. These executables would only be used
# *after* booting into the new kernel, so we want the new-world
# versions of all files.
# XXX - This is a idea which could be useful in many situations, but
# it really should be implemented as an official make-target.
# It would be particularly nice to make this a statically-linked
# (and crunchgen-ed) collection of programs...
if [ -z "${DOMINI}" -a -z "${DOMAKE}" ] ; then
echo "Do you want a mini-/bin in that newly-installed /boot/kernel? "
read -p "(y/n) ? " DOMINI remline
echo " "
elif [ -z "${DOMINI}" ] ; then
DOMINI="${DOMAKE}"
fi
if [ -n "`echo /y/yes/okay/ok/ | grep -i \"/${DOMINI}/\"`" ] ; then
KERNBINDIR=/boot/kernel/bin
if [ -e ${KERNBINDIR} ] ; then
rm -Rf ${KERNBINDIR}
fi
mkdir -p ${KERNBINDIR}
# Much of this is done in a subshell, so values of DESTDIR, etc,
# will only be in effect for this section of the script.
(
DESTDIR=${KERNBINDIR}
BINDIR=""
NOINFO=YES
NOMAN=YES
export BINDIR DESTDIR NOINFO NOMAN
MFLAG=
for wantdir in bin/chflags bin/chmod bin/cp bin/ls bin/mkdir bin/mv bin/sh \
sbin/ifconfig sbin/mount sbin/mount_nfs sbin/reboot \
usr.bin/find usr.bin/xargs ; do
if [ -n "$VERBOSE" ] ; then
echo ".. Installing ${wantdir} to mini-/bin"
fi
(cd ${wantdir} && make ${MFLAG} install >/dev/null )
if [ $? -ne 0 ] ; then
echo "** Error while in ${wantdir} doing 'make install'"
echo "** for DESTDIR=${KERNBINDIR}"
exit 1
fi
done
echo "Done building ${KERNBINDIR}"
echo
) || exit 1
fi
# Start out with no PATH at all.
PATH=
# Where all the binaries should be coming from.
OW_BIN="/bin"
OW_SBIN="/sbin"
OW_UBIN="/usr/bin"
OW_USBIN="/usr/sbin"
OW_GUBIN="/usr/bin"
MKTEMPCMD=/usr/bin/mktemp
# I intentionally prefer to have a shorter name here... We just need a
# unique name, we're not likely to be under attack during installworld!
TMPHOLD=`"${MKTEMPCMD}" -q -d ${TMPDIR:-/tmp}/install-oldk.XXX`
if [ $? -ne 0 ] ; then
echo "** Unable to create temp program-holding directory"
exit 1
fi
# Set the most-restrictive value for PATH that the user is willing to
# shoot for. The more restrictive we are here, the more likely we
# will catch all references to "unexpected" executables.
PATH=${TMPHOLD}:/sbin:/bin:/usr/sbin:/usr/bin
if [ -n "$SETMINPATH" ] ; then
PATH=${TMPHOLD}
fi
# Find the most-appropriate version of key commands for this script.
# XXX - It would be nice if we could reliably find the exact kernel that
# we booted up with, and check for the optional mini-/bin in it.
COPYCMD=/missing/cp
for chkexec in "/rescue/cp" /bin/cp ; do
if [ -f "${chkexec}" ] ; then
COPYCMD="${chkexec} -p"
break
fi
done
LINKCMD=/missing/ln
for chkexec in "/rescue/ln" /bin/ln ; do
if [ -f "${chkexec}" ] ; then
LINKCMD="${chkexec}"
break
fi
done
COPYINFO="Copying"
copy_exec () {
srcdir="$1"
cmdname="$2"
alsoln="$3"
srcfile="${srcdir}/${cmdname}"
resfile="/rescue/${cmdname}"
if [ -f "${resfile}" -a -x "${resfile}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking ${TMPHOLD}/RESCUE to ${cmdname}"
fi
${LINKCMD} "${TMPHOLD}/RESCUE" "${TMPHOLD}/${cmdname}"
if [ $? -ne 0 ] ; then
echo "** Error Linking '${cmdname}'"
exit 1
fi
elif [ -f "${srcfile}" -a -x "${srcfile}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. ${COPYINFO} ${srcfile}"
fi
${COPYCMD} "${srcfile}" "${TMPHOLD}"
if [ $? -ne 0 ] ; then
echo "** Error ${COPYINFO} '${srcfile}'"
exit 1
fi
else
echo "** Cannot find ${cmdname} in /rescue or ${srcdir}?"
exit 1
fi
if [ -n "${alsoln}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking '${cmdname}' as '${alsoln}' "
fi
${LINKCMD} "${TMPHOLD}/${cmdname}" "${TMPHOLD}/${alsoln}"
if [ $? -ne 0 ] ; then
echo "** Error Linking '${cmdname}'"
exit 1
fi
fi
}
# The programs listed in the following `do' loop are all the same programs
# that the standard 'installworld' target wants to make copies of, except
# that this has special-cases for `awk', `[', and `egrep'. This script
# also adds the commands `cp', `install', `id' and `which', because those
# are also *used* by the standard `make installworld' target, although
# that target doesn't bother to make copies of those programs. The `sleep'
# command is also added, but only because it is used in this script. And
# `script' is included just because it can be useful when testing this script.
#
# Note that this means there will be two copies made of these files
# (because the 'make installworld' target is still going to copy them a
# second time).
# Do the `cp' command first, because this script does so much with it.
# This is done as a special case, because it's the initial program
# from /rescue (if /rescue exists).
chkfile="/rescue/cp"
if [ -f "${chkfile}" -a -x "${chkfile}" ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Copying ${chkfile} to 'RESCUE'"
fi
${COPYCMD} "${chkfile}" "${TMPHOLD}/RESCUE"
fi
copy_exec "${OW_BIN}" cp
# Do the `ln' command as the second one, for similar reasons.
copy_exec "${OW_BIN}" ln
# Awk is also called 'nawk'
copy_exec "${OW_UBIN}" nawk awk
# The `install' comand is not a special case in this script,
# but it is in the installworld_newk script.
copy_exec "${OW_UBIN}" install
# Worried about the extra disk space that this script uses up in /tmp? Well,
# just specify the -S option, and this script will create symlinks instead of
# copying the files. Note that the original files might be NFS-mounted, and
# /tmp might be a memory-based file system, so the `installworld' might go
# much faster when copies are done here instead of symlinks.
if [ -n "$SYMLINKS" ] ; then
echo "The -S (symlinks) option is ignored in installworld_oldk"
# COPYINFO="Linking to"
# COPYCMD="ln -s"
# LINKCMD="ln -s"
fi
for prog in cap_mkdb cat chflags chmod chown date \
echo find grep make mkdir mtree mv \
pwd_mkdb rm sed sh sysctl test true uname wc zic \
hostname id ls sleep script umount which xargs
do
gotmatch=
for chkdir in "${OW_BIN}" "${OW_SBIN}" "${OW_UBIN}" "${OW_USBIN}"
do
if [ -f "${chkdir}/${prog}" -a -x "${chkdir}/${prog}" ] ; then
gotmatch=yes
copy_exec "${chkdir}" "${prog}"
if [ $? -ne 0 ] ; then
exit 1
fi
break
fi
done
if [ -z "$gotmatch" ] ; then
echo "** Did not find '${prog}' ?"
fi
done
# Special case to handle '[', which we know is the same as 'test'
if [ -x ${TMPHOLD}/test ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking 'test' as '[' "
fi
${LINKCMD} ${TMPHOLD}/test ${TMPHOLD}/[
fi
# Special case for 'egrep', which is the same as 'grep'
if [ -x ${TMPHOLD}/grep ] ; then
if [ -n "$VERBOSE" ] ; then
echo ".. Linking 'grep' as 'egrep' "
fi
${LINKCMD} ${TMPHOLD}/grep ${TMPHOLD}/egrep
fi
# Have to duplicate the standard makefile, to make a few changes.
# First find the setting of PATH. Insert a line in front of that
# which uses the (undocumented) .SHELL feature to get 'make' to
# use the newer version of /bin/sh that we just made a copy of.
# Then alter the PATH setting so that all make targets check our
# directory of copied files first. If '-M' was given, then have
# a PATH setting that looks ONLY at our copied files.
#
# XXX - the .SHELL feature did NOT seem to work the way that I
# wanted it to, but that is not a problem for now. It can
# be looked into at some later date...
nawk '/^PATH=/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
if (WANTMIN == "yes") \
sub(/^PATH *=[ \t]*.*/, "PATH=\t" TDIR ); \
else \
sub(/^PATH *=[ \t]*/, "PATH=\t" TDIR ":"); \
} \
/-f Makefile.inc1/ { \
sub(/Makefile.inc1/, TDIR "/Makefile.inc1" ); \
} \
{ print $0 }' \
"TDIR=${TMPHOLD}" "WANTMIN=${SETMINPATH}" Makefile > ${TMPHOLD}/Makefile
# In the case of this script, we want the new libraries to be the
# *last* things that are installed (since we will be running some
# programs which expect the present libraries). However, we do
# still have the problem that 'make' explicitly uses /bin/sh, so
# the install of 'bin' must be delayed to after those libraries.
# [Someone recently committed a total restructuring of Makefile.inc1,
# so the following has to be setup such that it works with either
# formats. That's why it seems to be doing everything twice.]
nawk 'BEGIN { GOTSBIN = 0; } \
/^# Put initial settings/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
} \
/^SUBDIR=[\t ]*share\/info .*bin/ { \
print "# Try to get the make cmd to use an alternate /bin/sh." ; \
print ".SHELL : name=sh path=" TDIR "/sh" ; \
print "" ; \
} \
/exists\(.*\/sbin\)/ { \
if (GOTSBIN == 0) { \
GOTSBIN = 1;
print "" ; \
print "# For installworld_oldk processing, forget" ; \
print "# all the subdirectories before sbin..."; \
print "SUBDIR=" ; \
} \
} \
/^SUBDIR\+=sbin/ { \
if (GOTSBIN == 0) { \
GOTSBIN = 1;
print "" ; \
print "# For installworld_oldk processing, forget" ; \
print "# all the subdirectories before sbin..."; \
print "SUBDIR=" ; \
} \
} \
/^# These are last, since it is/ { \
print "# These dirs are done last for installworld_oldk." ; \
print ".if exists(${.CURDIR}/lib)" ; \
print "SUBDIR+= lib" ; \
print ".endif" ; \
print ".if exists(${.CURDIR}/libexec)" ; \
print "SUBDIR+= libexec"; \
print ".endif"; \
print ".if exists(${.CURDIR}/bin)" ; \
print "SUBDIR+= bin"; \
print ".endif"; \
} \
/-f Makefile.inc1/ { \
sub(/Makefile.inc1/, TDIR "/Makefile.inc1" ); \
} \
{ print $0 } \
END { \
if (GOTSBIN == 0) { \
print "ERROR: No \"sbin\" match in Makefile.inc1" > "/dev/stderr"; \
} \
}' \
"TDIR=${TMPHOLD}" Makefile.inc1 > "${TMPHOLD}/Makefile.inc1"
echo ""
echo "The key programs needed by 'make installworld' have been copied."
if [ -n "$VERBOSE" ] ; then
ls -C ${TMPHOLD}
echo ""
fi
# XXX - Add some "do-nothing" settings so that we won't clobber any
# more than we need to. I wish we could avoid having to set
# them as environment variables, particularly for the case
# where the user chooses to type in all the commands. The
# more a user has to type, the more chances for a typo...
NO_FORTRAN=yes
NO_RESCUE=yes
NOGAMES=yes
NOINFO=yes
NOMAN=yes
NOSHARE=yes
export NO_FORTRAN NO_RESCUE NOGAMES NOINFO NOMAN NOSHARE
# The sparc64_installcheck will want this in the environment.
NEWSPARC_TIMETYPE=__int64_t
export NEWSPARC_TIMETYPE
# See if the user wants us to go ahead with 'installworld',
# or just tell them what steps they need to do.
if [ -z "${DOMAKE}" ] ; then
echo "Do you want to proceed with the abridged 'installworld'? "
read -p "(y/n) ? " DOMAKE remline
echo " "
fi
if [ -n "`echo /y/yes/okay/ok/ | grep -i \"/${DOMAKE}/\"`" ] ; then
echo "Okay then, this script has set:"
echo " NO_FORTRAN NO_RESCUE NOGAMES NOINFO NOMAN NOSHARE"
echo "and:"
echo " NEWSPARC_TIMETYPE=__int64_t"
echo " PATH=${PATH}"
echo "and will now execute the command:"
echo " make -f ${TMPHOLD}/Makefile installworld"
sleep 4
make -f ${TMPHOLD}/Makefile installworld
else
echo "When you are ready to continue, enter the commands:"
echo " NO_FORTRAN=yes"
echo " NO_RESCUE=yes"
echo " NOGAMES=yes"
echo " NOINFO=yes"
echo " NOMAN=yes"
echo " NOSHARE=yes"
echo " export NO_FORTRAN NO_RESCUE NOGAMES NOINFO NOMAN NOSHARE"
echo " NEWSPARC_TIMETYPE=__int64_t"
echo " export NEWSPARC_TIMETYPE"
echo "and:"
echo " PATH=${PATH}"
echo "or:"
echo " PATH=${TMPHOLD}:\${PATH}"
echo "and:"
echo " make -f ${TMPHOLD}/Makefile installworld"
fi