diff --git a/distrib/i386/cdroms/Makefile.cdrom b/distrib/i386/cdroms/Makefile.cdrom index 5dee99d4f5c5..661fe641437c 100644 --- a/distrib/i386/cdroms/Makefile.cdrom +++ b/distrib/i386/cdroms/Makefile.cdrom @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.cdrom,v 1.17 2010/04/04 23:02:23 martin Exp $ +# $NetBSD: Makefile.cdrom,v 1.18 2010/04/19 04:41:36 martin Exp $ .include @@ -24,12 +24,14 @@ CDRUNTIME+= ./sbin CDRUNTIME+= ./stand CDRUNTIME+= ./tmp CDRUNTIME+= ./usr/bin/ftp +CDRUNTIME+= ./usr/bin/grep CDRUNTIME+= ./usr/bin/gzip CDRUNTIME+= ./usr/bin/less CDRUNTIME+= ./usr/bin/more CDRUNTIME+= ./usr/bin/netstat CDRUNTIME+= ./usr/bin/progress CDRUNTIME+= ./usr/bin/sed +CDRUNTIME+= ./usr/bin/sort CDRUNTIME+= ./usr/bin/tip CDRUNTIME+= ./usr/bin/vmstat CDRUNTIME+= ./usr/lib/libbz2.so* @@ -41,6 +43,7 @@ CDRUNTIME+= ./usr/lib/libterminfo.so* CDRUNTIME+= ./usr/lib/libutil.so* CDRUNTIME+= ./usr/lib/libz.so* CDRUNTIME+= ./usr/libexec/ld.elf_so +CDRUNTIME+= ./usr/libexec/getty CDRUNTIME+= ./usr/mdec CDRUNTIME+= ./usr/sbin/chown CDRUNTIME+= ./usr/sbin/chroot @@ -54,10 +57,11 @@ image_md_pre: ${CP} ${.CURDIR}/../../../common/10-resolv.conf cdrom/libexec/dhcpcd-hooks ${CP} ${.CURDIR}/../../../common/99-print-sysinst cdrom/libexec/dhcpcd-hooks ${MKDIR} cdrom/etc - ${CP} ${.CURDIR}/../../ramdisks/common/dot.profile cdrom/etc/rc - ${ECHO} "" >> cdrom/etc/rc - ${ECHO} "# exit to single user mode" >> cdrom/etc/rc - ${ECHO} "exit 1" >> cdrom/etc/rc + ${HOST_LN} -fs /tmp/gettytab cdrom/etc/gettytab + ${CP} ${.CURDIR}/../etc.ttys cdrom/etc/ttys + ${CP} ${.CURDIR}/../etc.rc cdrom/etc/rc + ${CP} ${.CURDIR}/../install.sh cdrom/install.sh + ${CHMOD} 0555 cdrom/install.sh ${MKDIR} cdrom/mnt2 cdrom/targetroot ${CP} ${SYSINSTDIR}/sysinst cdrom ${CHMOD} ugo+rx cdrom/sysinst diff --git a/distrib/i386/cdroms/etc.rc b/distrib/i386/cdroms/etc.rc new file mode 100644 index 000000000000..653c1edc1265 --- /dev/null +++ b/distrib/i386/cdroms/etc.rc @@ -0,0 +1,57 @@ +# $NetBSD: etc.rc,v 1.1 2010/04/19 04:41:36 martin Exp $ +# +# Copyright (c) 1997 Perry E. Metzger +# Copyright (c) 1994 Christopher G. Demetriou +# 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. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed for the +# NetBSD Project. See http://www.NetBSD.org/ for +# information about NetBSD. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. +# +# <> + +PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ +export PATH + +# hack to get around bugs in kernfs's rootdev/rrootdev lookup. +ls -l /dev/* > /dev/null 2>&1 + +# mount a few tempfs to allow modifications over the CD contents +mount -t tmpfs tmpfs /tmp +mount -t tmpfs tmpfs /var +mount -t tmpfs -o union tmpfs /etc + +# prepare important directories in the tmpfses, so dhcpcd will work +mkdir -p /var/run /var/db + +# create a gettytab to autologin and run sysinst (etc/gettytab is a symlink +# to /tmp/gettytab) +echo "# Autostart sysinst" > /tmp/gettytab +echo -n "sysinst:al=root:lo=/install.sh:im=:sp#" >> /tmp/gettytab +stty speed >> /tmp/gettytab + +# done, move on to multiuser mode +exit 0 diff --git a/distrib/i386/cdroms/etc.ttys b/distrib/i386/cdroms/etc.ttys new file mode 100644 index 000000000000..d3099f7112fb --- /dev/null +++ b/distrib/i386/cdroms/etc.ttys @@ -0,0 +1,7 @@ +# $NetBSD: etc.ttys,v 1.1 2010/04/19 04:41:36 martin Exp $ +# +# re-launch the sysinst wrapper script on console +# +# name getty type status comments +# +console "/usr/libexec/getty sysinst" wsvt25 on secure diff --git a/distrib/i386/cdroms/install.sh b/distrib/i386/cdroms/install.sh new file mode 100644 index 000000000000..c49cc0e2133b --- /dev/null +++ b/distrib/i386/cdroms/install.sh @@ -0,0 +1,85 @@ +#! /bin/sh +# $NetBSD: install.sh,v 1.1 2010/04/19 04:41:36 martin Exp $ +# +# - +# Copyright (c) 2010 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Martin Husemann . +# +# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + + +# setup basic environment +PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ +export PATH + +# Check if we are on a framebuffer or on serial console and default +# the terminal type accordingly. +# There is no /var/db/dev.db, so sysctl might not map the devicename properly; +# ttyE0 is 90,0 -> 0x5a00 +case $(sysctl -nx kern.consdev) in + 002f000000000000) + TERM=wsvt25 + ;; + *) + TERM=vt220 + ;; +esac + +export TERM +HOME=/ +export HOME +BLOCKSIZE=1k +export BLOCKSIZE +EDITOR=ed +export EDITOR + +umask 022 + +stty newcrt werase ^W intr ^C kill ^U erase ^? +if [ $TERM != "wsvt25" ]; then + cat << "EOM" + + +You are using a serial console, we do not know your terminal emulation. +Please select one, typical values are: + + vt100 + ansi + xterm + +EOM + echo -n "Terminal type (just hit ENTER for '$TERM'): " + read ans + if [ -n "$ans" ];then + TERM=$ans + fi +fi + +# run the installation or upgrade script. +/sysinst || { + echo "Oops, something went wrong - we will try again"; exit; } + +echo "To return to the installer, quit this shell by typing 'exit' or ^D." +exec /bin/sh