Index: ObsoleteFiles.inc =================================================================== --- ObsoleteFiles.inc +++ ObsoleteFiles.inc @@ -38,6 +38,86 @@ # xargs -n1 | sort | uniq -d; # done +# 20190728: pc-sysinstall(8) removed +OLD_FILES+=usr/share/examples/pc-sysinstall/README +OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.fbsd-netinstall +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.geli +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.gmirror +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.netinstall +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.restore +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.rsync +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.upgrade +OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.zfs +OLD_FILES+=usr/share/man/man8/pc-sysinstall.8.gz +OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/create-part.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/delete-part.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-emulation.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-laptop.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-nics.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-info.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-list.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-part.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/enable-net.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/get-packages.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-components.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-config.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-mirrors.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-packages.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-rsync-backups.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-tzones.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/query-langs.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/send-logs.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/setup-ssh-keys.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/set-mirror.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/sys-mem.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-live.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-netup.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/update-part-list.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-layouts.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-models.sh +OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-variants.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-bsdlabel.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-cleanup.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-disk.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-extractimage.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-ftp.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installcomponents.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installpackages.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-localize.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountdisk.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountoptical.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-networking.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-newfs.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-parse.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-packages.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-runcommands.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-unmount.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-upgrade.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions-users.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/functions.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/installimage.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/parseconfig.sh +OLD_FILES+=usr/share/pc-sysinstall/backend/startautoinstall.sh +OLD_FILES+=usr/share/pc-sysinstall/conf/avail-langs +OLD_FILES+=usr/share/pc-sysinstall/conf/exclude-from-upgrade +OLD_FILES+=usr/share/pc-sysinstall/conf/license/bsd-en.txt +OLD_FILES+=usr/share/pc-sysinstall/conf/license/intel-en.txt +OLD_FILES+=usr/share/pc-sysinstall/conf/license/nvidia-en.txt +OLD_FILES+=usr/share/pc-sysinstall/conf/pc-sysinstall.conf +OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-list +OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-size +OLD_FILES+=usr/share/pc-sysinstall/doc/help-index +OLD_FILES+=usr/share/pc-sysinstall/doc/help-start-autoinstall +OLD_FILES+=usr/sbin/pc-sysinstall +OLD_DIRS+=usr/share/examples/pc-sysinstall +OLD_DIRS+=usr/share/pc-sysinstall/backend +OLD_DIRS+=usr/share/pc-sysinstall/backend-partmanager +OLD_DIRS+=usr/share/pc-sysinstall/backend-query +OLD_DIRS+=usr/share/pc-sysinstall/conf/license +OLD_DIRS+=usr/share/pc-sysinstall/conf +OLD_DIRS+=usr/share/pc-sysinstall/doc +OLD_DIRS+=usr/share/pc-sysinstall # 20190722: cap_random(3) removed OLD_FILES+=lib/casper/libcap_random.so.1 OLD_FILES+=usr/include/casper/cap_random.h Index: etc/mtree/BSD.usr.dist =================================================================== --- etc/mtree/BSD.usr.dist +++ etc/mtree/BSD.usr.dist @@ -303,8 +303,6 @@ .. netgraph .. - pc-sysinstall - .. perfmon .. pf @@ -1168,20 +1166,6 @@ .. .. .. - pc-sysinstall - backend - .. - backend-partmanager - .. - backend-query - .. - conf - license - .. - .. - doc - .. - .. security .. sendmail Index: share/man/man5/src.conf.5 =================================================================== --- share/man/man5/src.conf.5 +++ share/man/man5/src.conf.5 @@ -1601,10 +1601,6 @@ .Xr ftpd 8 and .Xr ppp 8 . -.It Va WITHOUT_PC_SYSINSTALL -Set to not build -.Xr pc-sysinstall 8 -and related programs. .It Va WITHOUT_PF Set to not build PF firewall package. When set, it enforces these options: Index: share/mk/src.opts.mk =================================================================== --- share/mk/src.opts.mk +++ share/mk/src.opts.mk @@ -153,7 +153,6 @@ OFED \ OPENSSL \ PAM \ - PC_SYSINSTALL \ PF \ PKGBOOTSTRAP \ PMC \ Index: targets/pseudo/userland/Makefile.depend =================================================================== --- targets/pseudo/userland/Makefile.depend +++ targets/pseudo/userland/Makefile.depend @@ -651,13 +651,6 @@ usr.sbin/ntp/ntpq \ usr.sbin/ntp/ntptime \ usr.sbin/ntp/sntp \ - usr.sbin/pc-sysinstall/backend \ - usr.sbin/pc-sysinstall/backend-partmanager \ - usr.sbin/pc-sysinstall/backend-query \ - usr.sbin/pc-sysinstall/conf \ - usr.sbin/pc-sysinstall/doc \ - usr.sbin/pc-sysinstall/examples \ - usr.sbin/pc-sysinstall/pc-sysinstall \ usr.sbin/pciconf \ usr.sbin/periodic \ usr.sbin/pkg \ Index: tools/build/mk/OptionalObsoleteFiles.inc =================================================================== --- tools/build/mk/OptionalObsoleteFiles.inc +++ tools/build/mk/OptionalObsoleteFiles.inc @@ -2465,16 +2465,6 @@ OLD_FILES+=usr/share/examples/netgraph/udp.tunnel OLD_FILES+=usr/share/examples/netgraph/virtual.chain OLD_FILES+=usr/share/examples/netgraph/virtual.lan -OLD_FILES+=usr/share/examples/pc-sysinstall/README -OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.fbsd-netinstall -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.geli -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.gmirror -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.netinstall -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.restore -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.rsync -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.upgrade -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.zfs OLD_FILES+=usr/share/examples/perfmon/Makefile OLD_FILES+=usr/share/examples/perfmon/README OLD_FILES+=usr/share/examples/perfmon/perfmon.c @@ -2607,7 +2597,6 @@ OLD_DIRS+=usr/share/examples/libvgl OLD_DIRS+=usr/share/examples/mdoc OLD_DIRS+=usr/share/examples/netgraph -OLD_DIRS+=usr/share/examples/pc-sysinstall OLD_DIRS+=usr/share/examples/perfmon OLD_DIRS+=usr/share/examples/pf OLD_DIRS+=usr/share/examples/ppi @@ -7820,95 +7809,6 @@ OLD_FILES+=etc/rc.d/keyserv .endif -.if ${MK_PC_SYSINSTALL} == no -# backend-partmanager -OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/create-part.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/delete-part.sh -# backend-query -OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-emulation.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-laptop.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-nics.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-info.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-list.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-part.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/enable-net.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/get-packages.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-components.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-config.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-mirrors.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-packages.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-rsync-backups.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-tzones.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/query-langs.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/send-logs.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/setup-ssh-keys.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/set-mirror.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/sys-mem.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-live.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-netup.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/update-part-list.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-layouts.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-models.sh -OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-variants.sh -# backend -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-bsdlabel.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-cleanup.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-disk.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-extractimage.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-ftp.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installcomponents.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installpackages.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-localize.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountdisk.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountoptical.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-networking.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-newfs.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-parse.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-packages.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-runcommands.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-unmount.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-upgrade.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions-users.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/functions.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/installimage.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/parseconfig.sh -OLD_FILES+=usr/share/pc-sysinstall/backend/startautoinstall.sh -# conf -OLD_FILES+=usr/share/pc-sysinstall/conf/avail-langs -OLD_FILES+=usr/share/pc-sysinstall/conf/exclude-from-upgrade -OLD_FILES+=usr/share/pc-sysinstall/conf/license/bsd-en.txt -OLD_FILES+=usr/share/pc-sysinstall/conf/license/intel-en.txt -OLD_FILES+=usr/share/pc-sysinstall/conf/license/nvidia-en.txt -OLD_FILES+=usr/share/pc-sysinstall/conf/pc-sysinstall.conf -# doc -OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-list -OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-size -OLD_FILES+=usr/share/pc-sysinstall/doc/help-index -OLD_FILES+=usr/share/pc-sysinstall/doc/help-start-autoinstall -# examples -OLD_FILES+=usr/share/examples/pc-sysinstall/README -OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.fbsd-netinstall -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.geli -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.gmirror -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.netinstall -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.restore -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.rsync -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.upgrade -OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.zfs -# pc-sysinstall -OLD_FILES+=usr/sbin/pc-sysinstall -OLD_FILES+=usr/share/man/man8/pc-sysinstall.8.gz -OLD_DIRS+=usr/share/pc-sysinstall/backend -OLD_DIRS+=usr/share/pc-sysinstall/backend-partmanager -OLD_DIRS+=usr/share/pc-sysinstall/backend-query -OLD_DIRS+=usr/share/pc-sysinstall/conf/license -OLD_DIRS+=usr/share/pc-sysinstall/conf -OLD_DIRS+=usr/share/pc-sysinstall/doc -OLD_DIRS+=usr/share/pc-sysinstall -OLD_DIRS+=usr/share/examples/pc-sysinstall -.endif - .if ${MK_PF} == no OLD_FILES+=etc/newsyslog.conf.d/pf.conf OLD_FILES+=etc/periodic/security/520.pfdenied Index: usr.sbin/Makefile =================================================================== --- usr.sbin/Makefile +++ usr.sbin/Makefile @@ -181,7 +181,6 @@ SUBDIR.${MK_NIS}+= ypset SUBDIR.${MK_NTP}+= ntp SUBDIR.${MK_OPENSSL}+= keyserv -SUBDIR.${MK_PC_SYSINSTALL}+= pc-sysinstall SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg .if ${COMPILER_FEATURES:Mc++11} Index: usr.sbin/pc-sysinstall/Makefile =================================================================== --- usr.sbin/pc-sysinstall/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD$ -SUBDIR=backend backend-partmanager backend-query conf doc examples -SUBDIR+=pc-sysinstall -SUBDIR_PARALLEL= - -.include Index: usr.sbin/pc-sysinstall/Makefile.inc =================================================================== --- usr.sbin/pc-sysinstall/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc" Index: usr.sbin/pc-sysinstall/backend-partmanager/Makefile =================================================================== --- usr.sbin/pc-sysinstall/backend-partmanager/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -FILES= create-part.sh delete-part.sh -FILESMODE= ${BINMODE} -FILESDIR=${SHAREDIR}/pc-sysinstall/backend-partmanager - -.include Index: usr.sbin/pc-sysinstall/backend-partmanager/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/backend-partmanager/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Create partitions on a target disk -############################# - -. ${PROGDIR}/backend/functions.sh - -if [ -z "${1}" ] ; then - echo "Error: No disk specified!" - exit 1 -fi - -if [ -z "${2}" ] ; then - echo "Error: No size specified!" - exit 1 -fi - -if [ ! -e "/dev/${1}" ] ; then - echo "Error: Disk /dev/${1} does not exist!" - exit 1 -fi - -DISK="${1}" -MB="${2}" -TYPE="${3}" -STARTBLOCK="${4}" - -TOTALBLOCKS="`expr $MB \* 2048`" - -# If no TYPE specified, default to MBR -if [ -z "$TYPE" ] ; then TYPE="mbr" ; fi - -# Sanity check the gpart type -case $TYPE in - apm|APM) ;; - bsd|BSD) ;; - ebr|EBR) ;; - gpt|GPT) ;; - mbr|MBR) ;; - vtoc8|VTOC8) ;; - *) echo "Error: Unknown gpart type: $TYPE" ; exit 1 ;; -esac - -# Lets figure out what number this partition will be -LASTSLICE="`gpart show $DISK | grep -v -e $DISK -e '\- free \-' -e '^$' | awk 'END {print $3}'`" -if [ -z "${LASTSLICE}" ] ; then - LASTSLICE="1" -else - LASTSLICE="`expr $LASTSLICE + 1`" -fi - -SLICENUM="${LASTSLICE}" - -# Set a 4k Aligned start block if none specified -if [ "${SLICENUM}" = "1" -a -z "$STARTBLOCK" ] ; then - STARTBLOCK="2016" -fi - - -# If this is an empty disk, see if we need to create a new scheme for it -gpart show ${DISK} >/dev/null 2>/dev/null -if [ $? -eq 0 -a "${SLICENUM}" = "1" ] ; then - if [ "${TYPE}" = "mbr" -o "${TYPE}" = "MBR" ] ; then - flags="-s ${TYPE} -f active" - else - flags="-s ${TYPE}" - fi - gpart create ${flags} ${DISK} -fi - -# If we have a starting block, use it -if [ -n "$STARTBLOCK" ] ; then - sBLOCK="-b $STARTBLOCK" -fi - -gpart add ${sBLOCK} -s ${TOTALBLOCKS} -t freebsd -i ${SLICENUM} ${DISK} -exit "$?" Index: usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Delete a specified partition, takes effect immediately -######################################################## - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-disk.sh - -if [ -z "${1}" ] -then - echo "Error: No partition specified!" - exit 1 -fi - -if [ ! -e "/dev/${1}" ] -then - echo "Error: Partition /dev/${1} does not exist!" - exit 1 -fi - -PARTITION="${1}" - -# First lets figure out the partition number for the given device -################################################################## - -# Get the number of characters in this dev -CHARS="`echo $PARTITION | wc -c`" - -PARTINDEX="" - -# Lets read through backwards until we get the part number -while -z=1 -do - CHARS=$((CHARS-1)) - LAST_CHAR=`echo "${PARTITION}" | cut -c $CHARS` - echo "${LAST_CHAR}" | grep -q "^[0-9]$" 2>/dev/null - if [ $? -eq 0 ] ; then - PARTINDEX="${LAST_CHAR}${PARTINDEX}" - else - break - fi -done - -# Now get current disk we are working on -CHARS=`expr $CHARS - 1` -DISK="`echo $PARTITION | cut -c 1-${CHARS}`" - -# Make sure we have a valid disk name still -if [ ! -e "/dev/${DISK}" ] ; then - echo "Error: Disk: ${DISK} doesn't exist!" - exit 1 -fi - -echo "Running: gpart delete -i ${PARTINDEX} ${DISK}" -gpart delete -i ${PARTINDEX} ${DISK} >/dev/null 2>/dev/null - -# Check if this was the last partition and destroy the disk geom if so -get_disk_partitions "${DISK}" -if [ -z "${VAL}" ] ; then - gpart destroy ${DISK} -fi - -exit "$?" Index: usr.sbin/pc-sysinstall/backend-query/Makefile =================================================================== --- usr.sbin/pc-sysinstall/backend-query/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ - -FILES= detect-laptop.sh detect-nics.sh detect-emulation.sh disk-info.sh \ - disk-list.sh disk-part.sh enable-net.sh get-packages.sh list-config.sh \ - list-components.sh list-mirrors.sh list-packages.sh list-rsync-backups.sh \ - list-tzones.sh query-langs.sh send-logs.sh set-mirror.sh setup-ssh-keys.sh \ - sys-mem.sh test-live.sh test-netup.sh update-part-list.sh xkeyboard-layouts.sh \ - xkeyboard-models.sh xkeyboard-variants.sh -FILESMODE= ${BINMODE} -FILESDIR=${SHAREDIR}/pc-sysinstall/backend-query - -.include Index: usr.sbin/pc-sysinstall/backend-query/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/backend-query/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -case "$(kenv smbios.system.product)" in -VirtualBox) - echo "emulation: VIRTUALBOX" - exit 0 - ;; -VMware*) - echo "emulation: VMWARE" - exit 0 - ;; -*) - echo "emulation: NO" - exit 1 - ;; -esac Index: usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -if devinfo | grep -q acpi_acad0; then - echo "laptop: YES" -else - echo "laptop: NO" -fi Index: usr.sbin/pc-sysinstall/backend-query/detect-nics.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/detect-nics.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -for i in $(ifconfig -l); do - case "${i%%[0-9]*}" in - lo|fwe|fwip|plip|pfsync|pflog|tun) - continue - ;; - esac - IDENT=$(dmesg | sed -n "s/^$i: <\(.*\)>.*$/\1/p" | head -1) - echo "${i}: <$IDENT>" -done Index: usr.sbin/pc-sysinstall/backend-query/disk-info.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/disk-info.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Query a disk for partitions and display them -############################################################################# - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-disk.sh - -DISK="${1}" - -[ -z "${DISK}" ] && { echo 'Error: No disk specified!'; exit 1; } -[ ! -e "/dev/${DISK}" ] && \ - { echo "Error: Disk /dev/${DISK} does not exist!"; exit 1; } - -get_disk_cyl "${DISK}" -CYLS="${VAL}" - -get_disk_heads "${DISK}" -HEADS="${VAL}" - -get_disk_sectors "${DISK}" -SECS="${VAL}" - -# Now get the disks size in MB -KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" -MB=$(convert_byte_to_megabyte ${KB}) - -# Now get the Controller Type -CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`" - -echo "cylinders=${CYLS}" -echo "heads=${HEADS}" -echo "sectors=${SECS}" -echo "size=${MB}" -echo "type=${CTYPE}" Index: usr.sbin/pc-sysinstall/backend-query/disk-list.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/disk-list.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -ARGS=$1 -FLAGS_MD="" -FLAGS_CD="" -FLAGS_VERBOSE="" - -shift -while [ -n "$1" ] -do - case "$1" in - -m) - FLAGS_MD=1 - ;; - -v) - FLAGS_VERBOSE=1 - ;; - -c) - FLAGS_CD=1 - ;; - esac - shift -done - -# Create our device listing -SYSDISK=$(sysctl -n kern.disks) -if [ -n "${FLAGS_MD}" ] -then - MDS=`mdconfig -l` - if [ -n "${MDS}" ] - then - SYSDISK="${SYSDISK} ${MDS}" - fi -fi - -# Add any RAID devices -if [ -d "/dev/raid" ] ; then - cd /dev/raid - for i in `ls` - do - SYSDISK="${SYSDISK} ${i}" - done -fi - -# Now loop through these devices, and list the disk drives -for i in ${SYSDISK} -do - - # Get the current device - DEV="${i}" - - # Make sure we don't find any cd devices - if [ -z "${FLAGS_CD}" ] - then - case "${DEV}" in - acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; - esac - fi - - # Try and get some identification information from GEOM - NEWLINE=$(geom disk list $DEV 2>/dev/null | sed -ne 's/^ descr: *//p') - if [ -z "$NEWLINE" ]; then - NEWLINE=" " - fi - - if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null - then - NEWLINE=" " - fi - - if [ -n "${FLAGS_VERBOSE}" ] - then - : - fi - - # Save the disk list - if [ ! -z "$DLIST" ] - then - DLIST="\n${DLIST}" - fi - - DLIST="${DEV}:${NEWLINE}${DLIST}" - -done - -# Echo out the found line -echo -e "$DLIST" | sort Index: usr.sbin/pc-sysinstall/backend-query/disk-part.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/disk-part.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Query a disk for partitions and display them -############################# - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-disk.sh - -if [ -z "${1}" ] -then - echo "Error: No disk specified!" - exit 1 -fi - -if [ ! -e "/dev/${1}" ] -then - echo "Error: Disk /dev/${1} does not exist!" - exit 1 -fi - -DISK="${1}" - -# Now get the disks size in MB -KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" -MB=$(convert_byte_to_megabyte ${KB}) -TOTALSIZE="$MB" -TOTALB="`diskinfo -v ${1} | grep 'in sectors' | tr -s '\t' ' ' | cut -d ' ' -f 2`" - -gpart show ${1} >/dev/null 2>/dev/null -if [ "$?" != "0" ] ; then - # No partitions on this disk, display entire disk size and exit - echo "${1}-freemb: ${TOTALSIZE}" - echo "${1}-freeblocks: ${TOTALB}" - exit -fi - -# Display if this is GPT or MBR formatted -TYPE=`gpart show ${1} | awk '/^=>/ { printf("%s",$5); }'` -echo "${1}-format: $TYPE" - -# Set some search flags -PART="0" -EXTENDED="0" -START="0" -SIZEB="0" - -# Get a listing of partitions on this disk -get_disk_partitions "${DISK}" -PARTS="${VAL}" -for curpart in $PARTS -do - - # First get the sysid / label for this partition - if [ "$TYPE" = "MBR" ] ; then - get_partition_sysid_mbr "${DISK}" "${curpart}" - echo "${curpart}-sysid: ${VAL}" - get_partition_label_mbr "${DISK}" "${curpart}" - echo "${curpart}-label: ${VAL}" - else - get_partition_label_gpt "${DISK}" "${curpart}" - echo "${curpart}-sysid: ${VAL}" - echo "${curpart}-label: ${VAL}" - fi - - # Now get the startblock, blocksize and MB size of this partition - - get_partition_startblock "${DISK}" "${curpart}" - START="${VAL}" - echo "${curpart}-blockstart: ${START}" - - get_partition_blocksize "${DISK}" "${curpart}" - SIZEB="${VAL}" - echo "${curpart}-blocksize: ${SIZEB}" - - SIZEMB=$(convert_blocks_to_megabyte ${SIZEB}) - echo "${curpart}-sizemb: ${SIZEMB}" - -done - - -# Now calculate any free space -LASTB="`expr $SIZEB + $START`" -FREEB="`expr $TOTALB - $LASTB`" -FREEMB="`expr ${FREEB} / 2048`" -echo "${1}-freemb: $FREEMB" -echo "${1}-freeblocks: $FREEB" Index: usr.sbin/pc-sysinstall/backend-query/enable-net.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/enable-net.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. All rights reserved. -# Copyright (c) 2011 The FreeBSD Foundation -# All rights reserved. -# -# Portions of this software were developed by Bjoern Zeeb -# under sponsorship from the FreeBSD Foundation. -# -# 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$ - -# Script which enables networking with specified options -########################################################################### - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/conf/pc-sysinstall.conf -. ${BACKEND}/functions-networking.sh -. ${BACKEND}/functions-parse.sh - - -NIC="$1" -IP="$2" -NETMASK="$3" -DNS="$4" -GATEWAY="$5" -MIRRORFETCH="$6" -IPV6="$7" -IPV6GATE="$8" -IPV6DNS="$9" - -if [ -z "${NIC}" ] -then - echo "ERROR: Usage enable-net " \ - " " - exit 150 -fi - -if [ "$NIC" = "AUTO-DHCP" ] -then - enable_auto_dhcp -elif [ "$NIC" = "IPv6-SLAAC" ] -then - enable_auto_slaac - # In addition, if static values were defined, add them as well. - # We might not get DNS information from RAs, for example. - if [ -n "${IPV6}" ]; then - VAL="" - get_first_wired_nic - if [ -n "${VAL}" ]; then - ifconfig ${VAL} inet6 ${IPV6} alias - fi - fi - # Append only here. - if [ -n "${IPV6DNS}" ]; then - echo "nameserver ${IPV6DNS}" >>/etc/resolv.conf - fi - # Do not - if [ -n "${IPV6GATE}" ]; then - # Check if we have a default route already to not overwrite. - if ! route -n get -inet6 default > /dev/null 2>&1 ; then - route add -inet6 default ${IPV6GATE} - fi - fi -else - echo "Enabling NIC: $NIC" - if [ -n "${IP}" ]; then - ifconfig ${NIC} inet ${IP} ${NETMASK} - fi - if [ -n "${IPV6}" ]; then - ifconfig ${NIC} inet6 ${IPV6} alias - fi - - # Keep default from IPv4-only support times and clear the resolv.conf file. - : > /etc/resolv.conf - if [ -n "${DNS}" ]; then - echo "nameserver ${DNS}" >>/etc/resolv.conf - fi - if [ -n "${IPV6DNS}" ]; then - echo "nameserver ${IPV6DNS}" >>/etc/resolv.conf - fi - - if [ -n "${GATE}" ]; then - route add -inet default ${GATE} - fi - if [ -n "${IPV6GATE}" ]; then - route add -inet6 default ${IPV6GATE} - fi -fi - -case ${MIRRORFETCH} in - ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;; - *) ;; -esac Index: usr.sbin/pc-sysinstall/backend-query/get-packages.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/get-packages.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which lists the available packages for this release -########################################################################### - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-packages.sh - -ID=`id -u` -if [ "${ID}" -ne "0" ] -then - echo "Error: must be root!" - exit 1 -fi - -if [ ! -f "${PKGDIR}/INDEX" ] -then - get_package_index -fi - -if [ -f "${PKGDIR}/INDEX" ] -then - echo "${PKGDIR}/INDEX" - exit 0 -fi - -exit 1 Index: usr.sbin/pc-sysinstall/backend-query/list-components.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-components.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which lists the available components for this release -########################################################################### - -. ${PROGDIR}/backend/functions.sh - -echo "Available Components:" - -if [ -d "${COMPDIR}" ] -then - cd ${COMPDIR} - for i in `ls -d *` - do - if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ] - then - NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`" - DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`" - TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`" - echo " " - echo "name: ${i}" - echo "desc:${DESC}" - echo "type:${TYPE}" - if [ -e "${i}/component.png" ] - then - echo "icon: ${COMPDIR}/${i}/component.png" - fi - fi - done -fi Index: usr.sbin/pc-sysinstall/backend-query/list-config.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-config.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -echo "branch=${FBSD_BRANCH}" -echo "arch=${FBSD_ARCH}" -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-ftp.sh - -# Backend script which lists all the available ftp mirrors for front-ends to display -COUNTRY="${1}" - -get_ftp_mirrors "${COUNTRY}" -show_mirrors "${VAL}" - -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/list-packages.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-packages.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which lists the available packages for this release -########################################################################### - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-packages.sh - -PACKAGE_CATEGORY="${1}" -PACKAGE_NAME="${2}" -NARGS=0 - -if [ ! -f "${PKGDIR}/INDEX" ] -then - echo "Error: please fetch package index with get-packages!" - exit 1 -fi - -if [ ! -f "${PKGDIR}/INDEX.parsed" ] -then - parse_package_index -fi - -if [ -n "${PACKAGE_CATEGORY}" ] -then - NARGS=$((NARGS+1)) -fi - -if [ -n "${PACKAGE_NAME}" ] -then - NARGS=$((NARGS+1)) -fi - -if [ "${NARGS}" -eq "0" ] -then - show_packages - -elif [ "${NARGS}" -eq "1" ] -then - - if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ] - then - if [ -f "${PKGDIR}/INDEX" ] - then - echo "${PKGDIR}/INDEX" - exit 0 - else - exit 1 - fi - - else - show_packages_by_category "${PACKAGE_CATEGORY}" - fi - -elif [ "${NARGS}" -eq "2" ] -then - show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}" - -else - show_packages -fi Index: usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which lists the backups present on a server -########################################################################### - -. ${PROGDIR}/backend/functions.sh - -SSHUSER=$1 -SSHHOST=$2 -SSHPORT=$3 - -if [ -z "${SSHHOST}" -o -z "${SSHPORT}" ] -then - echo "ERROR: Usage list-rsync-backups.sh " - exit 150 -fi - -# Look for full-system backups, needs at minimum a kernel to be bootable -FINDCMD="find . -type d -maxdepth 6 -name 'kernel' | grep '/boot/kernel'" - -# Get a listing of the number of full backups saved -OLDBACKUPS=`ssh -o 'BatchMode=yes' -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "${FINDCMD}"` -if [ "$?" = "0" ] -then - for i in ${OLDBACKUPS} - do - BACKPATH="`echo ${i} | sed 's|/boot/.*||g' | sed 's|^./||g'`" - if [ -z "${BACKLIST}" ] - then - BACKLIST="${BACKPATH}" - else - BACKLIST="${BACKLIST}:${BACKPATH}" - fi - done - - if [ -z "${BACKLIST}" ] - then - echo "NONE" - else - echo "$BACKLIST" - fi - -else - echo "FAILED" -fi Index: usr.sbin/pc-sysinstall/backend-query/list-tzones.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/list-tzones.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Backend script which lists all the available timezones for front-ends to display -egrep -v '^#' /usr/share/zoneinfo/zone.tab |\ - tr -s "\t" ":" |\ - cut -d ":" -f 3-4 |\ - sort - -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/query-langs.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/query-langs.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -cat ${PROGDIR}/conf/avail-langs - -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/send-logs.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/send-logs.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which creates a gzipped log and optionally mails it to the specified address -############################################################################ - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/conf/pc-sysinstall.conf -. ${BACKEND}/functions-networking.sh -. ${BACKEND}/functions-parse.sh - -# Bring up all NICS under DHCP -enable_auto_dhcp - -MAILTO="$1" -MAILRESULT="0" - -# Set the location of our compressed log -TMPLOG="/tmp/pc-sysinstall.log" - -echo "# PC-SYSINSTALL LOG" >${TMPLOG} -cat ${LOGOUT} >> ${TMPLOG} - -# Check if we have a GUI generated install cfg -if [ -e "/tmp/sys-install.cfg" ] -then - echo "" >>${TMPLOG} - echo "# PC-SYSINSTALL CFG " >>${TMPLOG} - cat /tmp/sys-install.cfg | grep -vE 'rootPass|userPass' >> ${TMPLOG} -fi - -# Save dmesg output -echo "" >>${TMPLOG} -echo "# DMESG OUTPUT " >>${TMPLOG} -dmesg >> ${TMPLOG} - -# Get gpart info on all disks -for i in `pc-sysinstall disk-list | cut -d ':' -f 1` -do - echo "" >>${TMPLOG} - echo "# DISK INFO $i " >>${TMPLOG} - ls /dev/${i}* >>${TMPLOG} - gpart show ${i} >> ${TMPLOG} -done - -# Show Mounted volumes -echo "" >>${TMPLOG} -echo "# MOUNT OUTPUT " >>${TMPLOG} -mount >> ${TMPLOG} - -echo "Log file saved to ${TMPLOG}" -echo "Warning: This file will be lost once the system is rebooted." - -echo "Do you wish to view this logfile now? (Y/N)" -read tmp -if [ "$tmp" = "Y" -o "$tmp" = "y" ] -then - more ${TMPLOG} -fi Index: usr.sbin/pc-sysinstall/backend-query/set-mirror.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/set-mirror.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXSystems, Inc. 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$ - -. ${PROGDIR}/backend/functions.sh -. ${PROGDIR}/backend/functions-ftp.sh - -MIRROR="${1}" - -if [ -z "${MIRROR}" ] -then - echo "Error: No mirror specified!" - exit 1 -fi - -set_ftp_mirror "${MIRROR}" -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which sets up password-less logins for ssh host -########################################################################### - -. ${PROGDIR}/backend/functions.sh - -SSHUSER=$1 -SSHHOST=$2 -SSHPORT=$3 - -if [ -z "${SSHUSER}" -o -z "${SSHHOST}" -o -z "${SSHPORT}" ] -then - echo "ERROR: Usage setup-ssh-keys " - exit 150 -fi - -cd ~ - -echo "Preparing to setup SSH key authorization..." -echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}" - -if [ ! -e ".ssh/id_rsa.pub" ] -then - mkdir .ssh >/dev/null 2>/dev/null - ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa - sleep 1 -fi - -if [ ! -e ".ssh/id_rsa.pub" ] -then - echo "ERROR: Failed creating .ssh/id_rsa.pub" - exit 150 -fi - -# Get the .pub key -PUBKEY="`cat .ssh/id_rsa.pub`" - -ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "mkdir .ssh ; echo $PUBKEY >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys ; echo $PUBKEY >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2" Index: usr.sbin/pc-sysinstall/backend-query/sys-mem.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/sys-mem.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -if smbios_mem=$(kenv -q smbios.memory.enabled); then - smbios_mem=$(expr $smbios_mem / 1024) -else - smbios_mem=0 -fi -realmem=$(expr $(sysctl -n hw.realmem) / 1048576) - -if [ $smbios_mem -gt $realmem ]; then - echo $smbios_mem -else - echo $realmem -fi Index: usr.sbin/pc-sysinstall/backend-query/test-live.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/test-live.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Script which checks if we are running from install media, or real system -############################################################################# - -dmesg | grep -q 'md0: Preloaded image' || { echo 'REAL-DISK'; exit 1; } - -echo 'INSTALL-MEDIA' Index: usr.sbin/pc-sysinstall/backend-query/test-netup.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/test-netup.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. All rights reserved. -# Copyright (c) 2011 The FreeBSD Foundation -# All rights reserved. -# -# Portions of this software were developed by Bjoern Zeeb -# under sponsorship from the FreeBSD Foundation.# -# -# 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$ - - -# Script which tries to ping "home" to see if Internet connectivity is -# available. -############################################################################# - -rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null - -ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "ftp: Up" - exit 0 -fi - -ping6 -c 2 www.pcbsd.org >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "ftp: Up" - exit 0 -fi - -ping -c 2 www.freebsd.org >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "ftp: Up" - exit 0 -fi - -ping6 -c 2 www.freebsd.org >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "ftp: Up" - exit 0 -fi - -echo "ftp: Down" -exit 1 Index: usr.sbin/pc-sysinstall/backend-query/update-part-list.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/update-part-list.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Need access to a some unmount functions -. ${PROGDIR}/backend/functions-unmount.sh - -echo "Running: find-update-parts" >> ${LOGOUT} - -rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null - -FSMNT="/mnt" - -# Get the freebsd version on this partition -get_fbsd_ver() -{ - sFiles="/bin/sh /boot/kernel/kernel" - for file in $sFiles - do - if [ ! -e "${FSMNT}/$file" ] ; then continue ; fi - - VER="`file ${FSMNT}/$file | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`" - if [ "$?" = "0" ] ; then - file ${FSMNT}/$file | grep '32-bit' >/dev/null 2>/dev/null - if [ "${?}" = "0" ] ; then - echo "${1}: FreeBSD ${VER} (32bit)" - else - echo "${1}: FreeBSD ${VER} (64bit)" - fi - fi - break - done - -} - -# Create our device listing -SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`" -DEVS="" - -# Now loop through these devices, and list the disk drives -for i in ${SYSDISK} -do - - # Get the current device - DEV="${i}" - # Make sure we don't find any cd devices - echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null - if [ "$?" != "0" ] ; then - DEVS="${DEVS} `ls /dev/${i}*`" - fi - -done - -# Search for regular UFS / Geom Partitions to upgrade -for i in $DEVS -do - if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then - continue - fi - - if [ -e "${i}a.journal" ] ; then - _dsk="${i}a.journal" - elif [ -e "${i}a" ] ; then - _dsk="${i}a" - elif [ -e "${i}p2" ] ; then - _dsk="${i}p2" - elif [ -e "${i}p2.journal" ] ; then - _dsk="${i}p2.journal" - fi - - mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} - if [ $? -eq 0 ] ; then - get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`" - umount -f ${FSMNT} >/dev/null 2>/dev/null - fi -done Index: usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -FOUND="0" -TMPLIST="/tmp/.xkeyList.$$" -XLST="/usr/local/share/X11/xkb/rules/xorg.lst" - -if [ ! -e "${XLST}" ] ; then - exit 1 -fi - -# Lets parse the xorg.list file, and see what layouts are supported -while read line -do - - if [ "$FOUND" = "1" -a ! -z "$line" ] - then - echo $line | grep '! ' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - break - else - echo "$line" >> ${TMPLIST} - fi - fi - - if [ "${FOUND}" = "0" ] - then - echo $line | grep '! layout' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - FOUND="1" - fi - fi - -done < $XLST - -sort -b -d +1 $TMPLIST - -# Delete the tmp file -rm $TMPLIST - -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -FOUND="0" - -# Lets parse the xorg.list file, and see what models are supported -while read line -do - - if [ "$FOUND" = "1" -a ! -z "$line" ] - then - echo $line | grep '! ' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - exit 0 - else - model="`echo $line | sed 's|(|[|g'`" - model="`echo $model | sed 's|)|]|g'`" - echo "$model" - fi - fi - - if [ "${FOUND}" = "0" ] - then - echo $line | grep '! model' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - FOUND="1" - fi - fi - -done < /usr/local/share/X11/xkb/rules/xorg.lst - -exit 0 Index: usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh =================================================================== --- usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -FOUND="0" - -# Lets parse the xorg.list file, and see what varients are supported -while read line -do - - if [ "$FOUND" = "1" -a ! -z "$line" ] - then - echo $line | grep '! ' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - exit 0 - else - echo "$line" - fi - fi - - if [ "${FOUND}" = "0" ] - then - echo $line | grep '! variant' >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - FOUND="1" - fi - fi - -done < /usr/local/share/X11/xkb/rules/xorg.lst - -exit 0 Index: usr.sbin/pc-sysinstall/backend/Makefile =================================================================== --- usr.sbin/pc-sysinstall/backend/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -FILES= functions-bsdlabel.sh functions-cleanup.sh functions-disk.sh \ - functions-extractimage.sh functions-ftp.sh functions-installcomponents.sh \ - functions-installpackages.sh functions-localize.sh functions-mountdisk.sh \ - functions-mountoptical.sh functions-networking.sh \ - functions-newfs.sh functions-packages.sh functions-parse.sh \ - functions-runcommands.sh functions-unmount.sh \ - functions-upgrade.sh functions-users.sh \ - functions.sh parseconfig.sh startautoinstall.sh installimage.sh -FILESMODE= ${BINMODE} -FILESDIR=${SHAREDIR}/pc-sysinstall/backend - -.include Index: usr.sbin/pc-sysinstall/backend/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/backend/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh +++ /dev/null @@ -1,784 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions related to disk operations using bsdlabel - -# Check if we are are provided a geli password on the nextline of the config -check_for_enc_pass() -{ - CURLINE="${1}" - - get_next_cfg_line "${CFGF}" "${CURLINE}" - echo ${VAL} | grep -q "^encpass=" 2>/dev/null - if [ $? -eq 0 ] ; then - # Found a password, return it - get_value_from_string "${VAL}" - return - fi - - export VAL="" - return -}; - -# On check on the disk-label line if we have any extra vars for this device -get_fs_line_xvars() -{ - ACTIVEDEV="${1}" - LINE="${2}" - - echo $LINE | cut -d ' ' -f 4 | grep -q '(' 2>/dev/null - if [ $? -ne 0 ] ; then return ; fi - - # See if we are looking for ZFS specific options - echo $LINE | grep -q '^ZFS' 2>/dev/null - if [ $? -eq 0 ] ; then - ZTYPE="NONE" - ZFSVARS="`echo $LINE | cut -d ' ' -f 4-20 |cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" - - echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache):" 2>/dev/null - if [ $? -eq 0 ] ; then - ZTYPE=`echo $ZFSVARS | cut -f1 -d:` - tmpVars=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"` - ZFSVARS="" - # make sure we have a '/dev' in front of the extra devices - for i in $tmpVars - do - echo $i | grep -q '/dev/' - if [ $? -ne 0 ] ; then - ZFSVARS="$ZFSVARS /dev/${i}" - else - ZFSVARS="$ZFSVARS $i" - fi - done - fi - - # Return the ZFS options - if [ "${ZTYPE}" = "NONE" ] ; then - VAR="${ACTIVEDEV} ${ZFSVARS}" - else - VAR="${ZTYPE} ${ACTIVEDEV} ${ZFSVARS}" - fi - export VAR - return - fi # End of ZFS block - - # See if we are looking for UFS specific newfs options - echo $LINE | grep -q '^UFS' 2>/dev/null - if [ $? -eq 0 ] ; then - FSVARS="`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" - VAR="${FSVARS}" - export VAR - return - fi - - # If we got here, set VAR to empty and export - export VAR="" - return -}; - -# Init each zfs mirror disk with a boot sector so we can failover -setup_zfs_mirror_parts() -{ - _nZFS="" - - ZTYPE="`echo ${1} | awk '{print $1}'`" - - # Using mirroring, setup boot partitions on each disk - _mirrline="`echo ${1} | sed 's|mirror ||g' | sed 's|raidz1 ||g' | sed 's|raidz2 ||g' | sed 's|raidz3 ||g' | sed 's|raidz ||g'`" - for _zvars in $_mirrline - do - echo "Looping through _zvars: $_zvars" >>${LOGOUT} - echo "$_zvars" | grep -q "${2}" 2>/dev/null - if [ $? -eq 0 ] ; then continue ; fi - if [ -z "$_zvars" ] ; then continue ; fi - - is_disk "$_zvars" >/dev/null 2>/dev/null - if [ $? -eq 0 ] ; then - echo "Setting up ZFS disk $_zvars" >>${LOGOUT} - init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null - rc_halt "gpart add -a 4k -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null - rc_halt "gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null - _nZFS="$_nZFS ${_zvars}p2" - else - _nZFS="$_nZFS ${_zvars}" - fi - done - echo "$ZTYPE $2 `echo $_nZFS | tr -s ' '`" -} ; - -# Function which creates a unique label name for the specified mount -gen_glabel_name() -{ - MOUNT="$1" - TYPE="$2" - NUM="0" - MAXNUM="20" - - if [ "$TYPE" = "ZFS" ] ; then - NAME="zpool" - elif [ "$MOUNT" = "/" ] ; then - NAME="rootfs" - else - # If doing a swap partition, also rename it - if [ "${TYPE}" = "SWAP" ] - then - NAME="swap" - else - NAME="`echo $MOUNT | sed 's|/||g' | sed 's| ||g'`" - fi - fi - - # Loop through and break when we find our first available label - while - Z=1 - do - glabel status | grep -q "${NAME}${NUM}" 2>/dev/null - if [ $? -ne 0 ] - then - break - else - NUM=$((NUM+1)) - fi - - if [ $NUM -gt $MAXNUM ] - then - exit_err "Cannot allocate additional glabel name for $NAME" - break - fi - done - - - export VAL="${NAME}${NUM}" -}; - -# Function to determine the size we can safely use when 0 is specified -get_autosize() -{ - # Disk tag to look for - dTag="$1" - - # Total MB Avail - get_disk_mediasize_mb "$2" - local _aSize=$VAL - - while read line - do - # Check for data on this slice - echo $line | grep -q "^${_dTag}-part=" 2>/dev/null - if [ $? -ne 0 ] ; then continue ; fi - - get_value_from_string "${line}" - STRING="$VAL" - - # Get the size of this partition - SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` - if [ $SIZE -eq 0 ] ; then continue ; fi - _aSize=`expr $_aSize - $SIZE` - done <${CFGF} - - # Pad the size a bit - _aSize=`expr $_aSize - 2` - - VAL="$_aSize" - export VAL -}; - -# Function to setup partitions using gpart -setup_gpart_partitions() -{ - local _dTag="$1" - local _pDisk="$2" - local _wSlice="$3" - local _sNum="$4" - local _pType="$5" - FOUNDPARTS="1" - USEDAUTOSIZE=0 - - # Lets read in the config file now and setup our partitions - if [ "${_pType}" = "gpt" ] ; then - CURPART="2" - elif [ "${_pType}" = "apm" ] ; then - CURPART="3" - else - PARTLETTER="a" - CURPART="1" - if [ "${_pType}" = "mbr" ] ; then - rc_halt "gpart create -s BSD ${_wSlice}" - fi - fi - - while read line - do - # Check for data on this slice - echo $line | grep -q "^${_dTag}-part=" 2>/dev/null - if [ $? -eq 0 ] - then - FOUNDPARTS="0" - # Found a slice- entry, lets get the slice info - get_value_from_string "${line}" - STRING="$VAL" - - # We need to split up the string now, and pick out the variables - FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1` - SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` - MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3` - - # Check if we have a .eli extension on this FS - echo ${FS} | grep -q ".eli" 2>/dev/null - if [ $? -eq 0 ] - then - FS="`echo ${FS} | cut -d '.' -f 1`" - ENC="ON" - check_for_enc_pass "${line}" - if [ "${VAL}" != "" ] ; then - # We have a user supplied password, save it for later - ENCPASS="${VAL}" - fi - else - ENC="OFF" - fi - - # Check if the user tried to setup / as an encrypted partition - check_for_mount "${MNT}" "/" - if [ $? -eq 0 -a "${ENC}" = "ON" ] - then - export USINGENCROOT="0" - fi - - # Now check that these values are sane - case $FS in - UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP) ;; - *) exit_err "ERROR: Invalid file system specified on $line" ;; - esac - - # Check that we have a valid size number - expr $SIZE + 1 >/dev/null 2>/dev/null - if [ $? -ne 0 ]; then - exit_err "ERROR: The size specified on $line is invalid" - fi - - # Check that the mount-point starts with / - echo "$MNT" | grep -qe "^/" -e "^none" 2>/dev/null - if [ $? -ne 0 ]; then - exit_err "ERROR: The mount-point specified on $line is invalid" - fi - - if [ "$SIZE" = "0" ] - then - if [ $USEDAUTOSIZE -eq 1 ] ; then - exit_err "ERROR: You can not have two partitions with a size of 0 specified!" - fi - case ${_pType} in - gpt|apm) get_autosize "${_dTag}" "$_pDisk" ;; - *) get_autosize "${_dTag}" "$_wSlice" ;; - esac - SOUT="-s ${VAL}M" - USEDAUTOSIZE=1 - else - SOUT="-s ${SIZE}M" - fi - - # Check if we found a valid root partition - check_for_mount "${MNT}" "/" - if [ $? -eq 0 ] ; then - export FOUNDROOT="1" - if [ "${CURPART}" = "2" -a "$_pType" = "gpt" ] ; then - export FOUNDROOT="0" - fi - if [ "${CURPART}" = "3" -a "$_pType" = "apm" ] ; then - export FOUNDROOT="0" - fi - if [ "${CURPART}" = "1" -a "$_pType" = "mbr" ] ; then - export FOUNDROOT="0" - fi - if [ "${CURPART}" = "1" -a "$_pType" = "gptslice" ] ; then - export FOUNDROOT="0" - fi - fi - - check_for_mount "${MNT}" "/boot" - if [ $? -eq 0 ] ; then - export USINGBOOTPART="0" - if [ "${CURPART}" != "2" -a "${_pType}" = "gpt" ] ; then - exit_err "/boot partition must be first partition" - fi - if [ "${CURPART}" != "3" -a "${_pType}" = "apm" ] ; then - exit_err "/boot partition must be first partition" - fi - if [ "${CURPART}" != "1" -a "${_pType}" = "mbr" ] ; then - exit_err "/boot partition must be first partition" - fi - if [ "${CURPART}" != "1" -a "${_pType}" = "gptslice" ] ; then - exit_err "/boot partition must be first partition" - fi - - if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ] ; then - exit_err "/boot partition must be formatted with UFS" - fi - fi - - # Generate a unique label name for this mount - gen_glabel_name "${MNT}" "${FS}" - PLABEL="${VAL}" - - # Get any extra options for this fs / line - if [ "${_pType}" = "gpt" ] ; then - get_fs_line_xvars "${_pDisk}p${CURPART}" "${STRING}" - elif [ "${_pType}" = "apm" ] ; then - get_fs_line_xvars "${_pDisk}s${CURPART}" "${STRING}" - else - get_fs_line_xvars "${_wSlice}${PARTLETTER}" "${STRING}" - fi - XTRAOPTS="$VAR" - - # Check if using zfs mirror - echo ${XTRAOPTS} | grep -q -e "mirror" -e "raidz" - if [ $? -eq 0 -a "$FS" = "ZFS" ] ; then - if [ "${_pType}" = "gpt" -o "${_pType}" = "gptslice" ] ; then - XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}") - elif [ "${_pType}" = "apm" ] ; then - XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}s${CURPART}") - else - XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_wSlice}${PARTLETTER}") - fi - fi - - # Figure out the gpart type to use - case ${FS} in - ZFS) PARTYPE="freebsd-zfs" ;; - SWAP) PARTYPE="freebsd-swap" ;; - *) PARTYPE="freebsd-ufs" ;; - esac - - # Create the partition - if [ "${_pType}" = "gpt" ] ; then - if [ "$CURPART" = "2" ] ; then - # If this is GPT, make sure first partition is aligned to 4k - sleep 2 - rc_halt "gpart add -a 4k ${SOUT} -t ${PARTYPE} ${_pDisk}" - else - sleep 2 - rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" - fi - elif [ "${_pType}" = "gptslice" ]; then - sleep 2 - rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}" - elif [ "${_pType}" = "apm" ]; then - sleep 2 - rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" - else - sleep 2 - rc_halt "gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}" - fi - - # Check if this is a root / boot partition, and stamp the right loader - for TESTMNT in `echo ${MNT} | sed 's|,| |g'` - do - if [ "${TESTMNT}" = "/" -a -z "${BOOTTYPE}" ] ; then - BOOTTYPE="${PARTYPE}" - fi - if [ "${TESTMNT}" = "/boot" ] ; then - BOOTTYPE="${PARTYPE}" - fi - done - - # Save this data to our partition config dir - if [ "${_pType}" = "gpt" ] ; then - _dFile="`echo $_pDisk | sed 's|/|-|g'`" - echo "${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS}" >${PARTDIR}/${_dFile}p${CURPART} - - # Clear out any headers - sleep 2 - dd if=/dev/zero of=${_pDisk}p${CURPART} count=2048 2>/dev/null - - # If we have a enc password, save it as well - if [ -n "${ENCPASS}" ] ; then - echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}p${CURPART}-encpass - fi - elif [ "${_pType}" = "apm" ] ; then - _dFile="`echo $_pDisk | sed 's|/|-|g'`" - echo "${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS}" >${PARTDIR}/${_dFile}s${CURPART} - - # Clear out any headers - sleep 2 - dd if=/dev/zero of=${_pDisk}s${CURPART} count=2048 2>/dev/null - - # If we have a enc password, save it as well - if [ -n "${ENCPASS}" ] ; then - echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}s${CURPART}-encpass - fi - else - # MBR Partition or GPT slice - _dFile="`echo $_wSlice | sed 's|/|-|g'`" - echo "${FS}#${MNT}#${ENC}#${PLABEL}#MBR#${XTRAOPTS}#${IMAGE}" >${PARTDIR}/${_dFile}${PARTLETTER} - # Clear out any headers - sleep 2 - dd if=/dev/zero of=${_wSlice}${PARTLETTER} count=2048 2>/dev/null - - # If we have a enc password, save it as well - if [ -n "${ENCPASS}" ] ; then - echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}${PARTLETTER}-encpass - fi - fi - - - # Increment our parts counter - if [ "$_pType" = "gpt" -o "$_pType" = "apm" ] ; then - CURPART=$((CURPART+1)) - # If this is a gpt/apm partition, - # we can continue and skip the MBR part letter stuff - continue - else - CURPART=$((CURPART+1)) - if [ "$CURPART" = "3" ] ; then CURPART="4" ; fi - fi - - - # This partition letter is used, get the next one - case ${PARTLETTER} in - a) PARTLETTER="b" ;; - b) PARTLETTER="d" ;; - d) PARTLETTER="e" ;; - e) PARTLETTER="f" ;; - f) PARTLETTER="g" ;; - g) PARTLETTER="h" ;; - h) PARTLETTER="ERR" ;; - *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;; - esac - - fi # End of subsection locating a slice in config - - echo $line | grep -q "^commitDiskLabel" 2>/dev/null - if [ $? -eq 0 -a "${FOUNDPARTS}" = "0" ] - then - - # If this is the boot disk, stamp the right gptboot - if [ ! -z "${BOOTTYPE}" -a "$_pType" = "gpt" ] ; then - case ${BOOTTYPE} in - freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${_pDisk}" ;; - freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_pDisk}" ;; - esac - fi - - # Make sure to stamp the MBR loader - if [ "$_pType" = "mbr" ] ; then - rc_halt "gpart bootcode -b /boot/boot ${_wSlice}" - fi - - # Found our flag to commit this label setup, check that we found at least 1 partition - if [ "${CURPART}" = "1" ] ; then - exit_err "ERROR: commitDiskLabel was called without any partition entries for it!" - fi - - break - fi - done <${CFGF} -}; - -# Reads through the config and sets up a BSDLabel for the given slice -populate_disk_label() -{ - if [ -z "${1}" ] - then - exit_err "ERROR: populate_disk_label() called without argument!" - fi - - # Set some vars from the given working slice - diskid="`echo $1 | cut -d ':' -f 1`" - disk="`echo $1 | cut -d ':' -f 1 | sed 's|-|/|g'`" - slicenum="`echo $1 | cut -d ':' -f 2`" - type="`echo $1 | cut -d ':' -f 3`" - - # Set WRKSLICE based upon format we are using - if [ "$type" = "mbr" ] ; then - wrkslice="${diskid}s${slicenum}" - fi - if [ "$type" = "apm" ] ; then - wrkslice="${diskid}s${slicenum}" - fi - if [ "$type" = "gpt" -o "$type" = "gptslice" ] ; then - wrkslice="${diskid}p${slicenum}" - fi - - if [ ! -e "${SLICECFGDIR}/${wrkslice}" ] ; then - exit_err "ERROR: Missing SLICETAG data. This shouldn't happen - please let the developers know" - fi - - disktag="`cat ${SLICECFGDIR}/${wrkslice}`" - slicedev="`echo $wrkslice | sed 's|-|/|g'`" - - # Setup the partitions with gpart - setup_gpart_partitions "${disktag}" "${disk}" "${slicedev}" "${slicenum}" "${type}" - -}; - -# Function which reads in the disk slice config, and performs it -setup_disk_label() -{ - # We are ready to start setting up the label, lets read the config and do the actions - # First confirm that we have a valid WORKINGSLICES - if [ -z "${WORKINGSLICES}" ]; then - exit_err "ERROR: No slices were setup! Please report this to the maintainers" - fi - - # Check that the slices we have did indeed get setup and gpart worked - for i in $WORKINGSLICES - do - disk="`echo $i | cut -d '-' -f 1`" - pnum="`echo $i | cut -d '-' -f 2`" - type="`echo $i | cut -d '-' -f 3`" - if [ "$type" = "mbr" -a ! -e "${disk}s${pnum}" ] ; then - exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" - fi - if [ "$type" = "gpt" -a ! -e "${disk}p${pnum}" ] ; then - exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" - fi - if [ "$type" = "apm" -a ! -e "${disk}s${pnum}" ] ; then - exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" - fi - if [ "$type" = "gptslice" -a ! -e "${disk}p${pnum}" ] ; then - exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" - fi - done - - # Setup some files which we'll be referring to - export LABELLIST="${TMPDIR}/workingLabels" - rm $LABELLIST >/dev/null 2>/dev/null - - # Set our flag to determine if we've got a valid root partition in this setup - export FOUNDROOT="-1" - - # Check if we are using a /boot partition - export USINGBOOTPART="1" - - # Set encryption on root check - export USINGENCROOT="1" - - # Make the tmp directory where we'll store FS info & mount-points - rm -rf ${PARTDIR} >/dev/null 2>/dev/null - mkdir -p ${PARTDIR} >/dev/null 2>/dev/null - rm -rf ${PARTDIR}-enc >/dev/null 2>/dev/null - mkdir -p ${PARTDIR}-enc >/dev/null 2>/dev/null - - for i in $WORKINGSLICES - do - populate_disk_label "${i}" - done - - # Check if we made a root partition - if [ "$FOUNDROOT" = "-1" ] - then - exit_err "ERROR: No root (/) partition specified!!" - fi - - # Check if we made a root partition - if [ "$FOUNDROOT" = "1" -a "${USINGBOOTPART}" != "0" ] - then - exit_err "ERROR: (/) partition isn't first partition on disk!" - fi - - if [ "${USINGENCROOT}" = "0" -a "${USINGBOOTPART}" != "0" ] - then - exit_err "ERROR: Can't encrypt (/) with no (/boot) partition!" - fi -}; - -check_fstab_mbr() -{ - local SLICE - local FSTAB - - if [ -z "$2" ] - then - return 1 - fi - - SLICE="$1" - FSTAB="$2/etc/fstab" - - if [ -f "${FSTAB}" ] - then - PARTLETTER=`echo "$SLICE" | sed -E 's|^.+([a-h])$|\1|'` - - cat "${FSTAB}" | awk '{ print $2 }' | grep -qE '^/$' 2>&1 - if [ $? -eq 0 ] - then - if [ "${PARTLETTER}" = "a" ] - then - FOUNDROOT="0" - else - FOUNDROOT="1" - fi - - ROOTIMAGE="1" - - export FOUNDROOT - export ROOTIMAGE - fi - - cat "${FSTAB}" | awk '{ print $2 }' | grep -qE '^/boot$' 2>&1 - if [ $? -eq 0 ] - then - if [ "${PARTLETTER}" = "a" ] - then - USINGBOOTPART="0" - else - exit_err "/boot partition must be first partition" - fi - export USINGBOOTPART - fi - - return 0 - fi - - return 1 -}; - -check_fstab_gpt() -{ - local SLICE - local FSTAB - - if [ -z "$2" ] - then - return 1 - fi - - SLICE="$1" - FSTAB="$2/etc/fstab" - - if [ -f "${FSTAB}" ] - then - PARTNUMBER=`echo "${SLICE}" | sed -E 's|^.+p([0-9]*)$|\1|'` - - cat "${FSTAB}" | awk '{ print $2 }' | grep -qE '^/$' 2>&1 - if [ $? -eq 0 ] - then - if [ "${PARTNUMBER}" = "2" ] - then - FOUNDROOT="0" - else - FOUNDROOT="1" - fi - - ROOTIMAGE="1" - - export FOUNDROOT - export ROOTIMAGE - fi - - cat "${FSTAB}" | awk '{ print $2 }' | grep -qE '^/boot$' 2>&1 - if [ $? -eq 0 ] - then - if [ "${PARTNUMBER}" = "2" ] - then - USINGBOOTPART="0" - else - exit_err "/boot partition must be first partition" - fi - export USINGBOOTPART - fi - - return 0 - fi - - - return 1 -}; - -check_disk_layout() -{ - local SLICES - local TYPE - local DISK - local RES - local F - - DISK="$1" - TYPE="MBR" - - if [ -z "${DISK}" ] - then - return 1 - fi - - SLICES_MBR=`ls /dev/${DISK}s[1-4]*[a-h]* 2>/dev/null` - SLICES_GPT=`ls /dev/${DISK}p[0-9]* 2>/dev/null` - SLICES_SLICE=`ls /dev/${DISK}[a-h]* 2>/dev/null` - - if [ -n "${SLICES_MBR}" ] - then - SLICES="${SLICES_MBR}" - TYPE="MBR" - RES=0 - fi - if [ -n "${SLICES_GPT}" ] - then - SLICES="${SLICES_GPT}" - TYPE="GPT" - RES=0 - fi - if [ -n "${SLICES_SLICE}" ] - then - SLICES="${SLICES_SLICE}" - TYPE="MBR" - RES=0 - fi - - for slice in ${SLICES} - do - F=1 - mount ${slice} /mnt 2>/dev/null - if [ $? -ne 0 ] - then - continue - fi - - if [ "${TYPE}" = "MBR" ] - then - check_fstab_mbr "${slice}" "/mnt" - F="$?" - - elif [ "${TYPE}" = "GPT" ] - then - check_fstab_gpt "${slice}" "/mnt" - F="$?" - fi - - if [ ${F} -eq 0 ] - then - umount /mnt - break - fi - - umount /mnt - done - - return ${RES} -}; Index: usr.sbin/pc-sysinstall/backend/functions-cleanup.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-cleanup.sh +++ /dev/null @@ -1,413 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which perform the final cleanup after an install - -# Finishes up with ZFS setup before unmounting -zfs_cleanup_unmount() -{ - # Loop through our FS and see if we have any ZFS partitions to cleanup - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - ZPOOLNAME=$(get_zpool_name "${PARTDEV}") - - if [ "$PARTFS" = "ZFS" ] - then - # Check if we have multiple zfs mounts specified - for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` - do - if [ "${ZMNT}" = "/" ] - then - # Make sure we haven't already added the zfs boot line when - # Creating a dedicated "/boot" partition - cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q "vfs.root.mountfrom=" 2>/dev/null - if [ $? -ne 0 ] ; then - echo "vfs.root.mountfrom=\"zfs:${ZPOOLNAME}/ROOT/default\"" >> ${FSMNT}/boot/loader.conf - fi - export FOUNDZFSROOT="${ZPOOLNAME}" - fi - done - FOUNDZFS="1" - fi - done - - if [ -n "${FOUNDZFS}" ] - then - # Check if we need to add our ZFS flags to rc.conf, src.conf and loader.conf - cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'zfs_load="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'zfs_load="YES"' >>${FSMNT}/boot/loader.conf - fi - cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep -q 'zfs_enable="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'zfs_enable="YES"' >>${FSMNT}/etc/rc.conf - fi - - sleep 2 - # Copy over any ZFS cache data - cp /boot/zfs/* ${FSMNT}/boot/zfs/ - - # Copy the hostid so that our zfs cache works - cp /etc/hostid ${FSMNT}/etc/hostid - fi - - # Loop through our FS and see if we have any ZFS partitions to cleanup - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - ZPOOLNAME=$(get_zpool_name "${PARTDEV}") - - if [ "$PARTFS" = "ZFS" ] - then - - # Create a list of zpool names we can export - echo $ZPOOLEXPORTS | grep -q "$ZPOOLNAME " - if [ $? -ne 0 ] ; then - export ZPOOLEXPORTS="$ZPOOLNAME $ZPOOLEXPORTS" - fi - - # Check if we have multiple zfs mounts specified - for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'` - do - ZMNT="`echo $ZMNT | cut -d '(' -f 1`" - PARTMNTREV="${ZMNT} ${PARTMNTREV}" - done - - for ZMNT in ${PARTMNTREV} - do - if [ "${ZMNT}" = "/" ] ; then continue ; fi - # Some ZFS like /swap aren't mounted, and dont need unmounting - mount | grep -q "${FSMNT}${ZMNT}" - if [ $? -eq 0 ] ; then - rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}" - rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}" - fi - sleep 2 - done - fi - done - -}; - -# Function which performs the specific setup for using a /boot partition -setup_dedicated_boot_part() -{ - ROOTFS="${1}" - ROOTFSTYPE="${2}" - BOOTFS="${3}" - BOOTMNT="${4}" - - # Set the root mount in loader.conf - echo "vfs.root.mountfrom=\"${ROOTFSTYPE}:${ROOTFS}\"" >> ${FSMNT}/boot/loader.conf - rc_halt "mkdir -p ${FSMNT}/${BOOTMNT}/boot" - rc_halt "mv ${FSMNT}/boot/* ${FSMNT}${BOOTMNT}/boot/" - rc_halt "mv ${FSMNT}${BOOTMNT}/boot ${FSMNT}/boot/" - rc_halt "umount ${BOOTFS}" - rc_halt "mount ${BOOTFS} ${FSMNT}${BOOTMNT}" - rc_halt "rmdir ${FSMNT}/boot" - - # Strip the '/' from BOOTMNT before making symlink - BOOTMNTNS="`echo ${BOOTMNT} | sed 's|/||g'`" - rc_halt "chroot ${FSMNT} ln -s ${BOOTMNTNS}/boot /boot" - -}; - -# Function which creates the /etc/fstab for the installed system -setup_fstab() -{ - FSTAB="${FSMNT}/etc/fstab" - rm ${FSTAB} >/dev/null 2>/dev/null - - # Create the header - echo "# Device Mountpoint FStype Options Dump Pass" >> ${FSTAB} - - # Loop through the partitions, and start creating /etc/fstab - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" - - # Unset EXT - EXT="" - - # Set mount options for file-systems - case $PARTFS in - UFS+J) MNTOPTS="rw,noatime,async" ;; - SWAP) MNTOPTS="sw" ;; - *) MNTOPTS="rw,noatime" ;; - esac - - - # Figure out if we are using a glabel, or the raw name for this entry - if [ -n "${PARTLABEL}" ] - then - DEVICE="label/${PARTLABEL}" - else - # Check if using encryption - if [ "${PARTENC}" = "ON" ] ; then - EXT=".eli" - fi - - if [ "${PARTFS}" = "UFS+J" ] ; then - EXT="${EXT}.journal" - fi - DEVICE="${PARTDEV}${EXT}" - fi - - - # Set our ROOTFSTYPE for loader.conf if necessary - check_for_mount "${PARTMNT}" "/" - if [ $? -eq 0 ] ; then - if [ "${PARTFS}" = "ZFS" ] ; then - ROOTFSTYPE="zfs" - ZPOOLNAME=$(get_zpool_name "${PARTDEV}") - ROOTFS="${ZPOOLNAME}/ROOT/default" - else - ROOTFS="${DEVICE}" - ROOTFSTYPE="ufs" - fi - fi - - # Only create non-zfs partitions - if [ "${PARTFS}" != "ZFS" ] - then - - # Make sure geom_journal is loaded - if [ "${PARTFS}" = "UFS+J" ] ; then - setup_gjournal - fi - - # Save the BOOTFS for call at the end - if [ "${PARTMNT}" = "/boot" ] ; then - BOOTFS="${PARTDEV}${EXT}" - BOOTMNT="${BOOT_PART_MOUNT}" - PARTMNT="${BOOTMNT}" - fi - - # Echo out the fstab entry now - if [ "${PARTFS}" = "SWAP" ] - then - echo "/dev/${DEVICE} none swap ${MNTOPTS} 0 0" >> ${FSTAB} - else - echo "/dev/${DEVICE} ${PARTMNT} ufs ${MNTOPTS} 1 1" >> ${FSTAB} - fi - - fi # End of ZFS Check - done - - # Setup some specific PC-BSD fstab options - if [ "$INSTALLTYPE" != "FreeBSD" ] - then - echo "procfs /proc procfs rw 0 0" >> ${FSTAB} - echo "linprocfs /compat/linux/proc linprocfs rw 0 0" >> ${FSTAB} - fi - - # If we have a dedicated /boot, run the post-install setup of it now - if [ ! -z "${BOOTMNT}" ] ; then - setup_dedicated_boot_part "${ROOTFS}" "${ROOTFSTYPE}" "${BOOTFS}" "${BOOTMNT}" - fi - -}; - -# Setup our disk mirroring with gmirror -setup_gmirror() -{ - cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_mirror_load="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'geom_mirror_load="YES"' >>${FSMNT}/boot/loader.conf - fi - -}; - -# Function which saves geli keys and sets up loading of them at boot -setup_geli_loading() -{ - - # Make our keys dir - mkdir -p ${FSMNT}/boot/keys >/dev/null 2>/dev/null - - cd ${GELIKEYDIR} - for KEYFILE in `ls` - do - # Figure out the partition name based on keyfile name removing .key - PART="`echo ${KEYFILE} | cut -d '.' -f 1`" - PARTDEV="`echo ${PART} | sed 's|-|/|g'`" - PARTNAME="`echo ${PART} | sed 's|-dev-||g'`" - - rc_halt "geli configure -b ${PARTDEV}" - - # If no passphrase, setup key files - if [ ! -e "${PARTDIR}-enc/${PART}-encpass" ] ; then - echo "geli_${PARTNAME}_keyfile0_load=\"YES\"" >> ${FSMNT}/boot/loader.conf - echo "geli_${PARTNAME}_keyfile0_type=\"${PARTNAME}:geli_keyfile0\"" >> ${FSMNT}/boot/loader.conf - echo "geli_${PARTNAME}_keyfile0_name=\"/boot/keys/${PARTNAME}.key\"" >> ${FSMNT}/boot/loader.conf - - # Copy the key to the disk - rc_halt "cp ${GELIKEYDIR}/${KEYFILE} ${FSMNT}/boot/keys/${PARTNAME}.key" - fi - - done - - # Make sure we have geom_eli set to load at boot - cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_eli_load="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'geom_eli_load="YES"' >>${FSMNT}/boot/loader.conf - fi - -}; - - -# Function to generate a random hostname if none was specified -gen_hostname() -{ - RAND="`jot -r 1 1 9000`" - - if [ "$INSTALLTYPE" = "FreeBSD" ] - then - VAL="freebsd-${RAND}" - else - VAL="pcbsd-${RAND}" - fi - - export VAL - -}; - -# Function which sets up the hostname for the system -setup_hostname() -{ - - get_value_from_cfg hostname - HOSTNAME="${VAL}" - - # If we don't have a hostname, make one up - if [ -z "${HOSTNAME}" ] - then - gen_hostname - HOSTNAME="${VAL}" - fi - - # Clean up any saved hostname - cat ${FSMNT}/etc/rc.conf | grep -v "hostname=" >${FSMNT}/etc/rc.conf.new - mv ${FSMNT}/etc/rc.conf.new ${FSMNT}/etc/rc.conf - - # Set the hostname now - echo_log "Setting hostname: ${HOSTNAME}" - echo "hostname=\"${HOSTNAME}\"" >> ${FSMNT}/etc/rc.conf - sed -i -e "s|my.domain|${HOSTNAME} ${HOSTNAME}|g" ${FSMNT}/etc/hosts - -}; - - -# Check and make sure geom_journal is enabled on the system -setup_gjournal() -{ - - # Make sure we have geom_journal set to load at boot - cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_journal_load="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf - fi - -}; - -# Function which sets the root password from the install config -set_root_pw() -{ - # Get the plaintext string - get_value_from_cfg_with_spaces rootPass - local PW="${VAL}" - - # Get the encrypted string - get_value_from_cfg_with_spaces rootEncPass - local ENCPW="${VAL}" - - # If we don't have a root pass, return - if [ -z "${PW}" -a -z "${ENCPW}" ] ; then return 0 ; fi - - echo_log "Setting root password" - - # Check if setting plaintext password - if [ -n "${PW}" ] ; then - echo "${PW}" > ${FSMNT}/.rootpw - run_chroot_cmd "cat /.rootpw | pw usermod root -h 0" - rc_halt "rm ${FSMNT}/.rootpw" - fi - - # Check if setting encrypted password - if [ -n "${ENCPW}" ] ; then - echo "${ENCPW}" > ${FSMNT}/.rootpw - run_chroot_cmd "cat /.rootpw | pw usermod root -H 0" - rc_halt "rm ${FSMNT}/.rootpw" - fi - -}; - - -run_final_cleanup() -{ - # Check if we need to run any gmirror setup - ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null - if [ $? -eq 0 ] - then - # Lets setup gmirror now - setup_gmirror - fi - - # Check if we need to save any geli keys - ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null - if [ $? -eq 0 ] - then - # Lets setup geli loading - setup_geli_loading - fi - - # Set a hostname on the install system - setup_hostname - - # Set the root_pw if it is specified - set_root_pw - - # Generate the fstab for the installed system - setup_fstab -}; Index: usr.sbin/pc-sysinstall/backend/functions-disk.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-disk.sh +++ /dev/null @@ -1,910 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions related to disk operations using gpart - -# See if device is a full disk or partition/slice -is_disk() -{ - for _dsk in `sysctl -n kern.disks` - do - [ "$_dsk" = "${1}" ] && return 0 - [ "/dev/$_dsk" = "${1}" ] && return 0 - done - - return 1 -} - -# Get a MBR partitions sysid -get_partition_sysid_mbr() -{ - INPART="0" - DISK="$1" - PARTNUM=`echo ${2} | sed "s|${DISK}s||g"` - fdisk ${DISK} >${TMPDIR}/disk-${DISK} 2>/dev/null - while read i - do - echo "$i" | grep -q "The data for partition" 2>/dev/null - if [ $? -eq 0 ] ; then - INPART="0" - PART="`echo ${i} | cut -d ' ' -f 5`" - if [ "$PART" = "$PARTNUM" ] ; then - INPART="1" - fi - fi - - # In the partition section - if [ "$INPART" = "1" ] ; then - echo "$i" | grep -q "^sysid" 2>/dev/null - if [ $? -eq 0 ] ; then - SYSID="`echo ${i} | tr -s '\t' ' ' | cut -d ' ' -f 2`" - break - fi - - fi - - done < ${TMPDIR}/disk-${DISK} - rm ${TMPDIR}/disk-${DISK} - - export VAL="${SYSID}" -}; - -# Get the partitions MBR label -get_partition_label_mbr() -{ - INPART="0" - DISK="$1" - PARTNUM=`echo ${2} | sed "s|${DISK}s||g"` - fdisk ${DISK} >${TMPDIR}/disk-${DISK} 2>/dev/null - while read i - do - echo "$i" | grep -q "The data for partition" 2>/dev/null - if [ $? -eq 0 ] ; then - INPART="0" - PART="`echo ${i} | cut -d ' ' -f 5`" - if [ "$PART" = "$PARTNUM" ] ; then - INPART="1" - fi - fi - - # In the partition section - if [ "$INPART" = "1" ] ; then - echo "$i" | grep -q "^sysid" 2>/dev/null - if [ $? -eq 0 ] ; then - LABEL="`echo ${i} | tr -s '\t' ' ' | cut -d ',' -f 2-10`" - break - fi - - fi - - done < ${TMPDIR}/disk-${DISK} - rm ${TMPDIR}/disk-${DISK} - - export VAL="${LABEL}" -}; - -# Get a GPT partitions label -get_partition_label_gpt() -{ - DISK="${1}" - PARTNUM=`echo ${2} | sed "s|${DISK}p||g"` - - gpart show ${DISK} >${TMPDIR}/disk-${DISK} - while read i - do - SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`" - if [ "${SLICE}" = "${PARTNUM}" ] ; then - LABEL="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 4`" - break - fi - done <${TMPDIR}/disk-${DISK} - rm ${TMPDIR}/disk-${DISK} - - export VAL="${LABEL}" -}; - -# Get a partitions startblock -get_partition_startblock() -{ - DISK="${1}" - PARTNUM=`echo ${2} | sed "s|${DISK}p||g" | sed "s|${DISK}s||g"` - - gpart show ${DISK} >${TMPDIR}/disk-${DISK} - while read i - do - SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`" - if [ "$SLICE" = "${PARTNUM}" ] ; then - SB="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 1`" - break - fi - done <${TMPDIR}/disk-${DISK} - rm ${TMPDIR}/disk-${DISK} - - export VAL="${SB}" -}; - -# Get a partitions blocksize -get_partition_blocksize() -{ - DISK="${1}" - PARTNUM=`echo ${2} | sed "s|${DISK}p||g" | sed "s|${DISK}s||g"` - - gpart show ${DISK} >${TMPDIR}/disk-${DISK} - while read i - do - SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`" - if [ "$SLICE" = "${PARTNUM}" ] ; then - BS="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 2`" - break - fi - done <${TMPDIR}/disk-${DISK} - rm ${TMPDIR}/disk-${DISK} - - export VAL="${BS}" -}; - -# Function which returns the partitions on a target disk -get_disk_partitions() -{ - gpart show ${1} >/dev/null 2>/dev/null - if [ $? -ne 0 ] ; then - export VAL="" - return - fi - - type=`gpart show ${1} | awk '/^=>/ { printf("%s",$5); }'` - - SLICES="`gpart show ${1} | grep -v ${1} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 4 | sed '/^$/d'`" - for i in ${SLICES} - do - case $type in - MBR) name="${1}s${i}" ;; - GPT) name="${1}p${i}";; - *) name="${1}s${i}";; - esac - if [ -z "${RSLICES}" ] - then - RSLICES="${name}" - else - RSLICES="${RSLICES} ${name}" - fi - done - - export VAL="${RSLICES}" -}; - -# Function which returns a target disks cylinders -get_disk_cyl() -{ - cyl=`diskinfo -v ${1} | grep "# Cylinders" | tr -s ' ' | cut -f 2` - export VAL="${cyl}" -}; - -# Function which returns a target disks sectors -get_disk_sectors() -{ - sec=`diskinfo -v ${1} | grep "# Sectors" | tr -s ' ' | cut -f 2` - export VAL="${sec}" -}; - -# Function which returns a target disks heads -get_disk_heads() -{ - head=`diskinfo -v ${1} | grep "# Heads" | tr -s ' ' | cut -f 2` - export VAL="${head}" -}; - -# Function which returns a target disks mediasize in sectors -get_disk_mediasize() -{ - mediasize=`diskinfo -v ${1} | grep "# mediasize in sectors" | tr -s ' ' | cut -f 2` - export VAL="${mediasize}" -}; - -# Function which returns a target disks mediasize in megabytes -get_disk_mediasize_mb() -{ - mediasize=`diskinfo -v ${1} | grep "# mediasize in bytes" | tr -s ' ' | cut -f 2` - mediasize=`expr $mediasize / 1024` - mediasize=`expr $mediasize / 1024` - export VAL="${mediasize}" -}; - -# Function to delete all gparts before starting an install -delete_all_gpart() -{ - echo_log "Deleting all gparts" - local DISK="$1" - - # Check for any swaps to stop - for i in `swapctl -l | grep "$DISK" | awk '{print $1}'` - do - swapoff ${i} >/dev/null 2>/dev/null - done - - # Delete the gparts now - for i in `gpart show ${DISK} 2>/dev/null | tr -s ' ' | cut -d ' ' -f 4` - do - if [ "/dev/${i}" != "${DISK}" -a "${i}" != "-" ] ; then - rc_nohalt "gpart delete -i ${i} ${DISK}" - fi - done - - # Destroy the disk geom - rc_nohalt "gpart destroy ${DISK}" - - wipe_metadata "${DISK}" -}; - -# Function to export all zpools before starting an install -stop_all_zfs() -{ - if [ ! -c /dev/zfs ]; then - return; - fi - local DISK="`echo ${1} | sed 's|/dev/||g'`" - - # Export any zpools using this device so we can overwrite - for i in `zpool list -H -o name` - do - ztst=`zpool status ${i} | grep "ONLINE" | awk '{print $1}' | grep -q ${DISK}` - if [ "$ztst" = "$DISK" ] ; then - zpool export -f ${i} - fi - done -}; - -# Function which stops all gmirrors before doing any disk manipulation -stop_all_gmirror() -{ - if [ ! -d /dev/mirror ]; then - return; - fi - local DISK="`echo ${1} | sed 's|/dev/||g'`" - GPROV="`gmirror list | grep ". Name: mirror/" | cut -d '/' -f 2`" - for gprov in $GPROV - do - gmirror list | grep -q "Name: ${DISK}" 2>/dev/null - if [ $? -eq 0 ] - then - echo_log "Stopping mirror $gprov $DISK" - rc_nohalt "gmirror remove $gprov $DISK" - wipe_metadata "${DISK}" - fi - done -}; - -# Make sure we don't have any geli providers active on this disk -stop_all_geli() -{ - local _geld="`echo ${1} | sed 's|/dev/||g'`" - cd /dev - - for i in `ls ${_geld}*` - do - echo $i | grep -q '.eli' 2>/dev/null - if [ $? -eq 0 ] - then - echo_log "Detaching GELI on ${i}" - rc_halt "geli detach ${i}" - fi - done - -}; - -# Function which reads in the disk slice config, and performs it -setup_disk_slice() -{ - - # Cleanup any slice / mirror dirs - rm -rf ${SLICECFGDIR} >/dev/null 2>/dev/null - mkdir ${SLICECFGDIR} - rm -rf ${MIRRORCFGDIR} >/dev/null 2>/dev/null - mkdir ${MIRRORCFGDIR} - - # Start with disk0 and gm0 - disknum="0" - gmnum="0" - - # We are ready to start setting up the disks, lets read the config and do the actions - while read line - do - echo $line | grep -q "^disk${disknum}=" 2>/dev/null - if [ $? -eq 0 ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - DISK="$VAL" - - echo "${DISK}" | grep -q '^/dev/' - if [ $? -ne 0 ] ; then DISK="/dev/$DISK" ; fi - - # Before we go further, lets confirm this disk really exists - if [ ! -e "${DISK}" ] ; then - exit_err "ERROR: The disk ${DISK} does not exist!" - fi - - # Make sure we stop any gmirrors on this disk - stop_all_gmirror ${DISK} - - # Make sure we stop any geli stuff on this disk - stop_all_geli ${DISK} - - # Make sure we don't have any zpools loaded - stop_all_zfs ${DISK} - - fi - - # Lets look if this device will be mirrored on another disk - echo $line | grep -q "^mirror=" 2>/dev/null - if [ $? -eq 0 ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - MIRRORDISK="$VAL" - echo "${MIRRORDISK}" | grep -q '^/dev/' - if [ $? -ne 0 ] ; then MIRRORDISK="/dev/$MIRRORDISK" ; fi - - # Before we go further, lets confirm this disk really exists - if [ ! -e "${MIRRORDISK}" ] - then - exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!" - fi - - # Make sure we stop any gmirrors on this mirror disk - stop_all_gmirror ${MIRRORDISK} - - # Make sure we stop any geli stuff on this mirror disk - stop_all_geli ${MIRRORDISK} - - # Make sure we don't have any zpools mirror loaded - stop_all_zfs ${MIRRORDISK} - - fi - - # Lets see if we have been given a mirror balance choice - echo $line | grep -q "^mirrorbal=" 2>/dev/null - if [ $? -eq 0 ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - MIRRORBAL="$VAL" - fi - - echo $line | grep -q "^partition=" 2>/dev/null - if [ $? -eq 0 ] - then - # Found a partition= entry, lets read / set it - get_value_from_string "${line}" - strip_white_space "$VAL" - PTYPE=`echo $VAL|tr A-Z a-z` - - # We are using free space, figure out the slice number - if [ "${PTYPE}" = "free" ] - then - # Lets figure out what number this slice will be - LASTSLICE="`gpart show ${DISK} \ - | grep -v ${DISK} \ - | grep -v ' free' \ - | tr -s '\t' ' ' \ - | cut -d ' ' -f 4 \ - | sed '/^$/d' \ - | tail -n 1`" - - if [ -z "${LASTSLICE}" ] - then - LASTSLICE="1" - else - LASTSLICE=$((LASTSLICE+1)) - fi - - if [ $LASTSLICE -gt 4 ] - then - exit_err "ERROR: BSD only supports primary partitions, and there are none available on $DISK" - fi - - fi - fi - - # Check if we have an image file defined - echo $line | grep -q "^image=" 2>/dev/null - if [ $? -eq 0 ] ; then - # Found an image= entry, lets read / set it - get_value_from_string "${line}" - strip_white_space "$VAL" - IMAGE="$VAL" - if [ ! -f "$IMAGE" ] ; then - exit_err "$IMAGE file does not exist" - fi - fi - - # Check if we have a partscheme specified - echo $line | grep -q "^partscheme=" 2>/dev/null - if [ $? -eq 0 ] ; then - # Found a partscheme= entry, lets read / set it - get_value_from_string "${line}" - strip_white_space "$VAL" - PSCHEME="$VAL" - if [ "$PSCHEME" != "GPT" -a "$PSCHEME" != "MBR" ] ; then - exit_err "Unknown partition scheme: $PSCHEME" - fi - fi - - echo $line | grep -q "^bootManager=" 2>/dev/null - if [ $? -eq 0 ] - then - # Found a bootManager= entry, lets read /set it - get_value_from_string "${line}" - strip_white_space "$VAL" - BMANAGER="$VAL" - fi - - echo $line | grep -q "^commitDiskPart" 2>/dev/null - if [ $? -eq 0 ] - then - # Found our flag to commit this disk setup / lets do sanity check and do it - if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ] - then - # Make sure we are only installing ppc to full disk - if [ `uname -m` = "powerpc" -o `uname -m` = "powerpc64" ]; then - if [ "$PTYPE" != "all" ] ; then - exit_err "powerpc can only be installed to a full disk" - fi - fi - - case ${PTYPE} in - all) - # If we have a gmirror, lets set it up - if [ -n "$MIRRORDISK" ]; then - # Default to round-robin if the user didn't specify - if [ -z "$MIRRORBAL" ]; then MIRRORBAL="round-robin" ; fi - - _mFile=`echo $DISK | sed 's|/|%|g'` - echo "$MIRRORDISK:$MIRRORBAL:gm${gmnum}" >${MIRRORCFGDIR}/$_mFile - init_gmirror "$gmnum" "$MIRRORBAL" "$DISK" "$MIRRORDISK" - - # Reset DISK to the gmirror device - DISK="/dev/mirror/gm${gmnum}" - gmnum=$((gmknum+1)) - fi - - if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then - PSCHEME="MBR" - tmpSLICE="${DISK}s1" - else - tmpSLICE="${DISK}p1" - fi - - if [ `uname -m` = "powerpc" -o `uname -m` = "powerpc64" ] - then - PSCHEME="APM" - tmpSLICE="${DISK}s1" - fi - - run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" - ;; - - s1|s2|s3|s4) - tmpSLICE="${DISK}${PTYPE}" - # Get the number of the slice we are working on - s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" - run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" - ;; - - p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20) - tmpSLICE="${DISK}${PTYPE}" - # Get the number of the gpt partition we are working on - s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" - run_gpart_gpt_part "${DISK}" "${BMANAGER}" "${s}" - ;; - - free) - tmpSLICE="${DISK}s${LASTSLICE}" - run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" - ;; - - image) - if [ -z "${IMAGE}" ] - then - exit_err "ERROR: partition type image specified with no image!" - fi - ;; - - *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;; - esac - - - if [ -n "${IMAGE}" ] - then - local DEST - - if [ -n "${tmpSLICE}" ] - then - DEST="${tmpSLICE}" - else - DEST="${DISK}" - fi - - write_image "${IMAGE}" "${DEST}" - check_disk_layout "${DEST}" - fi - - # Now save which disk this is, so we can parse it later during slice partition setup - if [ -z "${IMAGE}" ] - then - _sFile=`echo $tmpSLICE | sed 's|/|-|g'` - echo "disk${disknum}" >${SLICECFGDIR}/$_sFile - fi - - # Increment our disk counter to look for next disk and unset - unset BMANAGER PTYPE DISK MIRRORDISK MIRRORBAL PSCHEME IMAGE - disknum=$((disknum+1)) - else - exit_err "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" - fi - fi - - done <${CFGF} - -}; - - -# Init the gmirror device -init_gmirror() -{ - local _mNum=$1 - local _mBal=$2 - local _mDisk=$3 - - # Create this mirror device - rc_halt "gmirror label -vb ${_mBal} gm${_mNum} ${_mDisk}" - - sleep 3 - -} - -# Stop all gjournals on disk / slice -stop_gjournal() -{ - _gdsk="`echo $1 | sed 's|/dev/||g'`" - # Check if we need to shutdown any journals on this drive - ls /dev/${_gdsk}*.journal >/dev/null 2>/dev/null - if [ $? -eq 0 ] - then - cd /dev - for i in `ls ${_gdsk}*.journal` - do - rawjournal="`echo ${i} | cut -d '.' -f 1`" - gjournal stop -f ${rawjournal} >>${LOGOUT} 2>>${LOGOUT} - gjournal clear ${rawjournal} >>${LOGOUT} 2>>${LOGOUT} - done - fi -} ; - - -# Function to wipe the potential metadata from a disk -wipe_metadata() -{ - echo_log "Wiping possible metadata on ${1}" - local SIZE="`diskinfo ${1} | awk '{print int($3/(1024*1024)) }'`" - if [ "$SIZE" -gt "5" ] ; then - rc_halt "dd if=/dev/zero of=${1} bs=1m count=1" - rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=$((SIZE-4))" - else - rc_nohalt "dd if=/dev/zero of=${1} bs=128k" - fi -} ; - -# Function which runs gpart and creates a single large APM partition scheme -init_apm_full_disk() -{ - _intDISK=$1 - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - # Stop any journaling - stop_gjournal "${_intDISK}" - - # Remove any existing partitions - delete_all_gpart "${_intDISK}" - - sleep 2 - - echo_log "Running gpart on ${_intDISK}" - rc_halt "gpart create -s APM ${_intDISK}" - rc_halt "gpart add -s 800k -t freebsd-boot ${_intDISK}" - - echo_log "Stamping boot sector on ${_intDISK}" - rc_halt "gpart bootcode -p /boot/boot1.hfs -i 1 ${_intDISK}" - -} - -# Function which runs gpart and creates a single large GPT partition scheme -init_gpt_full_disk() -{ - _intDISK=$1 - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - # Stop any journaling - stop_gjournal "${_intDISK}" - - # Remove any existing partitions - delete_all_gpart "${_intDISK}" - - sleep 2 - - echo_log "Running gpart on ${_intDISK}" - rc_halt "gpart create -s GPT ${_intDISK}" - rc_halt "gpart add -b 34 -s 128 -t freebsd-boot ${_intDISK}" - - echo_log "Stamping boot sector on ${_intDISK}" - rc_halt "gpart bootcode -b /boot/pmbr ${_intDISK}" - -} - -# Function which runs gpart and creates a single large MBR partition scheme -init_mbr_full_disk() -{ - _intDISK=$1 - _intBOOT=$2 - - startblock="2016" - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - # Stop any journaling - stop_gjournal "${_intDISK}" - - # Remove any existing partitions - delete_all_gpart "${_intDISK}" - - sleep 2 - - echo_log "Running gpart on ${_intDISK}" - rc_halt "gpart create -s mbr -f active ${_intDISK}" - - # Install new partition setup - echo_log "Running gpart add on ${_intDISK}" - rc_halt "gpart add -a 4k -t freebsd -i 1 ${_intDISK}" - sleep 2 - - wipe_metadata "${_intDISK}s1" - - # Make the partition active - rc_halt "gpart set -a active -i 1 ${_intDISK}" - - if [ "$_intBOOT" = "bsd" ] ; then - echo_log "Stamping boot0 on ${_intDISK}" - rc_halt "gpart bootcode -b /boot/boot0 ${_intDISK}" - else - echo_log "Stamping boot1 on ${_intDISK}" - rc_halt "gpart bootcode -b /boot/boot1 ${_intDISK}" - fi - -} - -# Function which runs gpart and creates a single large slice -run_gpart_full() -{ - DISK=$1 - BOOT=$2 - SCHEME=$3 - - if [ "$SCHEME" = "APM" ] ; then - init_apm_full_disk "$DISK" - slice=`echo "${DISK}:1:apm" | sed 's|/|-|g'` - elif [ "$SCHEME" = "MBR" ] ; then - init_mbr_full_disk "$DISK" "$BOOT" - slice=`echo "${DISK}:1:mbr" | sed 's|/|-|g'` - else - init_gpt_full_disk "$DISK" - slice=`echo "${DISK}:1:gpt" | sed 's|/|-|g'` - fi - - # Lets save our slice, so we know what to look for in the config file later on - if [ -z "$WORKINGSLICES" ] - then - WORKINGSLICES="${slice}" - export WORKINGSLICES - else - WORKINGSLICES="${WORKINGSLICES} ${slice}" - export WORKINGSLICES - fi -}; - -# Function which runs gpart on a specified gpt partition -run_gpart_gpt_part() -{ - DISK=$1 - - # Set the slice we will use later - slice="${1}p${3}" - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - # Get the number of the slice we are working on - slicenum="$3" - - # Stop any journaling - stop_gjournal "${slice}" - - # Make sure we have disabled swap on this drive - if [ -e "${slice}b" ] - then - swapoff ${slice}b >/dev/null 2>/dev/null - swapoff ${slice}b.eli >/dev/null 2>/dev/null - fi - - # Modify partition type - echo_log "Running gpart modify on ${DISK}" - rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" - sleep 2 - - wipe_metadata "${slice}" - - sleep 4 - - # Init the MBR partition - rc_halt "gpart create -s BSD ${DISK}p${slicenum}" - - # Stamp the bootloader - sleep 4 - rc_halt "gpart bootcode -b /boot/boot ${DISK}p${slicenum}" - - # Set the slice to the format we'll be using for gpart later - slice=`echo "${1}:${3}:gptslice" | sed 's|/|-|g'` - - # Lets save our slice, so we know what to look for in the config file later on - if [ -z "$WORKINGSLICES" ] - then - WORKINGSLICES="${slice}" - export WORKINGSLICES - else - WORKINGSLICES="${WORKINGSLICES} ${slice}" - export WORKINGSLICES - fi -}; - -# Function which runs gpart on a specified s1-4 slice -run_gpart_slice() -{ - DISK=$1 - if [ -n "$2" ] - then - BMANAGER="$2" - fi - - # Set the slice we will use later - slice="${1}s${3}" - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - # Get the number of the slice we are working on - slicenum="$3" - - # Stop any journaling - stop_gjournal "${slice}" - - # Make sure we have disabled swap on this drive - if [ -e "${slice}b" ] - then - swapoff ${slice}b >/dev/null 2>/dev/null - swapoff ${slice}b.eli >/dev/null 2>/dev/null - fi - - # Modify partition type - echo_log "Running gpart modify on ${DISK}" - rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" - sleep 2 - - wipe_metadata "${slice}" - - sleep 1 - - if [ "${BMANAGER}" = "bsd" ] - then - echo_log "Stamping boot sector on ${DISK}" - rc_halt "gpart bootcode -b /boot/boot0 ${DISK}" - fi - - # Set the slice to the format we'll be using for gpart later - slice=`echo "${1}:${3}:mbr" | sed 's|/|-|g'` - - # Lets save our slice, so we know what to look for in the config file later on - if [ -z "$WORKINGSLICES" ] - then - WORKINGSLICES="${slice}" - export WORKINGSLICES - else - WORKINGSLICES="${WORKINGSLICES} ${slice}" - export WORKINGSLICES - fi -}; - -# Function which runs gpart and creates a new slice from free disk space -run_gpart_free() -{ - DISK=$1 - SLICENUM=$2 - if [ -n "$3" ] - then - BMANAGER="$3" - fi - - # Set our sysctl so we can overwrite any geom using drives - sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} - - slice="${DISK}s${SLICENUM}" - slicenum="${SLICENUM}" - - # Working on the first slice, make sure we have MBR setup - gpart show ${DISK} >/dev/null 2>/dev/null - if [ $? -ne 0 -a "$SLICENUM" = "1" ] ; then - echo_log "Initializing disk, no existing MBR setup" - rc_halt "gpart create -s mbr ${DISK}" - fi - - # Install new partition setup - echo_log "Running gpart on ${DISK}" - rc_halt "gpart add -a 4k -t freebsd -i ${slicenum} ${DISK}" - sleep 2 - - wipe_metadata "${slice}" - - sleep 1 - - if [ "${BMANAGER}" = "bsd" ] - then - echo_log "Stamping boot sector on ${DISK}" - rc_halt "gpart bootcode -b /boot/boot0 ${DISK}" - fi - - slice=`echo "${DISK}:${SLICENUM}:mbr" | sed 's|/|-|g'` - # Lets save our slice, so we know what to look for in the config file later on - if [ -z "$WORKINGSLICES" ] - then - WORKINGSLICES="${slice}" - export WORKINGSLICES - else - WORKINGSLICES="${WORKINGSLICES} ${slice}" - export WORKINGSLICES - fi -}; Index: usr.sbin/pc-sysinstall/backend/functions-extractimage.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-extractimage.sh +++ /dev/null @@ -1,554 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which perform the extraction / installation of system to disk - -. ${BACKEND}/functions-mountoptical.sh - -# Performs the extraction of data to disk from FreeBSD dist files -start_extract_dist() -{ - if [ -z "$1" ] ; then exit_err "Called dist extraction with no directory set!"; fi - if [ -z "$INSFILE" ]; then exit_err "Called extraction with no install file set!"; fi - local DDIR="$1" - - # Check if we are doing an upgrade, and if so use our exclude list - if [ "${INSTALLMODE}" = "upgrade" ]; then - TAROPTS="-X ${PROGDIR}/conf/exclude-from-upgrade" - else - TAROPTS="" - fi - - # Loop though and extract dist files - for di in $INSFILE - do - # Check the MANIFEST see if we have an archive size / count - if [ -e "${DDIR}/MANIFEST" ]; then - count=`grep "^${di}.txz" ${DDIR}/MANIFEST | awk '{print $3}'` - if [ ! -z "$count" ] ; then - echo "INSTALLCOUNT: $count" - fi - fi - echo_log "pc-sysinstall: Starting Extraction (${di})" - tar -xpv -C ${FSMNT} -f ${DDIR}/${di}.txz ${TAROPTS} >&1 2>&1 - if [ $? -ne 0 ]; then - exit_err "ERROR: Failed extracting the dist file: $di" - fi - done - - # Check if this was a FTP download and clean it up now - if [ "${INSTALLMEDIUM}" = "ftp" ]; then - echo_log "Cleaning up downloaded archives" - rm -rf ${DDIR} - fi - - echo_log "pc-sysinstall: Extraction Finished" -} - -# Performs the extraction of data to disk from a uzip or tar archive -start_extract_uzip_tar() -{ - if [ -z "$INSFILE" ]; then - exit_err "ERROR: Called extraction with no install file set!" - fi - - # Check if we have a .count file, and echo it out for a front-end to use in progress bars - if [ -e "${INSFILE}.count" ]; then - echo "INSTALLCOUNT: `cat ${INSFILE}.count`" - fi - - # Check if we are doing an upgrade, and if so use our exclude list - if [ "${INSTALLMODE}" = "upgrade" ]; then - TAROPTS="-X ${PROGDIR}/conf/exclude-from-upgrade" - else - TAROPTS="" - fi - - echo_log "pc-sysinstall: Starting Extraction" - - case ${PACKAGETYPE} in - uzip) - if ! kldstat -v | grep -q "geom_uzip" ; then - exit_err "Kernel module geom_uzip not loaded" - fi - - # Start by mounting the uzip image - MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}` - mkdir -p ${FSMNT}.uzip - mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip - if [ $? -ne 0 ] - then - exit_err "ERROR: Failed mounting the ${INSFILE}" - fi - cd ${FSMNT}.uzip - - # Copy over all the files now! - tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log - if [ $? -ne 0 ] - then - cd / - echo "TAR failure occurred:" >>${LOGOUT} - cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT} - umount ${FSMNT}.uzip - mdconfig -d -u ${MDDEVICE} - exit_err "ERROR: Failed extracting the tar image" - fi - - # All finished, now lets umount and cleanup - cd / - umount ${FSMNT}.uzip - mdconfig -d -u ${MDDEVICE} - ;; - tar) - tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1 - if [ $? -ne 0 ]; then - exit_err "ERROR: Failed extracting the tar image" - fi - ;; - esac - - # Check if this was a FTP download and clean it up now - if [ "${INSTALLMEDIUM}" = "ftp" ] - then - echo_log "Cleaning up downloaded archive" - rm ${INSFILE} - rm ${INSFILE}.count >/dev/null 2>/dev/null - rm ${INSFILE}.md5 >/dev/null 2>/dev/null - fi - - echo_log "pc-sysinstall: Extraction Finished" - -}; - -# Performs the extraction of data to disk from a directory with split files -start_extract_split() -{ - if [ -z "${INSDIR}" ] - then - exit_err "ERROR: Called extraction with no install directory set!" - fi - - echo_log "pc-sysinstall: Starting Extraction" - - # Used by install.sh - DESTDIR="${FSMNT}" - export DESTDIR - - HERE=`pwd` - DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'` - for dir in ${DIRS} - do - cd "${dir}" - if [ -f "install.sh" ] - then - echo_log "Extracting" `basename ${dir}` - echo "y" | sh install.sh >/dev/null - if [ $? -ne 0 ] - then - exit_err "ERROR: Failed extracting ${dir}" - fi - else - exit_err "ERROR: ${dir}/install.sh does not exist" - fi - done - cd "${HERE}" - - KERNELS=`ls -d ${INSDIR}/*|grep kernels` - cd "${KERNELS}" - if [ -f "install.sh" ] - then - echo_log "Extracting" `basename ${KERNELS}` - echo "y" | sh install.sh generic >/dev/null - if [ $? -ne 0 ] - then - exit_err "ERROR: Failed extracting ${KERNELS}" - fi - rm -rf "${FSMNT}/boot/kernel" - mv "${FSMNT}/boot/GENERIC" "${FSMNT}/boot/kernel" - else - exit_err "ERROR: ${KERNELS}/install.sh does not exist" - fi - cd "${HERE}" - - SOURCE=`ls -d ${INSDIR}/*|grep src` - cd "${SOURCE}" - if [ -f "install.sh" ] - then - echo_log "Extracting" `basename ${SOURCE}` - echo "y" | sh install.sh all >/dev/null - if [ $? -ne 0 ] - then - exit_err "ERROR: Failed extracting ${SOURCE}" - fi - else - exit_err "ERROR: ${SOURCE}/install.sh does not exist" - fi - cd "${HERE}" - - echo_log "pc-sysinstall: Extraction Finished" -}; - -# Function which will attempt to fetch the dist file(s) before we start -fetch_dist_file() -{ - get_value_from_cfg ftpPath - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" - fi - - FTPPATH="${VAL}" - - # Check if we have a /usr partition to save the download - if [ -d "${FSMNT}/usr" ] - then - DLDIR="${FSMNT}/usr/.fetch.$$" - else - DLDIR="${FSMNT}/.fetch.$$" - fi - mkdir -p ${DLDIR} - - # Do the fetch of the dist archive(s) now - for di in $INSFILE - do - fetch_file "${FTPPATH}/${di}.txz" "${DLDIR}/${di}.txz" "1" - done - - # Check to see if there is a MANIFEST file for this install - fetch_file "${FTPPATH}/MANIFEST" "${DLDIR}/MANIFEST" "0" - - export DLDIR -}; - -# Function which will attempt to fetch the install file before we start -# the install -fetch_install_file() -{ - get_value_from_cfg ftpPath - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" - fi - - FTPPATH="${VAL}" - - # Check if we have a /usr partition to save the download - if [ -d "${FSMNT}/usr" ] - then - OUTFILE="${FSMNT}/usr/.fetch-${INSFILE}" - else - OUTFILE="${FSMNT}/.fetch-${INSFILE}" - fi - - # Do the fetch of the archive now - fetch_file "${FTPPATH}/${INSFILE}" "${OUTFILE}" "1" - - # Check to see if there is a .count file for this install - fetch_file "${FTPPATH}/${INSFILE}.count" "${OUTFILE}.count" "0" - - # Check to see if there is a .md5 file for this install - fetch_file "${FTPPATH}/${INSFILE}.md5" "${OUTFILE}.md5" "0" - - # Done fetching, now reset the INSFILE to our downloaded archived - export INSFILE="${OUTFILE}" - -}; - -# Function which will download freebsd install files -fetch_split_files() -{ - get_ftpHost - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" - fi - FTPHOST="${VAL}" - - get_ftpDir - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" - fi - FTPDIR="${VAL}" - - # Check if we have a /usr partition to save the download - if [ -d "${FSMNT}/usr" ] - then - OUTFILE="${FSMNT}/usr/.fetch-${INSFILE}" - else - OUTFILE="${FSMNT}/.fetch-${INSFILE}" - fi - - DIRS="base catpages dict doc info manpages proflibs kernels src" - if [ "${FBSD_ARCH}" = "amd64" ] - then - DIRS="${DIRS} lib32" - fi - - for d in ${DIRS} - do - mkdir -p "${OUTFILE}/${d}" - done - - - NETRC="${OUTFILE}/.netrc" - cat <"${NETRC}" -machine ${FTPHOST} -login anonymous -password anonymous -macdef INSTALL -bin -prompt -EOF - - for d in ${DIRS} - do - cat <>"${NETRC}" -cd ${FTPDIR}/${d} -lcd ${OUTFILE}/${d} -mreget * -EOF - done - - cat <>"${NETRC}" -bye - - -EOF - - # Fetch the files via ftp - echo "$ INSTALL" | ftp -N "${NETRC}" "${FTPHOST}" - - # Done fetching, now reset the INSFILE to our downloaded archived - export INSFILE="${OUTFILE}" -} - -# Function which does the rsync download from the server specified in cfg -start_rsync_copy() -{ - # Load our rsync config values - get_value_from_cfg rsyncPath - if [ -z "${VAL}" ]; then - exit_err "ERROR: rsyncPath is unset! Please check your config and try again." - fi - export RSYNCPATH="${VAL}" - - get_value_from_cfg rsyncHost - if [ -z "${VAL}" ]; then - exit_err "ERROR: rsyncHost is unset! Please check your config and try again." - fi - export RSYNCHOST="${VAL}" - - get_value_from_cfg rsyncUser - if [ -z "${VAL}" ]; then - exit_err "ERROR: rsyncUser is unset! Please check your config and try again." - fi - export RSYNCUSER="${VAL}" - - get_value_from_cfg rsyncPort - if [ -z "${VAL}" ]; then - exit_err "ERROR: rsyncPort is unset! Please check your config and try again." - fi - export RSYNCPORT="${VAL}" - - COUNT=1 - while - z=1 - do - if [ ${COUNT} -gt ${RSYNCTRIES} ] - then - exit_err "ERROR: Failed rsync command!" - break - fi - - rsync -avvzHsR \ - --rsync-path="rsync --fake-super" \ - -e "ssh -p ${RSYNCPORT}" \ - ${RSYNCUSER}@${RSYNCHOST}:${RSYNCPATH}/./ ${FSMNT} - if [ $? -ne 0 ] - then - echo "Rsync failed! Tries: ${COUNT}" - else - break - fi - - COUNT=$((COUNT+1)) - done - -}; - -start_image_install() -{ - if [ -z "${IMAGE_FILE}" ] - then - exit_err "ERROR: installMedium set to image but no image file specified!" - fi - - # We are ready to start mounting, lets read the config and do it - while read line - do - echo $line | grep -q "^disk0=" 2>/dev/null - if [ $? -eq 0 ] - then - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - DISK="$VAL" - fi - - echo $line | grep -q "^commitDiskPart" 2>/dev/null - if [ $? -eq 0 ] - then - # Found our flag to commit this disk setup / lets do sanity check and do it - if [ -n "${DISK}" ] - then - - # Write the image - write_image "${IMAGE_FILE}" "${DISK}" - - # Increment our disk counter to look for next disk and unset - unset DISK - break - - else - exit_err "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" - fi - fi - - done <${CFGF} -}; - -# Entrance function, which starts the installation process -init_extraction() -{ - # Figure out what file we are using to install from via the config - get_value_from_cfg installFile - - if [ -n "${VAL}" ] - then - export INSFILE="${VAL}" - else - # If no installFile specified, try our defaults - if [ "$INSTALLTYPE" = "FreeBSD" ] - then - case $PACKAGETYPE in - uzip) INSFILE="${FBSD_UZIP_FILE}" ;; - tar) INSFILE="${FBSD_TAR_FILE}" ;; - dist) - get_value_from_cfg_with_spaces distFiles - if [ -z "$VAL" ] ; then - exit_err "No dist files specified!" - fi - INSFILE="${VAL}" - ;; - split) - INSDIR="${FBSD_BRANCH_DIR}" - - # This is to trick opt_mount into not failing - INSFILE="${INSDIR}" - ;; - esac - else - case $PACKAGETYPE in - uzip) INSFILE="${UZIP_FILE}" ;; - tar) INSFILE="${TAR_FILE}" ;; - dist) - get_value_from_cfg_with_spaces distFiles - if [ -z "$VAL" ] ; then - exit_err "No dist files specified!" - fi - INSFILE="${VAL}" - ;; - esac - fi - export INSFILE - fi - - # Lets start by figuring out what medium we are using - case ${INSTALLMEDIUM} in - dvd|usb) - # Lets start by mounting the disk - opt_mount - if [ -n "${INSDIR}" ] - then - INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR - start_extract_split - - else - if [ "$PACKAGETYPE" = "dist" ] ; then - start_extract_dist "${CDMNT}/usr/freebsd-dist" - else - INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE - start_extract_uzip_tar - fi - fi - ;; - - ftp) - case $PACKAGETYPE in - split) - fetch_split_files - - INSDIR="${INSFILE}" ; export INSDIR - start_extract_split - ;; - dist) - fetch_dist_file - start_extract_dist "$DLDIR" - ;; - *) - fetch_install_file - start_extract_uzip_tar - ;; - esac - ;; - - sftp) ;; - - rsync) start_rsync_copy ;; - image) start_image_install ;; - local) - get_value_from_cfg localPath - if [ -z "$VAL" ] - then - exit_err "Install medium was set to local, but no localPath was provided!" - fi - LOCALPATH=$VAL - if [ "$PACKAGETYPE" = "dist" ] ; then - INSFILE="${INSFILE}" ; export INSFILE - start_extract_dist "$LOCALPATH" - else - INSFILE="${LOCALPATH}/${INSFILE}" ; export INSFILE - start_extract_uzip_tar - fi - ;; - *) exit_err "ERROR: Unknown install medium" ;; - esac - -}; Index: usr.sbin/pc-sysinstall/backend/functions-ftp.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-ftp.sh +++ /dev/null @@ -1,416 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which runs commands on the system - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - -DEFAULT_FTP_SERVER="ftp.freebsd.org" - -MAIN_FTP_SERVERS="\ -Main Site: ftp.freebsd.org" - -IPV6_FTP_SERVERS="\ -IPv6 Main Site: ftp.freebsd.org|\ -IPv6 Ireland: ftp3.ie.freebsd.org|\ -IPv6 Israel: ftp.il.freebsd.org|\ -IPv6 Japan: ftp2.jp.freebsd.org|\ -IPv6 Sweden: ftp4.se.freebsd.org|\ -IPv6 USA: ftp4.us.freebsd.org|\ -IPv6 Turkey: ftp2.tr.freebsd.org" - -PRIMARY_FTP_SERVERS="\ -Primary: ftp1.freebsd.org|\ -Primary #2: ftp2.freebsd.org|\ -Primary #3: ftp3.freebsd.org|\ -Primary #4: ftp4.freebsd.org|\ -Primary #5: ftp5.freebsd.org|\ -Primary #6: ftp6.freebsd.org|\ -Primary #7: ftp7.freebsd.org|\ -Primary #8: ftp8.freebsd.org|\ -Primary #9: ftp9.freebsd.org|\ -Primary #10: ftp10.freebsd.org|\ -Primary #11: ftp11.freebsd.org|\ -Primary #12: ftp12.freebsd.org|\ -Primary #13: ftp13.freebsd.org|\ -Primary #14: ftp14.freebsd.org" - -ARGENTINA_FTP_SERVERS="\ -Argentina: ftp.ar.freebsd.org" - -AUSTRALIA_FTP_SERVERS="\ -Australia: ftp.au.freebsd.org|\ -Australia #2: ftp2.au.freebsd.org|\ -Australia #3: ftp3.au.freebsd.org" - -AUSTRIA_FTP_SERVERS="\ -Austria: ftp.at.freebsd.org|\ -Austria #2: ftp2.at.freebsd.org" - -BRAZIL_FTP_SERVERS="\ -Brazil: ftp.br.freebsd.org|\ -Brazil #2: ftp2.br.freebsd.org|\ -Brazil #3: ftp3.br.freebsd.org|\ -Brazil #4: ftp4.br.freebsd.org|\ -Brazil #5: ftp5.br.freebsd.org|\ -Brazil #6: ftp6.br.freebsd.org|\ -Brazil #7: ftp7.br.freebsd.org" - -CANADA_FTP_SERVERS="\ -Canada: ftp.ca.freebsd.org" - -CHINA_FTP_SERVERS="\ -China: ftp.cn.freebsd.org|\ -China #2: ftp2.cn.freebsd.org" - -CROATIA_FTP_SERVERS="\ -Croatia: ftp.hr.freebsd.org" - -CZECH_REPUBLIC_FTP_SERVERS="\ -Czech Republic: ftp.cz.freebsd.org" - -DENMARK_FTP_SERVERS="\ -Denmark: ftp.dk.freebsd.org|\ -Denmark #2: ftp2.dk.freebsd.org" - -ESTONIA_FTP_SERVERS="\ -Estonia: ftp.ee.freebsd.org" - -FINLAND_FTP_SERVERS="\ -Finland: ftp.fi.freebsd.org" - -FRANCE_FTP_SERVERS="\ -France: ftp.fr.freebsd.org|\ -France #2: ftp2.fr.freebsd.org|\ -France #3: ftp3.fr.freebsd.org|\ -France #5: ftp5.fr.freebsd.org|\ -France #6: ftp6.fr.freebsd.org|\ -France #8: ftp8.fr.freebsd.org" - -GERMANY_FTP_SERVERS="\ -Germany: ftp.de.freebsd.org|\ -Germany #2: ftp2.de.freebsd.org|\ -Germany #3: ftp3.de.freebsd.org|\ -Germany #4: ftp4.de.freebsd.org|\ -Germany #5: ftp5.de.freebsd.org|\ -Germany #6: ftp6.de.freebsd.org|\ -Germany #7: ftp7.de.freebsd.org|\ -Germany #8: ftp8.de.freebsd.org" - -GREECE_FTP_SERVERS="\ -Greece: ftp.gr.freebsd.org|\ -Greece #2: ftp2.gr.freebsd.org" - -HUNGARY_FTP_SERVERS="\ -Hungary: ftp.hu.freebsd.org" - -ICELAND_FTP_SERVERS="\ -Iceland: ftp.is.freebsd.org" - -IRELAND_FTP_SERVERS="\ -Ireland: ftp.ie.freebsd.org|\ -Ireland #2: ftp2.ie.freebsd.org|\ -Ireland #3: ftp3.ie.freebsd.org" - -ISRAEL_FTP_SERVERS="\ -Israel: ftp.il.freebsd.org" - -ITALY_FTP_SERVERS="\ -Italy: ftp.it.freebsd.org" - -JAPAN_FTP_SERVERS="\ -Japan: ftp.jp.freebsd.org|\ -Japan #2: ftp2.jp.freebsd.org|\ -Japan #3: ftp3.jp.freebsd.org|\ -Japan #4: ftp4.jp.freebsd.org|\ -Japan #5: ftp5.jp.freebsd.org|\ -Japan #6: ftp6.jp.freebsd.org|\ -Japan #7: ftp7.jp.freebsd.org|\ -Japan #8: ftp8.jp.freebsd.org|\ -Japan #9: ftp9.jp.freebsd.org" - -KOREA_FTP_SERVERS="\ -Korea: ftp.kr.freebsd.org|\ -Korea #2: ftp2.kr.freebsd.org" - -LITHUANIA_FTP_SERVERS="\ -Lithuania: ftp.lt.freebsd.org" - -NETHERLANDS_FTP_SERVERS="\ -Netherlands: ftp.nl.freebsd.org|\ -Netherlands #2: ftp2.nl.freebsd.org" - -NORWAY_FTP_SERVERS="\ -Norway: ftp.no.freebsd.org|\ -Norway #3: ftp3.no.freebsd.org" - -POLAND_FTP_SERVERS="\ -Poland: ftp.pl.freebsd.org|\ -Poland #2: ftp2.pl.freebsd.org|\ -Poland #5: ftp5.pl.freebsd.org" - -PORTUGAL_FTP_SERVERS="\ -Portugal: ftp.pt.freebsd.org|\ -Portugal #2: ftp2.pt.freebsd.org|\ -Portugal #4: ftp4.pt.freebsd.org" - -ROMANIA_FTP_SERVERS="\ -Romania: ftp.ro.freebsd.org" - -RUSSIA_FTP_SERVERS="\ -Russia: ftp.ru.freebsd.org|\ -Russia #2: ftp2.ru.freebsd.org|\ -Russia #3: ftp3.ru.freebsd.org|\ -Russia #4: ftp4.ru.freebsd.org" - -SINGAPORE_FTP_SERVERS="\ -Singapore: ftp.sg.freebsd.org" - -SLOVAK_REPUBLIC_FTP_SERVERS="\ -Slovak Republic: ftp.sk.freebsd.org" - -SLOVENIA_FTP_SERVERS="\ -Slovenia: ftp.si.freebsd.org|\ -Slovenia #2: ftp2.si.freebsd.org" - -SOUTH_AFRICA_FTP_SERVERS="\ -South Africa: ftp.za.freebsd.org|\ -South Africa #2: ftp2.za.freebsd.org|\ -South Africa #3: ftp3.za.freebsd.org|\ -South Africa #4: ftp4.za.freebsd.org" - -SPAIN_FTP_SERVERS="\ -Spain: ftp.es.freebsd.org|\ -Spain #2: ftp2.es.freebsd.org|\ -Spain #3: ftp3.es.freebsd.org" - -SWEDEN_FTP_SERVERS="\ -Sweden: ftp.se.freebsd.org|\ -Sweden #2: ftp2.se.freebsd.org|\ -Sweden #3: ftp3.se.freebsd.org|\ -Sweden #4: ftp4.se.freebsd.org|\ -Sweden #5: ftp5.se.freebsd.org" - -SWITZERLAND_FTP_SERVERS="\ -Switzerland: ftp.ch.freebsd.org|\ -Switzerland #2: ftp2.ch.freebsd.org" - -TAIWAN_FTP_SERVERS="\ -Taiwan: ftp.tw.freebsd.org|\ -Taiwan #2: ftp2.tw.freebsd.org|\ -Taiwan #3: ftp3.tw.freebsd.org|\ -Taiwan #4: ftp4.tw.freebsd.org|\ -Taiwan #6: ftp6.tw.freebsd.org|\ -Taiwan #11: ftp11.tw.freebsd.org" - -TURKEY_FTP_SERVERS="\ -Turkey: ftp.tr.freebsd.org|\ -Turkey #2: ftp2.tr.freebsd.org" - -UK_FTP_SERVERS="\ -UK: ftp.uk.freebsd.org|\ -UK #2: ftp2.uk.freebsd.org|\ -UK #3: ftp3.uk.freebsd.org|\ -UK #4: ftp4.uk.freebsd.org|\ -UK #5: ftp5.uk.freebsd.org|\ -UK #6: ftp6.uk.freebsd.org" - -UKRAINE_FTP_SERVERS="\ -Ukraine: ftp.ua.freebsd.org|\ -Ukraine #2: ftp2.ua.freebsd.org|\ -Ukraine #5: ftp5.ua.freebsd.org|\ -Ukraine #6: ftp6.ua.freebsd.org|\ -Ukraine #7: ftp7.ua.freebsd.org|\ -Ukraine #8: ftp8.ua.freebsd.org" - -USA_FTP_SERVERS="\ -USA #1: ftp1.us.freebsd.org|\ -USA #2: ftp2.us.freebsd.org|\ -USA #3: ftp3.us.freebsd.org|\ -USA #4: ftp4.us.freebsd.org|\ -USA #5: ftp5.us.freebsd.org|\ -USA #6: ftp6.us.freebsd.org|\ -USA #7: ftp7.us.freebsd.org|\ -USA #8: ftp8.us.freebsd.org|\ -USA #9: ftp9.us.freebsd.org|\ -USA #10: ftp10.us.freebsd.org|\ -USA #11: ftp11.us.freebsd.org|\ -USA #12: ftp12.us.freebsd.org|\ -USA #13: ftp13.us.freebsd.org|\ -USA #14: ftp14.us.freebsd.org|\ -USA #15: ftp15.us.freebsd.org" - -show_mirrors() -{ - MIRRORS="${1}" - if [ -n "${MIRRORS}" ] - then - SAVE_IFS="${IFS}" - IFS="|" - for m in ${MIRRORS} - do - echo "$m" - done - IFS="${SAVE_IFS}" - fi -}; - -set_ftp_mirror() -{ - MIRROR="${1}" - echo "${MIRROR}" > "${CONFDIR}/mirrors.conf" -}; - -get_ftp_mirror() -{ - MIRROR="${DEFAULT_FTP_SERVER}" - if [ -f "${CONFDIR}/mirrors.conf" ] - then - MIRROR=`cat "${CONFDIR}/mirrors.conf"` - fi - - export VAL="${MIRROR}" -}; - - -get_ftpHost() -{ - get_value_from_cfg ftpPath - ftpPath="$VAL" - - ftpHost=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\2|'` - export VAL="${ftpHost}" -}; - -get_ftpDir() -{ - get_value_from_cfg ftpPath - ftpPath="$VAL" - - ftpDir=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\3|'` - export VAL="${ftpDir}" -}; - -get_ftp_mirrors() -{ - COUNTRY="${1}" - if [ -n "$COUNTRY" ] - then - COUNTRY=`echo $COUNTRY|tr A-Z a-z` - case "${COUNTRY}" in - argentina*) VAL="${ARGENTINA_FTP_SERVERS}" ;; - australia*) VAL="${AUSTRALIA_FTP_SERVERS}" ;; - austria*) VAL="${AUSTRIA_FTP_SERVERS}" ;; - brazil*) VAL="${BRAZIL_FTP_SERVERS}" ;; - canada*) VAL="${CANADA_FTP_SERVERS}" ;; - china*) VAL="${CHINA_FTP_SERVERS}" ;; - croatia*) VAL="${CROATIA_FTP_SERVERS}" ;; - czech*) VAL="${CZECH_REPUBLIC_FTP_SERVERS}" ;; - denmark*) VAL="${DENMARK_FTP_SERVERS}" ;; - estonia*) VAL="${ESTONIA_FTP_SERVERS}" ;; - finland*) VAL="${FINLAND_FTP_SERVERS}" ;; - france*) VAL="${FRANCE_FTP_SERVERS}" ;; - germany*) VAL="${GERMANY_FTP_SERVERS}" ;; - greece*) VAL="${GREECE_FTP_SERVERS}" ;; - hungary*) VAL="${HUNGARY_FTP_SERVERS}" ;; - iceland*) VAL="${ICELAND_FTP_SERVERS}" ;; - ireland*) VAL="${IRELAND_FTP_SERVERS}" ;; - israel*) VAL="${ISRAEL_FTP_SERVERS}" ;; - italy*) VAL="${ITALY_FTP_SERVERS}" ;; - japan*) VAL="${JAPAN_FTP_SERVERS}" ;; - korea*) VAL="${KOREA_FTP_SERVERS}" ;; - lithuania*) VAL="${LITHUANIA_FTP_SERVERS}" ;; - netherlands*) VAL="${NETHERLANDS_FTP_SERVERS}" ;; - norway*) VAL="${NORWAY_FTP_SERVERS}" ;; - poland*) VAL="${POLAND_FTP_SERVERS}" ;; - portugal*) VAL="${PORTUGAL_FTP_SERVERS}" ;; - romania*) VAL="${ROMAINIA_FTP_SERVERS}" ;; - russia*) VAL="${RUSSIA_FTP_SERVERS}" ;; - singapore*) VAL="${SINGAPORE_FTP_SERVERS}" ;; - slovak*) VAL="${SLOVAK_REPUBLIC_FTP_SERVERS}" ;; - slovenia*) VAL="${SLOVENIA_FTP_SERVERS}" ;; - *africa*) VAL="${SOUTH_AFRICA_FTP_SERVERS}" ;; - spain*) VAL="${SPAIN_FTP_SERVERS}" ;; - sweden*) VAL="${SWEDEN_FTP_SERVERS}" ;; - switzerland*) VAL="${SWITZERLAND_FTP_SERVERS}" ;; - taiwan*) VAL="${TAIWAN_FTP_SERVERS}" ;; - turkey*) VAL="${TURKEY_FTP_SERVERS}" ;; - ukraine*) VAL="${UKRAINE_FTP_SERVERS}" ;; - uk*) VAL="${UK_FTP_SERVERS}" ;; - usa*) VAL="${USA_FTP_SERVERS}" ;; - esac - else - VAL="${MAIN_FTP_SERVERS}" - VAL="${VAL}|${IPV6_FTP_SERVERS}" - VAL="${VAL}|${PRIMARY_FTP_SERVERS}" - VAL="${VAL}|${ARGENTINA_FTP_SERVERS}" - VAL="${VAL}|${AUSTRALIA_FTP_SERVERS}" - VAL="${VAL}|${AUSTRIA_FTP_SERVERS}" - VAL="${VAL}|${BRAZIL_FTP_SERVERS}" - VAL="${VAL}|${CANADA_FTP_SERVERS}" - VAL="${VAL}|${CHINA_FTP_SERVERS}" - VAL="${VAL}|${CROATIA_FTP_SERVERS}" - VAL="${VAL}|${CZECH_REPUBLIC_FTP_SERVERS}" - VAL="${VAL}|${DENMARK_FTP_SERVERS}" - VAL="${VAL}|${ESTONIA_FTP_SERVERS}" - VAL="${VAL}|${FINLAND_FTP_SERVERS}" - VAL="${VAL}|${FRANCE_FTP_SERVERS}" - VAL="${VAL}|${GERMANY_FTP_SERVERS}" - VAL="${VAL}|${GREECE_FTP_SERVERS}" - VAL="${VAL}|${HUNGARY_FTP_SERVERS}" - VAL="${VAL}|${ICELAND_FTP_SERVERS}" - VAL="${VAL}|${IRELAND_FTP_SERVERS}" - VAL="${VAL}|${ISRAEL_FTP_SERVERS}" - VAL="${VAL}|${ITALY_FTP_SERVERS}" - VAL="${VAL}|${JAPAN_FTP_SERVERS}" - VAL="${VAL}|${KOREA_FTP_SERVERS}" - VAL="${VAL}|${LITHUANIA_FTP_SERVERS}" - VAL="${VAL}|${NETHERLANDS_FTP_SERVERS}" - VAL="${VAL}|${NORWAY_FTP_SERVERS}" - VAL="${VAL}|${POLAND_FTP_SERVERS}" - VAL="${VAL}|${PORTUGAL_FTP_SERVERS}" - VAL="${VAL}|${ROMANIA_FTP_SERVERS}" - VAL="${VAL}|${RUSSIA_FTP_SERVERS}" - VAL="${VAL}|${SINGAPORE_FTP_SERVERS}" - VAL="${VAL}|${SLOVAK_REPUBLIC_FTP_SERVERS}" - VAL="${VAL}|${SLOVENIA_FTP_SERVERS}" - VAL="${VAL}|${SOUTH_AFRICA_FTP_SERVERS}" - VAL="${VAL}|${SPAIN_FTP_SERVERS}" - VAL="${VAL}|${SWEDEN_FTP_SERVERS}" - VAL="${VAL}|${SWITZERLAND_FTP_SERVERS}" - VAL="${VAL}|${TAIWAN_FTP_SERVERS}" - VAL="${VAL}|${TURKEY_FTP_SERVERS}" - VAL="${VAL}|${UKRAINE_FTP_SERVERS}" - VAL="${VAL}|${UK_FTP_SERVERS}" - VAL="${VAL}|${USA_FTP_SERVERS}" - fi - - export VAL -}; Index: usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which check and load any optional modules specified in the config - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - -copy_component() -{ - COMPONENT="$1" - FAILED="0" - CFILES="" - - # Check the type, and set the components subdir properly - TYPE="`grep 'type:' ${COMPDIR}/${COMPONENT}/component.cfg | cut -d ' ' -f 2`" - if [ "${TYPE}" = "PBI" ] - then - SUBDIR="PBI" - else - SUBDIR="components" - fi - - # Lets start by downloading / copying the files this component needs - while read line - do - CFILE="`echo $line | cut -d ':' -f 1`" - CFILEMD5="`echo $line | cut -d ':' -f 2`" - CFILE2MD5="`echo $line | cut -d ':' -f 3`" - - case ${INSTALLMEDIUM} in - dvd|usb) - # On both dvd / usb, we can just copy the file - cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \ - ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} - RESULT="$?" - ;; - - ftp) - get_value_from_cfg ftpPath - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" - fi - FTPPATH="${VAL}" - - fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0" - RESULT="$?" - ;; - local) - get_value_from_cfg localPath - if [ -z "$VAL" ]; then - exit_err "Install medium was set to local, but no localPath was provided!" - fi - LOCALPATH=$VAL - cp ${LOCALPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \ - ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} - RESULT="$?" - ;; - esac - - if [ "${RESULT}" != "0" ] - then - echo_log "WARNING: Failed to copy ${CFILE}" - FAILED="1" - else - # Now lets check the MD5 to confirm the file is valid - CHECKMD5=`md5 -q ${FSMNT}/${COMPTMPDIR}/${CFILE}` - if [ "${CHECKMD5}" != "${CFILEMD5}" -a "${CHECKMD5}" != "${CFILE2MD5}" ] - then - echo_log "WARNING: ${CFILE} failed md5 checksum" - FAILED="1" - else - if [ -z "${CFILES}" ] - then - CFILES="${CFILE}" - else - CFILES="${CFILES},${CFILE}" - fi - fi - fi - - - done < ${COMPDIR}/${COMPONENT}/distfiles - - if [ "${FAILED}" = "0" ] - then - # Now install the component - run_component_install ${COMPONENT} ${CFILES} - fi - -}; - -run_component_install() -{ - COMPONENT="$1" - CFILES="$1" - - # Lets install this component now - # Start by making a wrapper script which sets the variables - # for the component to use - echo "#!/bin/sh -COMPTMPDIR=\"${COMPTMPDIR}\" -export COMPTMPDIR -CFILE=\"${CFILE}\" -export CFILE -mount -t devfs devfs /dev - -sh ${COMPTMPDIR}/install.sh - -umount /dev -" >${FSMNT}/.componentwrapper.sh - chmod 755 ${FSMNT}/.componentwrapper.sh - - # Copy over the install script for this component - cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/ - - echo_log "INSTALL COMPONENT: ${i}" - chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT} - rm ${FSMNT}/.componentwrapper.sh - -}; - -# Check for any modules specified, and begin loading them -install_components() -{ - # First, lets check and see if we even have any optional modules - get_value_from_cfg installComponents - if [ -n "${VAL}" ] - then - # Lets start by cleaning up the string and getting it ready to parse - strip_white_space ${VAL} - COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"` - for i in $COMPONENTS - do - if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ] - then - echo_log "WARNING: Component ${i} doesn't seem to exist" - else - - # Make the tmpdir on the disk - mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} - - # Start by grabbing the component files - copy_component ${i} - - # Remove the tmpdir now - rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT} - fi - done - fi - -}; Index: usr.sbin/pc-sysinstall/backend/functions-installpackages.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-installpackages.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which check and load any optional packages specified in the config - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - -# Recursively determine all dependencies for this package -determine_package_dependencies() -{ - local PKGNAME="${1}" - local DEPFILE="${2}" - - grep -q "${PKGNAME}" "${DEPFILE}" - if [ $? -ne 0 ] - then - echo "${PKGNAME}" >> "${DEPFILE}" - get_package_dependencies "${PKGNAME}" "1" - - local DEPS="${VAL}" - for d in ${DEPS} - do - determine_package_dependencies "${d}" "${DEPFILE}" - done - fi -}; - -# Fetch packages dependencies from a file -fetch_package_dependencies() -{ - local DEPFILE - local DEPS - local SAVEDIR - - DEPFILE="${1}" - DEPS=`cat "${DEPFILE}"` - SAVEDIR="${2}" - - for d in ${DEPS} - do - get_package_short_name "${d}" - SNAME="${VAL}" - - get_package_category "${SNAME}" - CATEGORY="${VAL}" - - fetch_package "${CATEGORY}" "${d}" "${SAVEDIR}" - done -}; - -# Check for any packages specified, and begin loading them -install_packages() -{ - echo "Checking for packages to install..." - sleep 2 - - # First, lets check and see if we even have any packages to install - get_value_from_cfg installPackages - - # Nothing to do? - if [ -z "${VAL}" ]; then return; fi - - echo "Installing packages..." - sleep 3 - - local PKGPTH - - HERE=`pwd` - rc_halt "mkdir -p ${FSMNT}${PKGTMPDIR}" - - # Determine the directory we will install packages from - get_package_location - rc_halt "cd ${PKGDLDIR}" - - # Set the location of the INDEXFILE - INDEXFILE="${TMPDIR}/INDEX" - - if [ ! -f "${INDEXFILE}" ]; then - get_package_index - fi - - if [ ! -f "${TMPDIR}/INDEX.parsed" -a "$INSTALLMEDIUM" = "ftp" ]; then - parse_package_index - fi - - # What extension are we using for pkgs? - PKGEXT="txz" - get_value_from_cfg pkgExt - if [ -n "${VAL}" ]; then - strip_white_space ${VAL} - PKGEXT="$VAL" - fi - export PKGEXT - - # We dont want to be bothered with scripts asking questions - PACKAGE_BUILDING=yes - export PACKAGE_BUILDING - - # Lets start by cleaning up the string and getting it ready to parse - get_value_from_cfg_with_spaces installPackages - PACKAGES="${VAL}" - echo_log "Packages to install: `echo $PACKAGES | wc -w | awk '{print $1}'`" - for i in $PACKAGES - do - if ! get_package_name "${i}" - then - echo_log "Unable to locate package ${i}" - continue - fi - - PKGNAME="${VAL}" - - # Fetch package + deps, but skip if installing from local media - if [ "${INSTALLMEDIUM}" = "ftp" ] ; then - DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps" - rc_nohalt "touch ${DEPFILE}" - determine_package_dependencies "${PKGNAME}" "${DEPFILE}" - fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}" - fi - - # Set package location - case "${INSTALLMEDIUM}" in - usb|dvd|local) PKGPTH="${PKGTMPDIR}/All/${PKGNAME}" ;; - *) PKGPTH="${PKGTMPDIR}/${PKGNAME}" ;; - esac - - # See if we need to determine the package format we are working with - if [ -z "${PKGINFO}" ] ; then - tar tqf "${FSMNT}${PKGPTH}" '+MANIFEST' >/dev/null 2>/dev/null - if [ $? -ne 0 ] ; then - PKGADD="pkg_add -C ${FSMNT}" - PKGINFO="pkg_info" - else - PKGADD="pkg -c ${FSMNT} add" - PKGINFO="pkg info" - bootstrap_pkgng - fi - fi - - # If the package is not already installed, install it! - if ! run_chroot_cmd "${PKGINFO} -e ${PKGNAME}" >/dev/null 2>/dev/null - then - echo_log "Installing package: ${PKGNAME}" - rc_nohalt "${PKGADD} ${PKGPTH}" - fi - - if [ "${INSTALLMEDIUM}" = "ftp" ] ; then - rc_nohalt "rm ${DEPFILE}" - fi - - done - - echo_log "Package installation complete!" - - # Cleanup after ourselves - rc_halt "cd ${HERE}" - if [ "${INSTALLMEDIUM}" = "ftp" ] ; then - rc_halt "rm -rf ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null - else - rc_halt "umount ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null - rc_halt "rmdir ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null - fi -}; Index: usr.sbin/pc-sysinstall/backend/functions-localize.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-localize.sh +++ /dev/null @@ -1,543 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which runs commands on the system - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - - -# Function which localizes a FreeBSD install -localize_freebsd() -{ - sed -i.bak "s/lang=en_US/lang=${LOCALE}/g" ${FSMNT}/etc/login.conf - rm ${FSMNT}/etc/login.conf.bak -}; - -localize_x_desktops() { - - # Check for and customize KDE lang - ########################################################################## - - # Check if we can localize KDE via skel - if [ -e "${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals" ] ; then - sed -i '' "s/Country=us/Country=${COUNTRY}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals - sed -i '' "s/Country=us/Country=${COUNTRY}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals - sed -i '' "s/Language=en_US/Language=${SETLANG}:${LOCALE}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals - fi - - # Check if we have a KDE root config - if [ -e "${FSMNT}/root/.kde4/share/config/kdeglobals" ] ; then - sed -i '' "s/Language=en_US/Language=${SETLANG}:${LOCALE}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals - fi - - # Check for KDM - if [ -e "${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc" ] ; then - sed -i '' "s/Language=en_US/Language=${LOCALE}.UTF-8/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc - fi - - # Check for and customize GNOME / GDM lang - ########################################################################## - - # See if GDM is enabled and customize its lang - cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep -q "gdm_enable=\"YES\"" 2>/dev/null - if [ "$?" = "0" ] ; then - echo "gdm_lang=\"${LOCALE}.UTF-8\"" >> ${FSMNT}/etc/rc.conf - fi - -}; - -# Function which localizes a PC-BSD install -localize_pcbsd() -{ - # Check if we have a localized splash screen and copy it - if [ -e "${FSMNT}/usr/local/share/pcbsd/splash-screens/loading-screen-${SETLANG}.pcx" ] - then - cp ${FSMNT}/usr/local/share/pcbsd/splash-screens/loading-screen-${SETLANG}.pcx ${FSMNT}/boot/loading-screen.pcx - fi - -}; - -localize_x_keyboard() -{ - KEYMOD="$1" - KEYLAY="$2" - KEYVAR="$3" - COUNTRY="$4" - OPTION="grp:alt_shift_toggle" - SETXKBMAP="" - - if [ "${COUNTRY}" = "NONE" -o "${COUNTRY}" = "us" -o "${COUNTRY}" = "C" ] ; then - #In this case we don't need any additional language - COUNTRY="" - OPTION="" - else - COUNTRY=",${COUNTRY}" - fi - - if [ "${KEYMOD}" != "NONE" ] - then - SETXKBMAP="-model ${KEYMOD}" - KXMODEL="${KEYMOD}" - else - KXMODEL="pc104" - fi - - if [ "${KEYLAY}" != "NONE" ] - then - localize_key_layout "$KEYLAY" - SETXKBMAP="${SETXKBMAP} -layout ${KEYLAY}" - KXLAYOUT="${KEYLAY}" - else - KXLAYOUT="us" - fi - - if [ "${KEYVAR}" != "NONE" ] - then - SETXKBMAP="${SETXKBMAP} -variant ${KEYVAR}" - KXVAR="(${KEYVAR})" - else - KXVAR="" - fi - - # Setup .xprofile with our setxkbmap call now - if [ ! -z "${SETXKBMAP}" ] - then - if [ ! -e "${FSMNT}/usr/share/skel/.xprofile" ] - then - echo "#!/bin/sh" >${FSMNT}/usr/share/skel/.xprofile - fi - - # Save the keyboard layout for user / root X logins - echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/share/skel/.xprofile - chmod 755 ${FSMNT}/usr/share/skel/.xprofile - cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile - - # Save it for KDM - if [ -e "${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup" ] ; then - echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup - fi - fi - - # Create the kxkbrc configuration using these options - if [ -d "${FSMNT}/usr/share/skel/.kde4/share/config" ] ; then - echo "[Layout] -DisplayNames=${KXLAYOUT}${COUNTRY} -IndicatorOnly=false -LayoutList=${KXLAYOUT}${KXVAR}${COUNTRY} -Model=${KXMODEL} -Options=${OPTION} -ResetOldOptions=true -ShowFlag=true -ShowSingle=false -SwitchMode=WinClass -Use=true " >${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc - fi - -}; - -localize_key_layout() -{ - - KEYLAYOUT="$1" - - # Set the keylayout in rc.conf - case ${KEYLAYOUT} in - am) KEYLAYOUT_CONSOLE="hy.armscii-8" ;; - ca) KEYLAYOUT_CONSOLE="fr_CA.acc.iso" ;; - ch) KEYLAYOUT_CONSOLE="swissgerman.iso" ;; - cz) KEYLAYOUT_CONSOLE="cz.iso2" ;; - de) KEYLAYOUT_CONSOLE="german.iso" ;; - dk) KEYLAYOUT_CONSOLE="danish.iso" ;; - ee) KEYLAYOUT_CONSOLE="estonian.iso" ;; - es) KEYLAYOUT_CONSOLE="spanish.iso" ;; - fi) KEYLAYOUT_CONSOLE="finnish.iso" ;; - is) KEYLAYOUT_CONSOLE="icelandic.iso" ;; - jp) KEYLAYOUT_CONSOLE="jp.106" ;; - nl) KEYLAYOUT_CONSOLE="dutch.iso.acc" ;; - no) KEYLAYOUT_CONSOLE="norwegian.iso" ;; - pl) KEYLAYOUT_CONSOLE="pl_PL.ISO8859-2" ;; - ru) KEYLAYOUT_CONSOLE="ru.koi8-r" ;; - sk) KEYLAYOUT_CONSOLE="sk.iso2" ;; - se) KEYLAYOUT_CONSOLE="swedish.iso" ;; - tr) KEYLAYOUT_CONSOLE="tr.iso9.q" ;; - gb) KEYLAYOUT_CONSOLE="uk.iso" ;; - *) if [ ! -z "${KEYLAYOUT}" ] - then - KEYLAYOUT_CONSOLE="${KEYLAYOUT}.iso" - fi - ;; - esac - - if [ -n "${KEYLAYOUT_CONSOLE}" ] - then - echo "keymap=\"${KEYLAYOUT_CONSOLE}\"" >>${FSMNT}/etc/rc.conf - fi - -}; - -# Function which prunes other l10n files from the KDE install -localize_prune_langs() -{ - get_value_from_cfg localizeLang - KEEPLANG="$VAL" - if [ -z "$KEEPLANG" ] ; then - KEEPLANG="en" - fi - export KEEPLANG - - echo_log "Pruning other l10n files, keeping ${KEEPLANG}" - - # Create the script to do uninstalls - echo '#!/bin/sh - - for i in `pkg_info -xEI kde-l10n` - do - echo "$i" | grep "${KEEPLANG}-kde" - if [ $? -ne 0 ] ; then - pkg_delete ${i} - fi - done - ' > ${FSMNT}/.pruneLangs.sh - - chmod 755 ${FSMNT}/.pruneLangs.sh - chroot ${FSMNT} /.pruneLangs.sh >/dev/null 2>/dev/null - rm ${FSMNT}/.pruneLangs.sh - -}; - -# Function which sets COUNTRY SETLANG and LOCALE based upon $1 -localize_get_codes() -{ - TARGETLANG="${1}" - # Setup the presets for the specific lang - case $TARGETLANG in - af) - COUNTRY="C" - SETLANG="af" - LOCALE="af_ZA" - ;; - ar) - COUNTRY="C" - SETLANG="ar" - LOCALE="en_US" - ;; - az) - COUNTRY="C" - SETLANG="az" - LOCALE="en_US" - ;; - ca) - COUNTRY="es" - SETLANG="es:ca" - LOCALE="ca_ES" - ;; - be) - COUNTRY="be" - SETLANG="be" - LOCALE="be_BY" - ;; - bn) - COUNTRY="bn" - SETLANG="bn" - LOCALE="en_US" - ;; - bg) - COUNTRY="bg" - SETLANG="bg" - LOCALE="bg_BG" - ;; - cs) - COUNTRY="cz" - SETLANG="cs" - LOCALE="cs_CZ" - ;; - da) - COUNTRY="dk" - SETLANG="da" - LOCALE="da_DK" - ;; - de) - COUNTRY="de" - SETLANG="de" - LOCALE="de_DE" - ;; - en_GB) - COUNTRY="gb" - SETLANG="en_GB:cy" - LOCALE="en_GB" - ;; - el) - COUNTRY="gr" - SETLANG="el:gr" - LOCALE="el_GR" - ;; - es) - COUNTRY="es" - SETLANG="es" - LOCALE="es_ES" - ;; - es_LA) - COUNTRY="us" - SETLANG="es:en_US" - LOCALE="es_ES" - ;; - et) - COUNTRY="ee" - SETLANG="et" - LOCALE="et_EE" - ;; - fr) - COUNTRY="fr" - SETLANG="fr" - LOCALE="fr_FR" - ;; - he) - COUNTRY="il" - SETLANG="he:ar" - LOCALE="he_IL" - ;; - hr) - COUNTRY="hr" - SETLANG="hr" - LOCALE="hr_HR" - ;; - hu) - COUNTRY="hu" - SETLANG="hu" - LOCALE="hu_HU" - ;; - it) - COUNTRY="it" - SETLANG="it" - LOCALE="it_IT" - ;; - ja) - COUNTRY="jp" - SETLANG="ja" - LOCALE="ja_JP" - ;; - ko) - COUNTRY="kr" - SETLANG="ko" - LOCALE="ko_KR" - ;; - nl) - COUNTRY="nl" - SETLANG="nl" - LOCALE="nl_NL" - ;; - nn) - COUNTRY="no" - SETLANG="nn" - LOCALE="en_US" - ;; - pa) - COUNTRY="pa" - SETLANG="pa" - LOCALE="en_US" - ;; - pl) - COUNTRY="pl" - SETLANG="pl" - LOCALE="pl_PL" - ;; - pt) - COUNTRY="pt" - SETLANG="pt" - LOCALE="pt_PT" - ;; - pt_BR) - COUNTRY="br" - SETLANG="pt_BR" - LOCALE="pt_BR" - ;; - ru) - COUNTRY="ru" - SETLANG="ru" - LOCALE="ru_RU" - ;; - sl) - COUNTRY="si" - SETLANG="sl" - LOCALE="sl_SI" - ;; - sk) - COUNTRY="sk" - SETLANG="sk" - LOCALE="sk_SK" - ;; - sv) - COUNTRY="se" - SETLANG="sv" - LOCALE="sv_SE" - ;; - uk) - COUNTRY="ua" - SETLANG="uk" - LOCALE="uk_UA" - ;; - vi) - COUNTRY="vn" - SETLANG="vi" - LOCALE="en_US" - ;; - zh_CN) - COUNTRY="cn" - SETLANG="zh_CN" - LOCALE="zh_CN" - ;; - zh_TW) - COUNTRY="tw" - SETLANG="zh_TW" - LOCALE="zh_TW" - ;; - *) - COUNTRY="C" - SETLANG="${TARGETLANG}" - LOCALE="en_US" - ;; - esac - - export COUNTRY SETLANG LOCALE - -}; - -# Function which sets the timezone on the system -set_timezone() -{ - TZONE="$1" - cp ${FSMNT}/usr/share/zoneinfo/${TZONE} ${FSMNT}/etc/localtime -}; - -# Function which enables / disables NTP -set_ntp() -{ - ENABLED="$1" - if [ "$ENABLED" = "yes" -o "${ENABLED}" = "YES" ] - then - cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep -q 'ntpd_enable="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - echo 'ntpd_enable="YES"' >>${FSMNT}/etc/rc.conf - echo 'ntpd_sync_on_start="YES"' >>${FSMNT}/etc/rc.conf - fi - else - cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep -q 'ntpd_enable="YES"' 2>/dev/null - if [ $? -ne 0 ] - then - sed -i.bak 's|ntpd_enable="YES"||g' ${FSMNT}/etc/rc.conf - fi - fi -}; - -# Starts checking for localization directives -run_localize() -{ - KEYLAYOUT="NONE" - KEYMOD="NONE" - KEYVAR="NONE" - - while read line - do - # Check if we need to do any localization - echo $line | grep -q "^localizeLang=" 2>/dev/null - if [ $? -eq 0 ] - then - - # Set our country / lang / locale variables - get_value_from_string "$line" - localize_get_codes ${VAL} - - get_value_from_string "$line" - # If we are doing PC-BSD install, localize it as well as FreeBSD base - if [ "${INSTALLTYPE}" != "FreeBSD" ] - then - localize_pcbsd "$VAL" - fi - - # Localize FreeBSD - localize_freebsd "$VAL" - - # Localize any X pkgs - localize_x_desktops "$VAL" - fi - - # Check if we need to do any keylayouts - echo $line | grep -q "^localizeKeyLayout=" 2>/dev/null - if [ $? -eq 0 ] ; then - get_value_from_string "$line" - KEYLAYOUT="$VAL" - fi - - # Check if we need to do any key models - echo $line | grep -q "^localizeKeyModel=" 2>/dev/null - if [ $? -eq 0 ] ; then - get_value_from_string "$line" - KEYMOD="$VAL" - fi - - # Check if we need to do any key variant - echo $line | grep -q "^localizeKeyVariant=" 2>/dev/null - if [ $? -eq 0 ] ; then - get_value_from_string "$line" - KEYVAR="$VAL" - fi - - - # Check if we need to set a timezone - echo $line | grep -q "^timeZone=" 2>/dev/null - if [ $? -eq 0 ] ; then - get_value_from_string "$line" - set_timezone "$VAL" - fi - - # Check if we need to set a timezone - echo $line | grep -q "^enableNTP=" 2>/dev/null - if [ $? -eq 0 ] ; then - get_value_from_string "$line" - set_ntp "$VAL" - fi - done <${CFGF} - - if [ "${INSTALLTYPE}" != "FreeBSD" ] ; then - # Do our X keyboard localization - localize_x_keyboard "${KEYMOD}" "${KEYLAYOUT}" "${KEYVAR}" "${COUNTRY}" - fi - - # Check if we want to prunt any other KDE lang files to save some disk space - get_value_from_cfg localizePrune - if [ "${VAL}" = "yes" -o "${VAL}" = "YES" ] ; then - localize_prune_langs - fi - - # Update the login.conf db, even if we didn't localize, its a good idea to make sure its up2date - run_chroot_cmd "/usr/bin/cap_mkdb /etc/login.conf" >/dev/null 2>/dev/null - -}; Index: usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions related mounting the newly formatted disk partitions - -# Mounts all the specified partition to the mount-point -mount_partition() -{ - if [ -z "${1}" -o -z "${2}" -o -z "${3}" ] - then - exit_err "ERROR: Missing arguments for mount_partition" - fi - - PART="${1}" - PARTFS="${2}" - MNTPOINT="${3}" - MNTFLAGS="${4}" - - # Setup the MNTOPTS - if [ -z "${MNTOPTS}" ] - then - MNTFLAGS="-o rw" - else - MNTFLAGS="-o rw,${MNTFLAGS}" - fi - - - #We are on ZFS, lets setup this mount-point - if [ "${PARTFS}" = "ZFS" ] - then - ZPOOLNAME=$(get_zpool_name "${PART}") - - # Check if we have multiple zfs mounts specified - for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'` - do - # Check for any ZFS specific mount options - ZMNTOPTS="`echo $ZMNT | cut -d '(' -f 2 | cut -d ')' -f 1`" - if [ "$ZMNTOPTS" = "$ZMNT" ] ; then ZMNTOPTS="" ; fi - - # Reset ZMNT with options removed - ZMNT="`echo $ZMNT | cut -d '(' -f 1`" - - # First make sure we create the mount point - if [ ! -d "${FSMNT}${ZMNT}" ] ; then - mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT} - fi - - # Check for any volsize args - zcopt="" - for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` - do - echo "$ZOPT" | grep -q volsize - if [ $? -eq 0 ] ; then - volsize=`echo $ZOPT | cut -d '=' -f 2` - zcopt="-V $volsize" - fi - done - - if [ "${ZMNT}" = "/" ] ; then - # If creating ZFS / dataset, give it name that beadm works with - ZNAME="/ROOT/default" - ZMKMNT="" - echo_log "zfs create $zcopt -p ${ZPOOLNAME}/ROOT" - rc_halt "zfs create $zcopt -p ${ZPOOLNAME}/ROOT" - echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" - rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" - else - ZNAME="${ZMNT}" - ZMKMNT="${ZMNT}" - echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" - rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}" - fi - sleep 2 - if [ -z "$zcopt" ] ; then - rc_halt "zfs set mountpoint=${FSMNT}${ZMKMNT} ${ZPOOLNAME}${ZNAME}" - fi - - # Do we need to make this / zfs dataset bootable? - if [ "$ZMNT" = "/" ] ; then - echo_log "Stamping ${ZPOOLNAME}/ROOT/default as bootfs" - rc_halt "zpool set bootfs=${ZPOOLNAME}/ROOT/default ${ZPOOLNAME}" - fi - - # Do we need to make this /boot zfs dataset bootable? - if [ "$ZMNT" = "/boot" ] ; then - echo_log "Stamping ${ZPOOLNAME}${ZMNT} as bootfs" - rc_halt "zpool set bootfs=${ZPOOLNAME}${ZMNT} ${ZPOOLNAME}" - fi - - # If no ZFS options, we can skip - if [ -z "$ZMNTOPTS" ] ; then continue ; fi - - # Parse any ZFS options now - for ZOPT in `echo $ZMNTOPTS | sed 's/|/ /g'` - do - echo "$ZOPT" | grep -q volsize - if [ $? -eq 0 ] ; then continue ; fi - rc_halt "zfs set $ZOPT ${ZPOOLNAME}${ZNAME}" - done - done # End of adding ZFS mounts - - else - # If we are not on ZFS, lets do the mount now - # First make sure we create the mount point - if [ ! -d "${FSMNT}${MNTPOINT}" ] - then - mkdir -p ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT} - fi - - echo_log "mount ${MNTFLAGS} ${PART} -> ${FSMNT}${MNTPOINT}" - sleep 2 - rc_halt "mount ${MNTFLAGS} ${PART} ${FSMNT}${MNTPOINT}" - fi - -}; - -# Mounts all the new file systems to prepare for installation -mount_all_filesystems() -{ - # Make sure our mount point exists - mkdir -p ${FSMNT} >/dev/null 2>/dev/null - - # First lets find and mount the / partition - ######################################################### - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] - then - exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" - fi - - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - - if [ "${PARTENC}" = "ON" ] - then - EXT=".eli" - else - EXT="" - fi - - # Check for root partition for mounting, including ZFS "/,/usr" type - echo "$PARTMNT" | grep "/," >/dev/null - if [ "$?" = "0" -o "$PARTMNT" = "/" ] - then - case ${PARTFS} in - UFS) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+S) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+SUJ) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+J) mount_partition ${PARTDEV}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;; - ZFS) mount_partition ${PARTDEV} ${PARTFS} ${PARTMNT} ;; - IMAGE) mount_partition ${PARTDEV} ${PARTFS} ${PARTMNT} ;; - *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;; - esac - fi - done - - # Now that we've mounted "/" lets do any other remaining mount-points - ################################################################## - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] - then - exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" - fi - - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - - if [ "${PARTENC}" = "ON" ] - then - EXT=".eli" - else - EXT="" - fi - - # Check if we've found "/" again, don't need to mount it twice - echo "$PARTMNT" | grep "/," >/dev/null - if [ "$?" != "0" -a "$PARTMNT" != "/" ] - then - case ${PARTFS} in - UFS) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+S) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+SUJ) mount_partition ${PARTDEV}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;; - UFS+J) mount_partition ${PARTDEV}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;; - ZFS) mount_partition ${PARTDEV} ${PARTFS} ${PARTMNT} ;; - SWAP) - # Lets enable this swap now - if [ "$PARTENC" = "ON" ] - then - echo_log "Enabling encrypted swap on ${PARTDEV}" - rc_halt "geli onetime -d -e 3des ${PARTDEV}" - sleep 5 - rc_halt "swapon ${PARTDEV}.eli" - else - echo_log "swapon ${PARTDEV}" - sleep 5 - rc_halt "swapon ${PARTDEV}" - fi - ;; - IMAGE) - if [ ! -d "${PARTMNT}" ] - then - mkdir -p "${PARTMNT}" - fi - mount_partition ${PARTDEV} ${PARTFS} ${PARTMNT} - ;; - *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;; - esac - fi - done -}; Index: usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which perform mounting / unmounting and switching of -# optical / usb media - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - -# Displays an optical failure message -opt_fail() -{ - # If we got here, we must not have a DVD/USB we can find :( - get_value_from_cfg installInteractive - if [ "${VAL}" = "yes" ] - then - # We are running interactive, and didn't find a DVD, prompt user again - echo_log "DISK ERROR: Unable to find installation disk!" - echo_log "Please insert the installation disk and press enter." - read tmp - else - exit_err "ERROR: Unable to locate installation DVD/USB" - fi -}; - -# Performs the extraction of data to disk -opt_mount() -{ - FOUND="0" - - # Ensure we have a directory where its supposed to be - if [ ! -d "${CDMNT}" ] - then - mkdir -p ${CDMNT} - fi - - - # Start by checking if we already have a cd mounted at CDMNT - mount | grep -q "${CDMNT} " 2>/dev/null - if [ $? -eq 0 ] - then - if [ -e "${CDMNT}/${INSFILE}" ] - then - echo "MOUNTED" >${TMPDIR}/cdmnt - echo_log "FOUND DVD: MOUNTED" - FOUND="1" - return - fi - - # failed to find optical disk - opt_fail - return - fi - - # Setup our loop to search for installation media - while - z=1 - do - - # Loop though and look for an installation disk - for i in `ls -1 /dev/cd* 2>/dev/null` - do - # Find the CD Device - /sbin/mount_cd9660 $i ${CDMNT} - - # Check the package type to see if we have our install data - if [ -e "${CDMNT}/${INSFILE}" ] - then - echo "${i}" >${TMPDIR}/cdmnt - echo_log "FOUND DVD: ${i}" - FOUND="1" - break - fi - /sbin/umount ${CDMNT} >/dev/null 2>/dev/null - done - - # If no DVD found, try USB - if [ "$FOUND" != "1" ] - then - # Loop though and look for an installation disk - for i in `ls -1 /dev/da* 2>/dev/null` - do - # Check if we can mount this device UFS - /sbin/mount -r $i ${CDMNT} - - # Check the package type to see if we have our install data - if [ -e "${CDMNT}/${INSFILE}" ] - then - echo "${i}" >${TMPDIR}/cdmnt - echo_log "FOUND USB: ${i}" - FOUND="1" - break - fi - /sbin/umount ${CDMNT} >/dev/null 2>/dev/null - - # Also check if it is a FAT mount - /sbin/mount -r -t msdosfs $i ${CDMNT} - - # Check the package type to see if we have our install data - if [ -e "${CDMNT}/${INSFILE}" ] - then - echo "${i}" >${TMPDIR}/cdmnt - echo_log "FOUND USB: ${i}" - FOUND="1" - break - fi - /sbin/umount ${CDMNT} >/dev/null 2>/dev/null - done - fi # End of USB Check - - - if [ "$FOUND" = "1" ] - then - break - fi - - # Failed to find a disk, take action now - opt_fail - - done - -}; - -# Function to unmount optical media -opt_umount() -{ - /sbin/umount ${CDMNT} >/dev/null 2>/dev/null -}; Index: usr.sbin/pc-sysinstall/backend/functions-networking.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-networking.sh +++ /dev/null @@ -1,502 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. All rights reserved. -# Copyright (c) 2011 The FreeBSD Foundation -# All rights reserved. -# -# Portions of this software were developed by Bjoern Zeeb -# under sponsorship from the FreeBSD Foundation. -# -# 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$ - -# Functions which perform our networking setup - -# Function which creates a kde4 .desktop file for the PC-BSD net tray -create_desktop_nettray() -{ - NIC="${1}" - echo "#!/usr/bin/env xdg-open -[Desktop Entry] -Exec=/usr/local/kde4/bin/pc-nettray ${NIC} -Icon=network -StartupNotify=false -Type=Application" > ${FSMNT}/usr/share/skel/.kde4/Autostart/tray-${NIC}.desktop - chmod 744 ${FSMNT}/usr/share/skel/.kde4/Autostart/tray-${NIC}.desktop - -}; - -# Function which checks is a nic is wifi or not -check_is_wifi() -{ - NIC="$1" - ifconfig ${NIC} | grep -q "802.11" 2>/dev/null - if [ $? -eq 0 ] - then - return 0 - else - return 1 - fi -}; - -# Function to get the first available wired nic, used for setup -get_first_wired_nic() -{ - rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null - # start by getting a list of nics on this system - ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist - if [ -e "${TMPDIR}/.niclist" ] - then - while read line - do - NIC="`echo $line | cut -d ':' -f 1`" - check_is_wifi ${NIC} - if [ $? -ne 0 ] - then - export VAL="${NIC}" - return - fi - done < ${TMPDIR}/.niclist - fi - - export VAL="" - return -}; - - -# Function which simply enables plain dhcp on all detected nics -enable_dhcp_all() -{ - rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null - # start by getting a list of nics on this system - ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist - if [ -e "${TMPDIR}/.niclist" ] - then - echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf - WLANCOUNT="0" - while read line - do - NIC="`echo $line | cut -d ':' -f 1`" - DESC="`echo $line | cut -d ':' -f 2`" - echo_log "Setting $NIC to DHCP on the system." - check_is_wifi ${NIC} - if [ $? -eq 0 ] - then - # We have a wifi device, setup a wlan* entry for it - WLAN="wlan${WLANCOUNT}" - cat ${FSMNT}/etc/rc.conf | grep -q "wlans_${NIC}=" - if [ $? -ne 0 ] ; then - echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf - fi - echo "ifconfig_${WLAN}=\"DHCP\"" >>${FSMNT}/etc/rc.conf - CNIC="${WLAN}" - WLANCOUNT=$((WLANCOUNT+1)) - else - echo "ifconfig_${NIC}=\"DHCP\"" >>${FSMNT}/etc/rc.conf - CNIC="${NIC}" - fi - - done < ${TMPDIR}/.niclist - fi -}; - - -# Function which detects available nics, and enables dhcp on them -save_auto_dhcp() -{ - enable_dhcp_all -}; - -# Function which simply enables iPv6 SLAAC on all detected nics -enable_slaac_all() -{ - rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null - # start by getting a list of nics on this system - ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist - if [ -e "${TMPDIR}/.niclist" ] - then - echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf - WLANCOUNT="0" - while read line - do - NIC="`echo $line | cut -d ':' -f 1`" - DESC="`echo $line | cut -d ':' -f 2`" - echo_log "Setting $NIC to accepting RAs on the system." - check_is_wifi ${NIC} - if [ $? -eq 0 ] - then - # We have a wifi device, setup a wlan* entry for it - # Given we cannot have DHCP and SLAAC the same time currently - # it's save to just duplicate. - WLAN="wlan${WLANCOUNT}" - cat ${FSMNT}/etc/rc.conf | grep -q "wlans_${NIC}=" - if [ $? -ne 0 ] ; then - echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf - fi - #echo "ifconfig_${NIC}=\"up\"" >>${FSMNT}/etc/rc.conf - echo "ifconfig_${WLAN}_ipv6=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf - CNIC="${WLAN}" - WLANCOUNT=$((WLANCOUNT+1)) - else - #echo "ifconfig_${NIC}=\"up\"" >>${FSMNT}/etc/rc.conf - echo "ifconfig_${NIC}_ipv6=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf - CNIC="${NIC}" - fi - - done < ${TMPDIR}/.niclist - fi - - # Given we cannot yet rely on RAs to provide DNS information as much - # as we can in the DHCP world, we should append a given nameserver. - : > ${FSMNT}/etc/resolv.conf - get_value_from_cfg netSaveIPv6NameServer - NAMESERVER="${VAL}" - if [ -n "${NAMESERVER}" ] - then - echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf - fi - -}; - - -# Function which detects available nics, and enables IPv6 SLAAC on them -save_auto_slaac() -{ - enable_slaac_all -}; - - -# Function which saves a manual nic setup to the installed system -save_manual_nic() -{ - # Get the target nic - NIC="$1" - - get_value_from_cfg netSaveIP_${NIC} - NETIP="${VAL}" - - if [ "$NETIP" = "DHCP" ] - then - echo_log "Setting $NIC to DHCP on the system." - echo "ifconfig_${NIC}=\"DHCP\"" >>${FSMNT}/etc/rc.conf - return 0 - fi - - # If we get here, we have a manual setup, lets do so now - IFARGS="" - IF6ARGS="" - - # Set the manual IP - if [ -n "${NETIP}" ] - then - IFARGS="inet ${NETIP}" - - # Check if we have a netmask to set - get_value_from_cfg netSaveMask_${NIC} - NETMASK="${VAL}" - if [ -n "${NETMASK}" ] - then - IFARGS="${IFARGS} netmask ${NETMASK}" - fi - fi - - get_value_from_cfg netSaveIPv6_${NIC} - NETIP6="${VAL}" - if [ -n "${NETIP6}" ] - then - # Make sure we have one inet6 prefix. - IF6ARGS=`echo "${NETIP6}" | awk '{ if ("^inet6 ") { print $0; } else - { printf "inet6 %s", $0; } }'` - fi - - echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf - if [ -n "${IFARGS}" ] - then - echo "ifconfig_${NIC}=\"${IFARGS}\"" >>${FSMNT}/etc/rc.conf - fi - if [ -n "${IF6ARGS}" ] - then - echo "ifconfig_${NIC}_ipv6=\"${IF6ARGS}\"" >>${FSMNT}/etc/rc.conf - fi - -}; - -# Function which saves a manual gateway router setup to the installed system -save_manual_router() -{ - - # Check if we have a default router to set - get_value_from_cfg netSaveDefaultRouter - NETROUTE="${VAL}" - if [ -n "${NETROUTE}" ] - then - echo "defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf - fi - get_value_from_cfg netSaveIPv6DefaultRouter - NETROUTE="${VAL}" - if [ -n "${NETROUTE}" ] - then - echo "ipv6_defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf - fi - -}; - -save_manual_nameserver() -{ - # Check if we have a nameserver to enable - : > ${FSMNT}/etc/resolv.conf - get_value_from_cfg_with_spaces netSaveNameServer - NAMESERVERLIST="${VAL}" - if [ ! -z "${NAMESERVERLIST}" ] - then - for NAMESERVER in ${NAMESERVERLIST} - do - echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf - done - fi - - get_value_from_cfg_with_spaces netSaveIPv6NameServer - NAMESERVERLIST="${VAL}" - if [ ! -z "${NAMESERVERLIST}" ] - then - for NAMESERVER in ${NAMESERVERLIST} - do - echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf - done - fi - -}; - -# Function which determines if a nic is active / up -is_nic_active() -{ - ifconfig ${1} | grep -q "status: active" 2>/dev/null - if [ $? -eq 0 ] ; then - return 0 - else - return 1 - fi -}; - - -# Function which detects available nics, and runs DHCP on them until -# a success is found -enable_auto_dhcp() -{ - # start by getting a list of nics on this system - ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist - while read line - do - NIC="`echo $line | cut -d ':' -f 1`" - DESC="`echo $line | cut -d ':' -f 2`" - - is_nic_active "${NIC}" - if [ $? -eq 0 ] ; then - echo_log "Trying DHCP on $NIC $DESC" - dhclient ${NIC} >/dev/null 2>/dev/null - if [ $? -eq 0 ] ; then - # Got a valid DHCP IP, we can return now - export WRKNIC="$NIC" - return 0 - fi - fi - done < ${TMPDIR}/.niclist - -}; - -# Function which detects available nics, and runs rtsol on them. -enable_auto_slaac() -{ - - # start by getting a list of nics on this system - ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist - ALLNICS="" - while read line - do - NIC="`echo $line | cut -d ':' -f 1`" - DESC="`echo $line | cut -d ':' -f 2`" - - is_nic_active "${NIC}" - if [ $? -eq 0 ] ; then - echo_log "Will try IPv6 SLAAC on $NIC $DESC" - ifconfig ${NIC} inet6 -ifdisabled accept_rtadv up - ALLNICS="${ALLNICS} ${NIC}" - fi - done < ${TMPDIR}/.niclist - - # XXX once we support it in-tree call /sbin/resovconf here. - echo_log "Running rtsol on ${ALLNICS}" - rtsol -F ${ALLNICS} >/dev/null 2>/dev/null -} - -# Get the mac address of a target NIC -get_nic_mac() -{ - FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`" - export FOUNDMAC -} - -# Function which performs the manual setup of a target nic in the cfg -enable_manual_nic() -{ - # Get the target nic - NIC="$1" - - # Check that this NIC exists - rc_halt "ifconfig ${NIC}" - - get_value_from_cfg netIP - NETIP="${VAL}" - - if [ "$NETIP" = "DHCP" ] - then - echo_log "Enabling DHCP on $NIC" - rc_halt "dhclient ${NIC}" - return 0 - fi - - # If we get here, we have a manual setup, lets do so now - - # IPv4: - - # Set the manual IP - if [ -n "${NETIP}" ] - then - # Check if we have a netmask to set - get_value_from_cfg netMask - NETMASK="${VAL}" - if [ -n "${NETMASK}" ] - then - rc_halt "ifconfig inet ${NIC} netmask ${NETMASK}" - else - rc_halt "ifconfig inet ${NIC} ${NETIP}" - fi - fi - - # Check if we have a default router to set - get_value_from_cfg netDefaultRouter - NETROUTE="${VAL}" - if [ -n "${NETROUTE}" ] - then - rc_halt "route add -inet default ${NETROUTE}" - fi - - # IPv6: - - # Set static IPv6 address - get_value_from_cfg netIPv6 - NETIP="${VAL}" - if [ -n ${NETIP} ] - then - rc_halt "ifconfig inet6 ${NIC} ${NETIP} -ifdisabled up" - fi - - # Default router - get_value_from_cfg netIPv6DefaultRouter - NETROUTE="${VAL}" - if [ -n "${NETROUTE}" ] - then - rc_halt "route add -inet6 default ${NETROUTE}" - fi - - # Check if we have a nameserver to enable - : >/etc/resolv.conf - get_value_from_cfg netNameServer - NAMESERVER="${VAL}" - if [ -n "${NAMESERVER}" ] - then - echo "nameserver ${NAMESERVER}" >>/etc/resolv.conf - fi - get_value_from_cfg netIPv6NameServer - NAMESERVER="${VAL}" - if [ -n "${NAMESERVER}" ] - then - echo "nameserver ${NAMESERVER}" >>/etc/resolv.conf - fi - -}; - - -# Function which parses the cfg and enables networking per specified -start_networking() -{ - # Check if we have any networking requested - get_value_from_cfg netDev - if [ -z "${VAL}" ] - then - return 0 - fi - - NETDEV="${VAL}" - if [ "$NETDEV" = "AUTO-DHCP" ] - then - enable_auto_dhcp - elif [ "$NETDEV" = "IPv6-SLAAC" ] - then - enable_auto_slaac - elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ] - then - enable_auto_dhcp - enable_auto_slaac - else - enable_manual_nic ${NETDEV} - fi - -}; - - -# Function which checks the cfg and enables the specified networking on -# the installed system -save_networking_install() -{ - - # Check if we have any networking requested to save - get_value_from_cfg_with_spaces netSaveDev - if [ -z "${VAL}" ] - then - return 0 - fi - - NETDEVLIST="${VAL}" - if [ "$NETDEVLIST" = "AUTO-DHCP" ] - then - save_auto_dhcp - elif [ "$NETDEVLIST" = "IPv6-SLAAC" ] - then - save_auto_slaac - elif [ "$NETDEVLIST" = "AUTO-DHCP-SLAAC" ] - then - save_auto_dhcp - save_auto_slaac - else - for NETDEV in ${NETDEVLIST} - do - save_manual_nic ${NETDEV} - done - save_manual_router - save_manual_nameserver - fi - -}; Index: usr.sbin/pc-sysinstall/backend/functions-newfs.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-newfs.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions related to disk operations using newfs - - -# Function which performs the ZFS magic -setup_zfs_filesystem() -{ - PART="$1" - PARTFS="$2" - PARTMNT="$3" - EXT="$4" - PARTGEOM="$5" - ZPOOLOPTS="$6" - ROOTSLICE="`echo ${PART} | rev | cut -b 2- | rev`" - ZPOOLNAME=$(get_zpool_name "${PART}") - - # Sleep a few moments, let the disk catch its breath - sleep 5 - sync - - # Check if we have multiple zfs mounts specified - for i in `echo ${PARTMNT} | sed 's|,| |g'` - do - # Check if we ended up with needing a zfs bootable partition - if [ "${i}" = "/" -o "${i}" = "/boot" ] - then - if [ "$HAVEBOOT" = "YES" ] ; then continue ; fi - if [ "${PARTGEOM}" = "MBR" ] ; then - # Lets stamp the proper ZFS boot loader - echo_log "Setting up ZFS boot loader support" - rc_halt "dd if=/boot/zfsboot of=${ROOTSLICE} count=1" - rc_halt "dd if=/boot/zfsboot of=${PART}${EXT} skip=1 seek=1024" - fi - fi - done - - # Check if we have some custom zpool arguments and use them if so - if [ ! -z "${ZPOOLOPTS}" ] ; then - # Sort through devices and run gnop on them - local gnopDev="" - local newOpts="" - for i in $ZPOOLOPTS - do - echo "$i" | grep -q '/dev/' - if [ $? -eq 0 ] ; then - rc_halt "gnop create -S 4096 ${i}" - gnopDev="$gnopDev $i" - newOpts="$newOpts ${i}.nop" - else - newOpts="$newOpts $i" - fi - done - - echo_log "Creating zpool ${ZPOOLNAME} with $newOpts" - rc_halt "zpool create -m none -f ${ZPOOLNAME} ${newOpts}" - - # Export the pool - rc_halt "zpool export ${ZPOOLNAME}" - - # Destroy the gnop devices - for i in $gnopDev - do - rc_halt "gnop destroy ${i}.nop" - done - - # And lastly re-import the pool - rc_halt "zpool import ${ZPOOLNAME}" - else - # Lets do our pseudo-4k drive - rc_halt "gnop create -S 4096 ${PART}${EXT}" - - # No zpool options, create pool on single device - echo_log "Creating zpool ${ZPOOLNAME} on ${PART}${EXT}" - rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}.nop" - - # Finish up the gnop 4k trickery - rc_halt "zpool export ${ZPOOLNAME}" - rc_halt "gnop destroy ${PART}${EXT}.nop" - rc_halt "zpool import ${ZPOOLNAME}" - fi - - # Disable atime for this zfs partition, speed increase - rc_nohalt "zfs set atime=off ${ZPOOLNAME}" - - - -}; - -# Runs newfs on all the partiions which we've setup with bsdlabel -setup_filesystems() -{ - - # Create the keydir - rm -rf ${GELIKEYDIR} >/dev/null 2>/dev/null - mkdir ${GELIKEYDIR} - - # Lets go ahead and read through the saved partitions we created, and determine if we need to run - # newfs on any of them - for PART in `ls ${PARTDIR}` - do - PARTDEV="`echo $PART | sed 's|-|/|g'`" - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" - PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d '#' -f 5`" - PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 6`" - PARTIMAGE="`cat ${PARTDIR}/${PART} | cut -d '#' -f 7`" - - if [ ! -e "${PARTDEV}" ] ; then - exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" - fi - - # Make sure journaling isn't enabled on this device - if [ -e "${PARTDEV}.journal" ] - then - rc_nohalt "gjournal stop -f ${PARTDEV}.journal" - rc_nohalt "gjournal clear ${PARTDEV}" - fi - - # Setup encryption if necessary - if [ "${PARTENC}" = "ON" -a "${PARTFS}" != "SWAP" ] - then - echo_log "Creating geli provider for ${PARTDEV}" - - if [ -e "${PARTDIR}-enc/${PART}-encpass" ] ; then - # Using a passphrase - rc_halt "dd if=/dev/random of=${GELIKEYDIR}/${PART}.key bs=64 count=1" - rc_halt "geli init -J ${PARTDIR}-enc/${PART}-encpass ${PARTDEV}" - rc_halt "geli attach -j ${PARTDIR}-enc/${PART}-encpass ${PARTDEV}" - else - # No Encryption password, use key file - rc_halt "dd if=/dev/random of=${GELIKEYDIR}/${PART}.key bs=64 count=1" - rc_halt "geli init -b -s 4096 -P -K ${GELIKEYDIR}/${PART}.key ${PARTDEV}" - rc_halt "geli attach -p -k ${GELIKEYDIR}/${PART}.key ${PARTDEV}" - - fi - - EXT=".eli" - else - # No Encryption - EXT="" - fi - - case ${PARTFS} in - UFS) - echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" - sleep 2 - rc_halt "newfs -t ${PARTXTRAOPTS} ${PARTDEV}${EXT}" - sleep 2 - rc_halt "sync" - rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" - rc_halt "sync" - - # Set flag that we've found a boot partition - if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then - HAVEBOOT="YES" - fi - sleep 2 - ;; - - UFS+S) - echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" - sleep 2 - rc_halt "newfs -t ${PARTXTRAOPTS} -U ${PARTDEV}${EXT}" - sleep 2 - rc_halt "sync" - rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" - rc_halt "sync" - # Set flag that we've found a boot partition - if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then - HAVEBOOT="YES" - fi - sleep 2 - ;; - - UFS+SUJ) - echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" - sleep 2 - rc_halt "newfs -t ${PARTXTRAOPTS} -U ${PARTDEV}${EXT}" - sleep 2 - rc_halt "sync" - rc_halt "tunefs -j enable ${PARTDEV}${EXT}" - sleep 2 - rc_halt "sync" - rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" - rc_halt "sync" - # Set flag that we've found a boot partition - if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then - HAVEBOOT="YES" - fi - sleep 2 - ;; - - - UFS+J) - echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" - sleep 2 - rc_halt "newfs ${PARTDEV}${EXT}" - sleep 2 - rc_halt "gjournal label -f ${PARTDEV}${EXT}" - sleep 2 - rc_halt "newfs ${PARTXTRAOPTS} -O 2 -J ${PARTDEV}${EXT}.journal" - sleep 2 - rc_halt "sync" - rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}.journal" - rc_halt "sync" - # Set flag that we've found a boot partition - if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then - HAVEBOOT="YES" - fi - sleep 2 - ;; - - ZFS) - echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" - setup_zfs_filesystem "${PARTDEV}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}" "${PARTXTRAOPTS}" - ;; - - SWAP) - rc_halt "sync" - rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" - rc_halt "sync" - sleep 2 - ;; - - IMAGE) - write_image "${PARTIMAGE}" "${PARTDEV}" - sleep 2 - ;; - - *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;; - esac - - done -}; Index: usr.sbin/pc-sysinstall/backend/functions-packages.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-packages.sh +++ /dev/null @@ -1,413 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which runs commands on the system - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh -. ${BACKEND}/functions-ftp.sh - - -get_package_index_by_ftp() -{ - local INDEX_FILE - local FTP_SERVER - - FTP_SERVER="${1}" - INDEX_FILE="INDEX" - USE_BZIP2=0 - - if [ -f "/usr/bin/bzip2" ] - then - INDEX_FILE="${INDEX_FILE}.bz2" - USE_BZIP2=1 - INDEX_PATH="${INDEXFILE}.bz2" - else - INDEX_PATH="${INDEXFILE}" - fi - - fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1" - if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ] - then - bzip2 -d "${INDEX_PATH}" - fi -}; - -get_package_index_by_fs() -{ - if [ "$INSTALLMEDIUM" = "local" ] ; then - INDEXFILE="${LOCALPATH}/packages/INDEX" - else - INDEXFILE="${CDMNT}/packages/INDEX" - fi -}; - -get_package_index_size() -{ - if [ -f "${INDEXFILE}" ] - then - SIZE=`ls -l ${INDEXFILE} | awk '{ print $5 }'` - else - get_ftp_mirror - FTPHOST="${VAL}" - - FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}" - FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages" - - fetch -s "${FTPPATH}/INDEX.bz2" - fi -}; - -get_package_index() -{ - RES=0 - - if [ -z "${INSTALLMODE}" ] - then - get_ftp_mirror - FTPHOST="${VAL}" - - FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}" - FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages" - - get_package_index_by_ftp "${FTPPATH}" - - else - - case "${INSTALLMEDIUM}" in - usb|dvd|local) get_package_index_by_fs ;; - ftp) get_value_from_cfg ftpHost - if [ -z "$VAL" ]; then - exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" - fi - FTPHOST="${VAL}" - - get_value_from_cfg ftpDir - if [ -z "$VAL" ]; then - exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" - fi - FTPDIR="${VAL}" - FTPPATH="ftp://${FTPHOST}${FTPDIR}" - get_package_index_by_ftp "${FTPPATH}" ;; - sftp) ;; - *) RES=1 ;; - esac - - fi - - return ${RES} -}; - -parse_package_index() -{ - echo_log "Building package dep list.. Please wait.." - INDEX_FILE="${PKGDIR}/INDEX" - - exec 3<&0 - exec 0<"${INDEXFILE}" - - while read -r line - do - PKGNAME="" - CATEGORY="" - PACKAGE="" - DESC="" - DEPS="" - i=0 - - SAVE_IFS="${IFS}" - IFS="|" - - for part in ${line} - do - if [ ${i} -eq 0 ] - then - PKGNAME="${part}" - - elif [ ${i} -eq 1 ] - then - PACKAGE=`basename "${part}"` - - elif [ ${i} -eq 3 ] - then - DESC="${part}" - - elif [ ${i} -eq 6 ] - then - CATEGORY=`echo "${part}" | cut -f1 -d' '` - - elif [ ${i} -eq 8 ] - then - DEPS="${part}" - fi - - i=$((i+1)) - done - - echo "${CATEGORY}|${PACKAGE}|${DESC}" >> "${INDEX_FILE}.parsed" - echo "${PACKAGE}|${PKGNAME}|${DEPS}" >> "${INDEX_FILE}.deps" - - IFS="${SAVE_IFS}" - done - - exec 0<&3 -}; - -show_package_file() -{ - PKGFILE="${1}" - - echo "Available Packages:" - - exec 3<&0 - exec 0<"${PKGFILE}" - - while read -r line - do - CATEGORY=`echo "${line}" | cut -f1 -d'|'` - PACKAGE=`echo "${line}" | cut -f2 -d'|'` - DESC=`echo "${line}" | cut -f3 -d'|'` - - echo "${CATEGORY}/${PACKAGE}:${DESC}" - done - - exec 0<&3 -}; - -show_packages_by_category() -{ - CATEGORY="${1}" - INDEX_FILE="${PKGDIR}/INDEX.parsed" - TMPFILE="/tmp/.pkg.cat" - - grep "^${CATEGORY}|" "${INDEX_FILE}" > "${TMPFILE}" - show_package_file "${TMPFILE}" - rm "${TMPFILE}" -}; - -show_package_by_name() -{ - CATEGORY="${1}" - PACKAGE="${2}" - INDEX_FILE="${PKGDIR}/INDEX.parsed" - TMPFILE="/tmp/.pkg.cat.pak" - - grep "^${CATEGORY}|${PACKAGE}" "${INDEX_FILE}" > "${TMPFILE}" - show_package_file "${TMPFILE}" - rm "${TMPFILE}" -}; - -show_packages() -{ - show_package_file "${PKGDIR}/INDEX.parsed" -}; - -get_package_dependencies() -{ - PACKAGE="${1}" - LONG="${2:-0}" - RES=0 - - INDEX_FILE="${PKGDIR}/INDEX.deps" - REGEX="^${PACKAGE}|" - - if [ ${LONG} -ne 0 ] - then - REGEX="^.*|${PACKAGE}|" - fi - - LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null` - DEPS=`echo "${LINE}"|cut -f3 -d'|'` - - export VAL="${DEPS}" - - if [ -z "${VAL}" ] - then - RES=1 - fi - - return ${RES} -}; - -get_package_name() -{ - PACKAGE="${1}" - RES=0 - local PKGPTH - - # If we are on a local medium, we can parse the Latest/ directory - if [ "${INSTALLMEDIUM}" != "ftp" ] ; then - case "${INSTALLMEDIUM}" in - usb|dvd) PKGPTH="${CDMNT}/packages" ;; - *) PKGPTH="${LOCALPATH}/packages" ;; - esac - - # Check the /Latest dir for generic names, then look for specific version in All/ - if [ -e "${PKGPTH}/Latest/${PACKAGE}.${PKGEXT}" ] ; then - NAME=`ls -al ${PKGPTH}/Latest/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '` - else - NAME=`ls -al ${PKGPTH}/All/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '` - fi - export VAL="${NAME}" - else - # Doing remote fetch, we we will look up, but some generic names like - # "perl" wont work, since we don't know the default version - INDEX_FILE="${PKGDIR}/INDEX.deps" - REGEX="^${PACKAGE}|" - - LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null` - NAME=`echo "${LINE}"|cut -f2 -d'|'` - - export VAL="${NAME}" - fi - - if [ -z "${VAL}" ] - then - RES=1 - fi - return ${RES} -}; - -get_package_short_name() -{ - PACKAGE="${1}" - RES=0 - - INDEX_FILE="${PKGDIR}/INDEX.deps" - REGEX="^.*|${PACKAGE}|" - - LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null` - NAME=`echo "${LINE}"|cut -f1 -d'|'` - - export VAL="${NAME}" - - if [ -z "${VAL}" ] - then - RES=1 - fi - - return ${RES} -}; - -get_package_category() -{ - PACKAGE="${1}" - INDEX_FILE="${PKGDIR}/INDEX.parsed" - RES=0 - - LINE=`grep "|${PACKAGE}|" "${INDEX_FILE}" 2>/dev/null` - NAME=`echo "${LINE}"|cut -f1 -d'|'` - - export VAL="${NAME}" - - if [ -z "${VAL}" ] - then - RES=1 - fi - - return ${RES} -}; - -fetch_package_by_ftp() -{ - CATEGORY="${1}" - PACKAGE="${2}" - SAVEDIR="${3}" - - get_value_from_cfg ftpHost - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" - fi - FTPHOST="${VAL}" - - get_value_from_cfg ftpDir - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" - fi - FTPDIR="${VAL}" - - PACKAGE="${PACKAGE}.${PKGEXT}" - FTP_SERVER="ftp://${FTPHOST}${FTPDIR}" - - if [ ! -f "${SAVEDIR}/${PACKAGE}" ] - then - PKGPATH="${CATEGORY}/${PACKAGE}" - FTP_PATH="${FTP_HOST}/packages/${PKGPATH}" - fetch_file "${FTP_PATH}" "${SAVEDIR}/" "0" - fi -}; - -fetch_package() -{ - CATEGORY="${1}" - PACKAGE="${2}" - SAVEDIR="${3}" - - # Fetch package, but skip if installing from local media - case "${INSTALLMEDIUM}" in - usb|dvd|local) return ;; - ftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; - sftp) ;; - esac -}; - -bootstrap_pkgng() -{ - # Check if we need to boot-strap pkgng - if run_chroot_cmd "which pkg-static" >/dev/null 2>/dev/null - then - return - fi - local PKGPTH - - # Ok, lets boot-strap this sucker - echo_log "Bootstraping pkgng.." - fetch_package "Latest" "pkg" "${PKGDLDIR}" - - # Figure out real location of "pkg" package - case "${INSTALLMEDIUM}" in - usb|dvd|local) PKGPTH="${PKGTMPDIR}/Latest/pkg.${PKGEXT}" ;; - *) PKGPTH="${PKGTMPDIR}/pkg.${PKGEXT}" ;; - esac - rc_halt "pkg -c ${FSMNT} add ${PKGPTH}" ; run_chroot_cmd "pkg2ng" -} - -get_package_location() -{ - case "${INSTALLMEDIUM}" in - usb|dvd) rc_halt "mount_nullfs ${CDMNT}/packages ${FSMNT}${PKGTMPDIR}" - PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;; - local) rc_halt "mount_nullfs ${LOCALPATH}/packages ${FSMNT}${PKGTMPDIR}" - PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;; - *) PKGDLDIR="${FSMNT}${PKGTMPDIR}" ;; - esac - export PKGDLDIR -} Index: usr.sbin/pc-sysinstall/backend/functions-parse.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-parse.sh +++ /dev/null @@ -1,231 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# functions.sh -# Library of functions which pc-sysinstall may call upon for parsing the config - -# which gets the value of a setting in the provided line -get_value_from_string() -{ - if [ -n "${1}" ] - then - export VAL="`echo ${1} | cut -d '=' -f 2-`" - else - echo "Error: Did we forgot to supply a string to parse?" - exit 1 - fi -}; - -# Get the value from the cfg file including spaces -get_value_from_cfg_with_spaces() -{ - if [ -n "${1}" ] - then - export VAL="`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2-`" - else - exit_err "Error: Did we forgot to supply a setting to grab?" - fi -}; - - -# Get the value from the cfg file -get_value_from_cfg() -{ - if [ -n "${1}" ] - then - export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '` - else - exit_err "Error: Did we forgot to supply a setting to grab?" - fi -}; - -# Checks the value of a setting in the provided line with supplied possibilities -# 1 = setting we are checking, 2 = list of valid values -if_check_value_exists() -{ - if [ -n "${1}" -a -n "${2}" ] - then - # Get the first occurrence of the setting from the config, strip out whitespace - - VAL=`grep "^${1}" ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '` - if [ -z "${VAL}" ] - then - # This value doesn't exist, lets return - return 0 - fi - - - VALID="1" - for i in ${2} - do - VAL=`echo "$VAL"|tr A-Z a-z` - if [ "$VAL" = "${i}" ] - then - VALID="0" - fi - done - if [ "$VALID" = "1" ] - then - exit_err "Error: ${1} is set to unknown value $VAL" - fi - else - exit_err "Error: Did we forgot to supply a string to parse and setting to grab?" - fi -}; - -# Checks the value of a setting in the provided line with supplied possibilities -# 1 = setting we are checking, 2 = list of valid values -check_value() -{ - if [ -n "${1}" -a -n "${2}" ] - then - # Get the first occurrence of the setting from the config, strip out whitespace - VAL=`grep "^${1}" ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '` - VALID="1" - for i in ${2} - do - if [ "$VAL" = "${i}" ] - then - VALID="0" - fi - done - if [ "$VALID" = "1" ] - then - exit_err "Error: ${1} is set to unknown value $VAL" - fi - else - exit_err "Error: Did we forgot to supply a string to parse and setting to grab?" - fi -}; - -# Checks for the presence of the supplied arguments in the config file -# 1 = values to confirm exist -file_sanity_check() -{ - if [ -n "$CFGF" -a -n "$1" ] - then - for i in $1 - do - grep -q "^${i}=" $CFGF 2>/dev/null - if [ $? -eq 0 ] - then - LN=`grep "^${i}=" ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '` - if [ -z "${LN}" ] - then - echo "Error: Config fails sanity test! ${i}= is empty" - exit 1 - fi - else - echo "Error: Config fails sanity test! Missing ${i}=" - exit 1 - fi - done - else - echo "Error: Missing config file, and / or values to sanity check for!" - exit 1 - fi -}; - - -# Function which merges the contents of a new config into the specified old one -# Only works with = type configurations -merge_config() -{ - OLDCFG="${1}" - NEWCFG="${2}" - FINALCFG="${3}" - - # Copy our oldcfg to the new one, which will be used as basis - cp ${OLDCFG} ${FINALCFG} - - # Remove blank lines from new file - cat ${NEWCFG} | sed '/^$/d' > ${FINALCFG}.tmp - - # Set our marker if we've found any - FOUNDMERGE="NO" - - while read newline - do - echo ${newline} | grep -q "^#" 2>/dev/null - if [ $? -ne 0 ] ; then - VAL="`echo ${newline} | cut -d '=' -f 1`" - cat ${OLDCFG} | grep -q ${VAL} 2>/dev/null - if [ $? -ne 0 ] ; then - if [ "${FOUNDMERGE}" = "NO" ] ; then - echo "" >> ${FINALCFG} - echo "# Auto-merged values from newer ${NEWCFG}" >> ${FINALCFG} - FOUNDMERGE="YES" - fi - echo "${newline}" >> ${FINALCFG} - fi - fi - done < ${FINALCFG}.tmp - rm ${FINALCFG}.tmp - -}; - -# Loop to check for a specified mount-point in a list -check_for_mount() -{ - MNTS="${1}" - FINDMNT="${2}" - - # Check if we found a valid root partition - for CHECKMNT in `echo ${MNTS} | sed 's|,| |g'` - do - if [ "${CHECKMNT}" = "${FINDMNT}" ] ; then - return 0 - fi - done - - return 1 -}; - -# Function which returns the next line in the specified config file -get_next_cfg_line() -{ - CURFILE="$1" - CURLINE="$2" - - FOUND="1" - - while read line - do - if [ "$FOUND" = "0" ] ; then - export VAL="$line" - return - fi - if [ "$line" = "${CURLINE}" ] ; then - FOUND="0" - fi - done <${CURFILE} - - # Got here, couldn't find this line or at end of file, set VAL to "" - export VAL="" -}; Index: usr.sbin/pc-sysinstall/backend/functions-runcommands.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-runcommands.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which runs commands on the system - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - -run_chroot_cmd() -{ - CMD="$@" - echo_log "Running chroot command: ${CMD}" - echo "$CMD" >${FSMNT}/.runcmd.sh - chmod 755 ${FSMNT}/.runcmd.sh - chroot ${FSMNT} sh /.runcmd.sh - RES=$? - - rm ${FSMNT}/.runcmd.sh - return ${RES} -}; - -run_chroot_script() -{ - SCRIPT="$@" - SBASE=`basename $SCRIPT` - - cp ${SCRIPT} ${FSMNT}/.$SBASE - chmod 755 ${FSMNT}/.${SBASE} - - echo_log "Running chroot script: ${SCRIPT}" - chroot ${FSMNT} /.${SBASE} - RES=$? - - rm ${FSMNT}/.${SBASE} - return ${RES} -}; - - -run_ext_cmd() -{ - CMD="$@" - # Make sure to export FSMNT, in case cmd needs it - export FSMNT - echo_log "Running external command: ${CMD}" - echo "${CMD}"> ${TMPDIR}/.runcmd.sh - chmod 755 ${TMPDIR}/.runcmd.sh - sh ${TMPDIR}/.runcmd.sh - RES=$? - - rm ${TMPDIR}/.runcmd.sh - return ${RES} -}; - - -# Starts the user setup -run_commands() -{ - while read line - do - # Check if we need to run any chroot command - echo $line | grep -q ^runCommand= 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "$line" - run_chroot_cmd "$VAL" - fi - - # Check if we need to run any chroot script - echo $line | grep -q ^runScript= 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "$line" - run_chroot_script "$VAL" - fi - - # Check if we need to run any chroot command - echo $line | grep -q ^runExtCommand= 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "$line" - run_ext_cmd "$VAL" - fi - - done <${CFGF} - -}; Index: usr.sbin/pc-sysinstall/backend/functions-unmount.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-unmount.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which unmount all mounted disk filesystems - -# Unmount all mounted partitions under specified dir -umount_all_dir() -{ - _udir="$1" - _umntdirs=`mount | sort -r | grep "on $_udir" | cut -d ' ' -f 3` - for _ud in $_umntdirs - do - umount -f ${_ud} - done -} - -# Script that adds our gmirror devices for syncing -start_gmirror_sync() -{ - - cd ${MIRRORCFGDIR} - for DISK in `ls ${MIRRORCFGDIR}` - do - MIRRORDISK="`cat ${DISK} | cut -d ':' -f 1`" - MIRRORBAL="`cat ${DISK} | cut -d ':' -f 2`" - MIRRORNAME="`cat ${DISK} | cut -d ':' -f 3`" - - # Start the mirroring service - rc_nohalt "gmirror forget ${MIRRORNAME}" - rc_halt "gmirror insert ${MIRRORNAME} ${MIRRORDISK}" - - done - -}; - -# Unmounts all our mounted file-systems -unmount_all_filesystems() -{ - # Copy the logfile to disk before we unmount - cp ${LOGOUT} ${FSMNT}/root/pc-sysinstall.log - cd / - - # Start by unmounting any ZFS partitions - zfs_cleanup_unmount - - # Lets read our partition list, and unmount each - ################################################################## - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`" - - if [ "${PARTENC}" = "ON" ] - then - EXT=".eli" - else - EXT="" - fi - - if [ "${PARTFS}" = "SWAP" ] - then - rc_nohalt "swapoff ${PARTDEV}${EXT}" - fi - - # Check if we've found "/", and unmount that last - if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ] - then - rc_halt "umount -f ${PARTDEV}${EXT}" - - # Re-check if we are missing a label for this device and create it again if so - if [ ! -e "/dev/label/${PARTLABEL}" ] - then - case ${PARTFS} in - UFS) glabel label ${PARTLABEL} ${PARTDEV}${EXT} ;; - UFS+S) glabel label ${PARTLABEL} ${PARTDEV}${EXT} ;; - UFS+SUJ) glabel label ${PARTLABEL} ${PARTDEV}${EXT} ;; - UFS+J) glabel label ${PARTLABEL} ${PARTDEV}${EXT}.journal ;; - *) ;; - esac - fi - fi - - # Check if we've found "/" and make sure the label exists - if [ "$PARTMNT" = "/" -a "${PARTFS}" != "ZFS" ] - then - if [ ! -e "/dev/label/${PARTLABEL}" ] - then - case ${PARTFS} in - UFS) ROOTRELABEL="glabel label ${PARTLABEL} ${PARTDEV}${EXT}" ;; - UFS+S) ROOTRELABEL="glabel label ${PARTLABEL} ${PARTDEV}${EXT}" ;; - UFS+SUJ) ROOTRELABEL="glabel label ${PARTLABEL} ${PARTDEV}${EXT}" ;; - UFS+J) ROOTRELABEL="glabel label ${PARTLABEL} ${PARTDEV}${EXT}.journal" ;; - *) ;; - esac - fi - fi - done - - # Last lets the /mnt partition - ######################################################### - rc_nohalt "umount -f ${FSMNT}" - - # If are using a ZFS on "/" set it to legacy - if [ ! -z "${FOUNDZFSROOT}" ] - then - rc_halt "zfs set mountpoint=legacy ${FOUNDZFSROOT}" - fi - - # If we need to relabel "/" do it now - if [ ! -z "${ROOTRELABEL}" ] - then - ${ROOTRELABEL} - fi - - # Unmount our CDMNT - rc_nohalt "umount -f ${CDMNT}" >/dev/null 2>/dev/null - - # Check if we need to run any gmirror syncing - ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null - if [ $? -eq 0 ] - then - # Lets start syncing now - start_gmirror_sync - fi - -}; - -# Unmounts any filesystems after a failure -unmount_all_filesystems_failure() -{ - cd / - - # if we did a fresh install, start unmounting - if [ "${INSTALLMODE}" = "fresh" ] - then - - # Lets read our partition list, and unmount each - ################################################################## - if [ -d "${PARTDIR}" ] - then - for PART in `ls ${PARTDIR}` - do - PARTDEV=`echo $PART | sed 's|-|/|g'` - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" - PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" - PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" - - if [ "${PARTFS}" = "SWAP" ] - then - if [ "${PARTENC}" = "ON" ] - then - swapoff ${PARTDEV}.eli >/dev/null 2>/dev/null - else - swapoff ${PARTDEV} >/dev/null 2>/dev/null - fi - fi - - # Check if we've found "/" again, don't need to mount it twice - if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ] - then - umount -f ${PARTDEV} >/dev/null 2>/dev/null - umount -f ${FSMNT}${PARTMNT} >/dev/null 2>/dev/null - fi - done - - # Last lets the /mnt partition - ######################################################### - umount -f ${FSMNT} >/dev/null 2>/dev/null - - fi - else - # We are doing a upgrade, try unmounting any of these filesystems - chroot ${FSMNT} /sbin/umount -a >/dev/null 2>/dev/null - umount -f ${FSMNT}/usr >/dev/null 2>/dev/null - umount -f ${FSMNT}/dev >/dev/null 2>/dev/null - umount -f ${FSMNT} >/dev/null 2>/dev/null - sh ${TMPDIR}/.upgrade-unmount >/dev/null 2>/dev/null - fi - - # Unmount our CDMNT - umount ${CDMNT} >/dev/null 2>/dev/null - -}; Index: usr.sbin/pc-sysinstall/backend/functions-upgrade.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-upgrade.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which perform the mounting / unmount for upgrades - -. ${PROGDIR}/backend/functions-unmount.sh - -mount_target_slice() -{ - MPART="${1}" - - # Import any zpools - zpool import -o altroot=${FSMNT} -a - umount_all_dir "${FSMNT}" - - # Set a variable of files we want to make backups of before doing upgrade - BKFILES="/etc/rc.conf /boot/loader.conf" - - if [ -e "/dev/${MPART}" ] ; then - rc_nohalt "mount /dev/${MPART} ${FSMNT}" - if [ $? -ne 0 ] ; then - # Check if we have ZFS tank name - rc_halt "mount -t zfs ${MPART} ${FSMNT}" - fi - else - # Check if we have ZFS tank name - rc_halt "mount -t zfs ${MPART} ${FSMNT}" - fi - - # Mount devfs in chroot - mount -t devfs devfs ${FSMNT}/dev - - # Check if we have any ZFS partitions to mount - zfs mount -a - - # Mount all the fstab goodies on disk - chroot ${FSMNT} /sbin/mount -a -t nolinprocfs >>${LOGOUT} 2>>${LOGOUT} - chroot ${FSMNT} umount /proc >/dev/null 2>/dev/null - chroot ${FSMNT} umount /compat/linux/proc >/dev/null 2>/dev/null - - # Now before we start the upgrade, make sure we set our noschg flags - echo_log "Cleaning up old filesystem... Please wait..." - rc_halt "chflags -R noschg ${FSMNT}" - - # Make backup copies of some files - for i in ${BKFILES} - do - cp ${FSMNT}${i} ${FSMNT}${i}.preUpgrade >/dev/null 2>/dev/null - done - - # Remove some old dirs - rm -rf ${FSMNT}/etc/rc.d >/dev/null 2>/dev/null - - # If we are doing PC-BSD install, lets cleanup old pkgs on disk - if [ "$INSTALLTYPE" != "FreeBSD" ] - then - echo_log "Removing old packages, this may take a while... Please wait..." - echo '#!/bin/sh -for i in `pkg_info -aE` -do - echo "Uninstalling package: ${i}" - pkg_delete -f ${i} >/dev/null 2>/dev/null -done -' >${FSMNT}/.cleanPkgs.sh - chmod 755 ${FSMNT}/.cleanPkgs.sh - chroot ${FSMNT} /.cleanPkgs.sh - rm ${FSMNT}/.cleanPkgs.sh - run_chroot_cmd "pkg_delete -f \*" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /usr/PCBSD" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /PCBSD" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /var/db/pkgs" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /usr/local32" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /usr/sbin" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /usr/lib" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /usr/bin" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /boot/kernel" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /sbin" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /bin" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /lib" >/dev/null 2>/dev/null - run_chroot_cmd "rm -rf /libexec" >/dev/null 2>/dev/null - fi - -}; - -# Mount the target upgrade partitions -mount_upgrade() -{ - - # Make sure we remove the old upgrade-mount script - rm -rf ${TMPDIR}/.upgrade-unmount >/dev/null 2>/dev/null - - # We are ready to start mounting, lets read the config and do it - while read line - do - echo $line | grep -q "^disk0=" 2>/dev/null - if [ $? -eq 0 ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - DISK="$VAL" - fi - - echo $line | grep -q "^commitDiskPart" 2>/dev/null - if [ $? -eq 0 ] - then - # Found our flag to commit this disk setup / lets do sanity check and do it - if [ -n "${DISK}" ] - then - - # Start mounting this slice - mount_target_slice "${DISK}" - - # Increment our disk counter to look for next disk and unset - unset DISK - break - else - exit_err "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" - fi - fi - - done <${CFGF} - -}; - -copy_skel_files_upgrade() -{ - - # Now make sure we fix any user profile scripts, which cause problems from 7.x->8.x - echo '#!/bin/sh - -cd /home -for i in `ls` -do - - # Backup the old profile dirs - if [ -d "${i}" ] - then - mv /home/${i}/.kde4 /home/${i}/.kde4.preUpgrade >/dev/null 2>/dev/null - mv /home/${i}/.kde /home/${i}/.kde.preUpgrade >/dev/null 2>/dev/null - mv /home/${i}/.fluxbox /home/${i}/.fluxbox.preUpgrade >/dev/null 2>/dev/null - - # Copy over the skel directories - tar cv --exclude "./dot.*" -f - -C /usr/share/skel . 2>/dev/null | tar xvf - -C /home/${i} 2>/dev/null - - for j in `ls /usr/share/skel/dot*` - do - dname=`echo ${j} | sed s/dot//` - cp /usr/share/skel/${j} /home/${i}/${dname} - done - - chown -R ${i}:${i} /home/${i} - fi - -done -' >${FSMNT}/.fixUserProfile.sh - chmod 755 ${FSMNT}/.fixUserProfile.sh - chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null - rm ${FSMNT}/.fixUserProfile.sh - - - - # if the user wants to keep their original .kde4 profile - ########################################################################### - get_value_from_cfg "upgradeKeepDesktopProfile" - if [ "$VAL" = "YES" -o "$VAL" = "yes" ] ; then - echo '#!/bin/sh - cd /home -for i in `ls` -do - # Import the old config again - if [ -d "${i}/.kde4.preUpgrade" ] - then - # Copy over the skel directories - tar cv -f - -C /home/${i}/.kde4.preUpgrade . 2>/dev/null | tar xvf - -C /home/${i}/.kde4 2>/dev/null - chown -R ${i}:${i} /home/${i}/.kde4 - fi -done -' >${FSMNT}/.fixUserProfile.sh - chmod 755 ${FSMNT}/.fixUserProfile.sh - chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null - rm ${FSMNT}/.fixUserProfile.sh - - fi - -}; - -# Function which merges some configuration files with the new defaults -merge_old_configs() -{ - - # Merge the loader.conf with old - cp ${FSMNT}/boot/loader.conf ${FSMNT}/boot/loader.conf.new - merge_config "${FSMNT}/boot/loader.conf.preUpgrade" "${FSMNT}/boot/loader.conf.new" "${FSMNT}/boot/loader.conf" - rm ${FSMNT}/boot/loader.conf.new - - # Merge the rc.conf with old - cp ${FSMNT}/etc/rc.conf ${FSMNT}/etc/rc.conf.new - merge_config "${FSMNT}/etc/rc.conf.preUpgrade" "${FSMNT}/etc/rc.conf.new" "${FSMNT}/etc/rc.conf" - rm ${FSMNT}/etc/rc.conf.new - -}; - -# Function which unmounts all the mounted file-systems -unmount_upgrade() -{ - - # If on PC-BSD, make sure we copy any fixed skel files - if [ "$INSTALLTYPE" != "FreeBSD" ] ; then - copy_skel_files_upgrade - fi - - cd / - - # Unmount FS - umount_all_dir "${FSMNT}" - - # Run our saved unmount script for these file-systems - rc_nohalt "umount -f ${FSMNT}" - - umount ${CDMNT} -}; Index: usr.sbin/pc-sysinstall/backend/functions-users.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions-users.sh +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Functions which runs commands on the system - -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-parse.sh - - -# Function which checks and sets up auto-login for a user if specified -check_autologin() -{ - get_value_from_cfg autoLoginUser - if [ -n "${VAL}" -a "${INSTALLTYPE}" = "PCBSD" ] - then - AUTOU="${VAL}" - # Add the auto-login user line - sed -i.bak "s/AutoLoginUser=/AutoLoginUser=${AUTOU}/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc - - # Add the auto-login user line - sed -i.bak "s/AutoLoginEnable=false/AutoLoginEnable=true/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc - - fi -}; - -# Function which actually runs the adduser command on the filesystem -add_user() -{ - ARGS="${1}" - - if [ -e "${FSMNT}/.tmpPass" ] - then - # Add a user with a supplied password - run_chroot_cmd "cat /.tmpPass | pw useradd ${ARGS}" - rc_halt "rm ${FSMNT}/.tmpPass" - else - # Add a user with no password - run_chroot_cmd "cat /.tmpPass | pw useradd ${ARGS}" - fi - -}; - -# Function which reads in the config, and adds any users specified -setup_users() -{ - - # We are ready to start setting up the users, lets read the config - while read line - do - - echo $line | grep -q "^userName=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERNAME="$VAL" - fi - - echo $line | grep -q "^userComment=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERCOMMENT="$VAL" - fi - - echo $line | grep -q "^userPass=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERPASS="$VAL" - fi - - echo $line | grep -q "^userEncPass=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERENCPASS="$VAL" - fi - - echo $line | grep -q "^userShell=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - strip_white_space "$VAL" - USERSHELL="$VAL" - fi - - echo $line | grep -q "^userHome=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERHOME="$VAL" - fi - - echo $line | grep -q "^userGroups=" 2>/dev/null - if [ $? -eq 0 ] - then - get_value_from_string "${line}" - USERGROUPS="$VAL" - fi - - - echo $line | grep -q "^commitUser" 2>/dev/null - if [ $? -eq 0 ] - then - # Found our flag to commit this user, lets check and do it - if [ -n "${USERNAME}" ] - then - - # Now add this user to the system, by building our args list - ARGS="-n ${USERNAME}" - - if [ -n "${USERCOMMENT}" ] - then - ARGS="${ARGS} -c \"${USERCOMMENT}\"" - fi - - if [ -n "${USERPASS}" ] - then - ARGS="${ARGS} -h 0" - echo "${USERPASS}" >${FSMNT}/.tmpPass - elif [ -n "${USERENCPASS}" ] - then - ARGS="${ARGS} -H 0" - echo "${USERENCPASS}" >${FSMNT}/.tmpPass - else - ARGS="${ARGS} -h -" - rm ${FSMNT}/.tmpPass 2>/dev/null 2>/dev/null - fi - - if [ -n "${USERSHELL}" ] - then - ARGS="${ARGS} -s \"${USERSHELL}\"" - else - ARGS="${ARGS} -s \"/nonexistant\"" - fi - - if [ -n "${USERHOME}" ] - then - ARGS="${ARGS} -m -d \"${USERHOME}\"" - fi - - if [ -n "${USERGROUPS}" ] - then - ARGS="${ARGS} -G \"${USERGROUPS}\"" - fi - - add_user "${ARGS}" - - # Unset our vars before looking for any more users - unset USERNAME USERCOMMENT USERPASS USERENCPASS USERSHELL USERHOME USERGROUPS - else - exit_err "ERROR: commitUser was called without any userName= entry!!!" - fi - fi - - done <${CFGF} - - - # Check if we need to enable a user to auto-login to the desktop - check_autologin - -}; Index: usr.sbin/pc-sysinstall/backend/functions.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/functions.sh +++ /dev/null @@ -1,542 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# functions.sh -# Library of functions which pc-sysinstall may call upon - -# Function which displays the help-index file -display_help() -{ - if [ -e "${PROGDIR}/doc/help-index" ] - then - cat ${PROGDIR}/doc/help-index - else - echo "Error: ${PROGDIR}/doc/help-index not found" - exit 1 - fi -}; - -# Function which displays the help for a specified command -display_command_help() -{ - if [ -z "$1" ] - then - echo "Error: No command specified to display help for" - exit 1 - fi - - if [ -e "${PROGDIR}/doc/help-${1}" ] - then - cat ${PROGDIR}/doc/help-${1} - else - echo "Error: ${PROGDIR}/doc/help-${1} not found" - exit 1 - fi -}; - -# Function to convert bytes to megabytes -convert_byte_to_megabyte() -{ - if [ -z "${1}" ] - then - echo "Error: No bytes specified!" - exit 1 - fi - - expr -e ${1} / 1048576 -}; - -# Function to convert blocks to megabytes -convert_blocks_to_megabyte() -{ - if [ -z "${1}" ] ; then - echo "Error: No blocks specified!" - exit 1 - fi - - expr -e ${1} / 2048 -}; - -# Takes $1 and strips the whitespace out of it, returns VAL -strip_white_space() -{ - if [ -z "${1}" ] - then - echo "Error: No value setup to strip whitespace from!" - - exit 1 - fi - - export VAL=`echo "$1" | tr -d ' '` -}; - -# Displays an error message and exits with error 1 -exit_err() -{ - # Echo the message for the users benefit - echo "EXITERROR: $1" - - # Save this error to the log file - echo "EXITERROR: ${1}" >>$LOGOUT - - # Check if we need to unmount any file-systems after this failure - unmount_all_filesystems_failure - - echo "For more details see log file: $LOGOUT" - - exit 1 -}; - -# Run-command, don't halt if command exits with non-0 -rc_nohalt() -{ - CMD="$1" - - if [ -z "${CMD}" ] - then - exit_err "Error: missing argument in rc_nohalt()" - fi - - echo "Running: ${CMD}" >>${LOGOUT} - ${CMD} >>${LOGOUT} 2>>${LOGOUT} - -}; - -# Run-command, halt if command exits with non-0 -rc_halt() -{ - CMD="$1" - - if [ -z "${CMD}" ] - then - exit_err "Error: missing argument in rc_halt()" - fi - - echo "Running: ${CMD}" >>${LOGOUT} - eval ${CMD} >>${LOGOUT} 2>>${LOGOUT} - STATUS="$?" - if [ "${STATUS}" != "0" ] - then - exit_err "Error ${STATUS}: ${CMD}" - fi -}; - -# Run-command w/echo to screen, halt if command exits with non-0 -rc_halt_echo() -{ - CMD="$1" - - if [ -z "${CMD}" ] - then - exit_err "Error: missing argument in rc_halt_echo()" - fi - - echo "Running: ${CMD}" >>${LOGOUT} - ${CMD} 2>&1 | tee -a ${LOGOUT} - STATUS="$?" - if [ "$STATUS" != "0" ] - then - exit_err "Error ${STATUS}: $CMD" - fi - -}; - -# Run-command w/echo, don't halt if command exits with non-0 -rc_nohalt_echo() -{ - CMD="$1" - - if [ -z "${CMD}" ] - then - exit_err "Error: missing argument in rc_nohalt_echo()" - fi - - echo "Running: ${CMD}" >>${LOGOUT} - ${CMD} 2>&1 | tee -a ${LOGOUT} - -}; - -# Echo to the screen and to the log -echo_log() -{ - STR="$1" - - if [ -z "${STR}" ] - then - exit_err "Error: missing argument in echo_log()" - fi - - echo "${STR}" | tee -a ${LOGOUT} -}; - -# Make sure we have a numeric -is_num() -{ - expr $1 + 1 2>/dev/null - return $? -} - -# Function which uses "fetch" to download a file, and display a progress report -fetch_file() -{ - - FETCHFILE="$1" - FETCHOUTFILE="$2" - EXITFAILED="$3" - - EXITFILE="${TMPDIR}/.fetchExit" - - rm ${FETCHOUTFILE} 2>/dev/null >/dev/null - - SIZE=$(( `fetch -s "${FETCHFILE}"` / 1024 )) - echo "FETCH: ${FETCHFILE}" - echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT} - - ( fetch -o ${FETCHOUTFILE} "${FETCHFILE}" >/dev/null 2>/dev/null ; echo "$?" > ${EXITFILE} ) & - PID="$!" - while - z=1 - do - - if [ -e "${FETCHOUTFILE}" ] - then - DSIZE=`du -k ${FETCHOUTFILE} | tr -d '\t' | cut -d '/' -f 1` - if [ $(is_num "$DSIZE") ] ; then - if [ $SIZE -lt $DSIZE ] ; then DSIZE="$SIZE"; fi - echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}" - echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}" >>${LOGOUT} - fi - fi - - # Check if the download is finished - ps -p ${PID} >/dev/null 2>/dev/null - if [ $? -ne 0 ] - then - break; - fi - - sleep 2 - done - - echo "FETCHDONE" - - EXIT="`cat ${EXITFILE}`" - if [ "${EXIT}" != "0" -a "$EXITFAILED" = "1" ] - then - exit_err "Error: Failed to download ${FETCHFILE}" - fi - - return $EXIT - -}; - -# Function to return a the zpool name for this device -get_zpool_name() -{ - DEVICE="$1" - - # Set the base name we use for zpools - BASENAME="tank" - - if [ ! -d "${TMPDIR}/.zpools" ] ; then - mkdir -p ${TMPDIR}/.zpools - fi - - if [ -e "${TMPDIR}/.zpools/${DEVICE}" ] ; then - cat ${TMPDIR}/.zpools/${DEVICE} - return 0 - else - # Need to generate a zpool name for this device - NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'` - - # Is it used in another zpool? - while : - do - NEWNAME="${BASENAME}${NUM}" - zpool list | grep -qw "${NEWNAME}" - local chk1=$? - zpool import | grep -qw "${NEWNAME}" - local chk2=$? - if [ $chk1 -eq 1 -a $chk2 -eq 1 ] ; then break ; fi - NUM=$((NUM+1)) - done - - # Now save the new tank name - mkdir -p ${TMPDIR}/.zpools/`dirname $DEVICE` - echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE} - echo "${NEWNAME}" - return 0 - fi -}; - -iscompressed() -{ - local FILE - local RES - - FILE="$1" - RES=1 - - if echo "${FILE}" | \ - grep -qiE '\.(Z|lzo|lzw|lzma|gz|bz2|xz|zip)$' 2>&1 - then - RES=0 - fi - - return ${RES} -} - -get_compression_type() -{ - local FILE - local SUFFIX - - FILE="$1" - SUFFIX=`echo "${FILE}" | sed -E 's|^(.+)\.(.+)$|\2|'` - - VAL="" - SUFFIX=`echo "${SUFFIX}" | tr A-Z a-z` - case "${SUFFIX}" in - z) VAL="lzw" ;; - lzo) VAL="lzo" ;; - lzw) VAL="lzw" ;; - lzma) VAL="lzma" ;; - gz) VAL="gzip" ;; - bz2) VAL="bzip2" ;; - xz) VAL="xz" ;; - zip) VAL="zip" ;; - esac - - export VAL -} - -write_image() -{ - local DEVICE_FILE - - IMAGE_FILE="$1" - DEVICE_FILE="$2" - - if [ -z "${IMAGE_FILE}" ] - then - exit_err "ERROR: Image file not specified!" - fi - - if [ -z "${DEVICE_FILE}" ] - then - exit_err "ERROR: Device file not specified!" - fi - - if [ ! -f "${IMAGE_FILE}" ] - then - exit_err "ERROR: '${IMAGE_FILE}' does not exist!" - fi - - DEVICE_FILE="${DEVICE_FILE#/dev/}" - DEVICE_FILE="/dev/${DEVICE_FILE}" - - if [ ! -c "${DEVICE_FILE}" ] - then - exit_err "ERROR: '${DEVICE_FILE}' is not a character device!" - fi - - if iscompressed "${IMAGE_FILE}" - then - local COMPRESSION - - get_compression_type "${IMAGE_FILE}" - COMPRESSION="${VAL}" - - case "${COMPRESSION}" in - lzw) - rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.Z}" - ;; - - lzo) - rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.lzo}" - ;; - - lzma) - rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.lzma}" - ;; - - gzip) - rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.gz}" - ;; - - bzip2) - rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.bz2}" - ;; - - xz) - rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.xz}" - ;; - - zip) - rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" - IMAGE_FILE="${IMAGE_FILE%.zip}" - ;; - - *) - exit_err "ERROR: ${COMPRESSION} compression is not supported" - ;; - esac - - else - rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE}" - - fi -}; - -# Setup and install on a new disk / partition -install_fresh() -{ - # Lets start setting up the disk slices now - setup_disk_slice - - if [ -z "${ROOTIMAGE}" ] - then - - # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels - setup_disk_label - - # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs - # to setup the filesystems - setup_filesystems - - # Lets mount the partitions now - mount_all_filesystems - - # We are ready to begin extraction, lets start now - init_extraction - - # Check if we have any optional modules to load - install_components - - # Check if we have any packages to install - install_packages - - # Do any localization in configuration - run_localize - - # Save any networking config on the installed system - save_networking_install - - # Now add any users - setup_users - - # Do any last cleanup / setup before unmounting - run_final_cleanup - - # Now run any commands specified - run_commands - - # Unmount and finish up - unmount_all_filesystems - fi - - echo_log "Installation finished!" -}; - -# Extract the system to a pre-mounted directory -install_extractonly() -{ - # We are ready to begin extraction, lets start now - init_extraction - - # Check if we have any optional modules to load - install_components - - # Check if we have any packages to install - install_packages - - # Do any localization in configuration - run_localize - - # Save any networking config on the installed system - save_networking_install - - # Now add any users - setup_users - - # Now run any commands specified - run_commands - - # Set a hostname on the install system - setup_hostname - - # Set the root_pw if it is specified - set_root_pw - - echo_log "Installation finished!" -}; - -install_image() -{ - # We are ready to begin extraction, lets start now - init_extraction - - echo_log "Installation finished!" -}; - -install_upgrade() -{ - # We're going to do an upgrade, skip all the disk setup - # and start by mounting the target drive/slices - mount_upgrade - - # Start the extraction process - init_extraction - - # Do any localization in configuration - run_localize - - # Now run any commands specified - run_commands - - # Merge any old configuration files - merge_old_configs - - # Check if we have any optional modules to load - install_components - - # Check if we have any packages to install - install_packages - - # All finished, unmount the file-systems - unmount_upgrade - - echo_log "Upgrade finished!" -}; Index: usr.sbin/pc-sysinstall/backend/installimage.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/installimage.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Source our functions scripts -. ${BACKEND}/functions.sh - -IMAGE_FILE="${1}" -DEVICE_FILE="${2}" - -write_image "${IMAGE_FILE}" "${DEVICE_FILE}" Index: usr.sbin/pc-sysinstall/backend/parseconfig.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/parseconfig.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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$ - -# Main install configuration parsing script -# - -# Source our functions scripts -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-bsdlabel.sh -. ${BACKEND}/functions-cleanup.sh -. ${BACKEND}/functions-disk.sh -. ${BACKEND}/functions-extractimage.sh -. ${BACKEND}/functions-installcomponents.sh -. ${BACKEND}/functions-installpackages.sh -. ${BACKEND}/functions-localize.sh -. ${BACKEND}/functions-mountdisk.sh -. ${BACKEND}/functions-networking.sh -. ${BACKEND}/functions-newfs.sh -. ${BACKEND}/functions-packages.sh -. ${BACKEND}/functions-parse.sh -. ${BACKEND}/functions-runcommands.sh -. ${BACKEND}/functions-ftp.sh -. ${BACKEND}/functions-unmount.sh -. ${BACKEND}/functions-upgrade.sh -. ${BACKEND}/functions-users.sh - -# Check that the config file exists -if [ ! -e "${1}" ] -then - echo "ERROR: Install configuration $1 does not exist!" - exit 1 -fi - -# Set our config file variable -CFGF="$1" - -# Resolve any relative pathing -CFGF="`realpath ${CFGF}`" -export CFGF - -# Start by doing a sanity check, which will catch any obvious mistakes in the config -file_sanity_check "installMode installType installMedium packageType" - -# We passed the Sanity check, lets grab some of the universal config settings and store them -check_value installMode "fresh upgrade extract" -check_value installType "PCBSD FreeBSD" -check_value installMedium "dvd usb ftp rsync image local" -check_value packageType "uzip tar rsync split dist" -if_check_value_exists mirrorbal "load prefer round-robin split" - -# We passed all sanity checks! Yay, lets start the install -echo "File Sanity Check -> OK" - -# Lets load the various universal settings now -get_value_from_cfg installMode -export INSTALLMODE="${VAL}" - -get_value_from_cfg installType -export INSTALLTYPE="${VAL}" - -get_value_from_cfg installMedium -export INSTALLMEDIUM="${VAL}" - -get_value_from_cfg packageType -export PACKAGETYPE="${VAL}" - -# Check if we are doing any networking setup -start_networking - -# If we are not doing an upgrade, lets go ahead and setup the disk -case "${INSTALLMODE}" in - fresh) - if [ "${INSTALLMEDIUM}" = "image" ] - then - install_image - else - install_fresh - fi - ;; - - extract) - # Extracting only, make sure we have a valid target directory - get_value_from_cfg installLocation - export FSMNT="${VAL}" - if [ -z "$FSMNT" ] ; then exit_err "Missing installLocation=" ; fi - if [ ! -d "$FSMNT" ] ; then exit_err "No such directory: $FSMNT" ; fi - - install_extractonly - ;; - - upgrade) - install_upgrade - ;; - - *) - exit 1 - ;; -esac - -exit 0 Index: usr.sbin/pc-sysinstall/backend/startautoinstall.sh =================================================================== --- usr.sbin/pc-sysinstall/backend/startautoinstall.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/sh -#- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright (c) 2010 iXsystems, Inc. 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. -# -# Script which reads the pc-autoinstall.conf directive, and begins the install -# -# $FreeBSD$ - -# Source our functions scripts -. ${BACKEND}/functions.sh -. ${BACKEND}/functions-networking.sh -. ${BACKEND}/functions-parse.sh - -# Check that the config file exists -if [ ! -e "${1}" ] -then - echo "ERROR: Install configuration $1 does not exist!" - exit 1 -fi - -# Set our config file variable -CONF=${1} -INSTALL_CFG="/tmp/pc-sysinstall.cfg" - -# Check if the config file is on disk as well -PCCFG=`grep "pc_config:" ${CONF} | grep -v "^#" | sed "s|pc_config: ||g" | sed "s|pc_config:||g"` -SHUTDOWN_CMD=`grep "shutdown_cmd:" ${CONF} | grep -v "^#" | sed "s|shutdown_cmd: ||g" | sed "s|shutdown_cmd:||g"` -CONFIRM_INS=`grep "confirm_install:" ${CONF} | grep -v "^#" | sed "s|confirm_install: ||g" | sed "s|confirm_install:||g"` - -# Check that this isn't a http / ftp file we need to fetch later -echo "${PCCFG}" | grep -q -e "^http" -e "^ftp" 2>/dev/null -if [ $? -ne 0 ] -then - # Copy over the install cfg file, if not done already - if [ ! -e "${INSTALL_CFG}" ] - then - cp ${PCCFG} ${INSTALL_CFG} - fi - # Make sure we have the file which was copied into /tmp previously - if [ ! -e "${INSTALL_CFG}" ] - then - echo "Error: ${INSTALL_CFG} is missing! Exiting in 10 seconds..." - sleep 10 - exit 150 - fi -else - # We need to fetch a remote file, check and set any nic options before doing so - NICCFG=`grep "nic_config:" ${CONF} | grep -v "^#" | sed "s|nic_config: ||g" | sed "s|nic_config:||g"` - if [ "${NICCFG}" = "dhcp-all" -o "${NICCFG}" = "DHCP-ALL" ] - then - # Try to auto-enable dhcp on any nics we find - enable_auto_dhcp - else - echo "Running command \"ifconfig ${NICCFG}\"" - ifconfig ${NICCFG} - WRKNIC="`echo ${NICCFG} | cut -d ' ' -f 1`" - NICDNS=`grep "nic_dns:" ${CONF} | grep -v "^#" | sed "s|nic_dns: ||g" | sed "s|nic_dns:||g"` - NICGATE=`grep "nic_gateway:" ${CONF} | grep -v "^#" | sed "s|nic_gateway: ||g" | sed "s|nic_gateway:||g"` - - echo "nameserver ${NICDNS}" >/etc/resolv.conf - - echo "Running command \"route add default ${NICGATE}\"" - route add default ${NICGATE} - fi - - get_nic_mac "$WRKNIC" - nic_mac="${FOUNDMAC}" - - PCCFG=`echo ${PCCFG} | sed "s|%%NIC_MAC%%|${nic_mac}|g"` - - # Now try to fetch the remove file - echo "Fetching cfg with: \"fetch -o ${INSTALL_CFG} ${PCCFG}\"" - fetch -o "${INSTALL_CFG}" "${PCCFG}" - if [ $? -ne 0 ] - then - echo "ERROR: Failed to fetch ${PCCFG}, install aborted" - exit 150 - fi - -fi - -# If we end up with a valid config, lets proccede -if [ -e "${INSTALL_CFG}" ] -then - - if [ "${CONFIRM_INS}" != "no" -a "${CONFIRM_INS}" != "NO" ] - then - echo "Type in 'install' to begin automated installation. Warning: Data on target disks may be destroyed!" - read tmp - case $tmp in - install|INSTALL) ;; - *) echo "Install canceled!" ; exit 150 ;; - esac - fi - - pc-sysinstall -c ${INSTALL_CFG} - if [ $? -eq 0 ] - then - if [ -n "$SHUTDOWN_CMD" ] - then - ${SHUTDOWN_CMD} - else - echo "SUCCESS: Installation finished! Press ENTER to reboot." - read tmp - shutdown -r now - fi - else - echo "ERROR: Installation failed, press ENTER to drop to shell." - read tmp - /bin/csh - fi -else - echo "ERROR: Failed to get /tmp/pc-sysinstall.cfg for automated install..." - exit 150 -fi Index: usr.sbin/pc-sysinstall/conf/Makefile =================================================================== --- usr.sbin/pc-sysinstall/conf/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -FILESGROUPS= CONF LICENSE -CONF= exclude-from-upgrade pc-sysinstall.conf avail-langs -CONFDIR= ${SHAREDIR}/pc-sysinstall/conf -LICENSE= licenses/bsd-en.txt licenses/intel-en.txt licenses/nvidia-en.txt -LICENSEDIR= ${SHAREDIR}/pc-sysinstall/conf/license - -.include Index: usr.sbin/pc-sysinstall/conf/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/conf/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/conf/avail-langs =================================================================== --- usr.sbin/pc-sysinstall/conf/avail-langs +++ /dev/null @@ -1,20 +0,0 @@ -en English -bg Bulgarian -ca Catalan -zh_TW Chinese_(Taiwan) -cs Czech -nl Dutch -fr French -de German -en_GB English_(UK) -en_ZA English_(South Africa) -it Italian -ja Japanese -pt_BR Portuguese_(Brazil) -pl Polish -pa Punjabi -ru Russian -sk Slovak -sl Slovenian -es Spanish -uk Ukrainian Index: usr.sbin/pc-sysinstall/conf/exclude-from-upgrade =================================================================== --- usr.sbin/pc-sysinstall/conf/exclude-from-upgrade +++ /dev/null @@ -1,15 +0,0 @@ -etc/fstab -dev -etc/passwd -etc/pwd.db -etc/group -etc/master.passwd -etc/spwd.db -etc/hosts -etc/resolv.conf -etc/localtime -etc/hosts -etc/X11 -etc/nsmb.conf -usr/Programs/.config/ProgList -Programs/.config/ProgList Index: usr.sbin/pc-sysinstall/conf/licenses/bsd-en.txt =================================================================== --- usr.sbin/pc-sysinstall/conf/licenses/bsd-en.txt +++ /dev/null @@ -1,24 +0,0 @@ -SECTION 1: BSD LICENSE --------------------------------------------------------------------------------- -Copyright (c) 1998, Regents of the University of California -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 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. - Neither the name of the University of California, Berkeley nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPR -ESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO E -VENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCI -DENTAL, 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 AN 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. Index: usr.sbin/pc-sysinstall/conf/licenses/intel-en.txt =================================================================== --- usr.sbin/pc-sysinstall/conf/licenses/intel-en.txt +++ /dev/null @@ -1,207 +0,0 @@ -Section 2: Intel Firmware license --------------------------------------------------------------------------------- - TERMS AND CONDITIONS - IMPORTANT - PLEASE READ BEFORE INSTALLING OR USING THIS INTEL(C) SOFTWARE - -Do not use or load this firmware (the "Software") until you have carefully read -the following terms and conditions. By loading or using the Software, you agree -to the terms of this Agreement. If you do not wish to so agree, do not install -or use the Software. - -LICENSEES: - -Please note: - -* If you are an End-User, only Exhibit A, the SOFTWARE LICENSE AGREEMENT, - applies. -* If you are an Original Equipment Manufacturer (OEM), Independent Hardware - Vendor (IHV), or Independent Software Vendor (ISV), this complete Agreement - applies - --------------------------------------------------------------------------------- - -For OEMs, IHVs, and ISVs: - -LICENSE. This Software is licensed for use only in conjunction with Intel -component products. Use of the Software in conjunction with non-Intel component -products is not licensed hereunder. Subject to the terms of this Agreement, -Intel grants to you a nonexclusive, nontransferable, worldwide, fully paid-up -license under Intel's copyrights to: (i) copy the Software internally for your -own development and maintenance purposes; (ii) copy and distribute the Software -to your end-users, but only under a license agreement with terms at least as -restrictive as those contained in Intel's Final, Single User License Agreement, -attached as Exhibit A; and (iii) modify, copy and distribute the end-user -documentation which may accompany the Software, but only in association with -the Software. - -If you are not the final manufacturer or vendor of a computer system or software -program incorporating the Software, then you may transfer a copy of the -Software, including any related documentation (modified or unmodified) to your -recipient for use in accordance with the terms of this Agreement, provided such -recipient agrees to be fully bound by the terms hereof. You shall not otherwise -assign, sublicense, lease, or in any other way transfer or disclose Software to -any third party. You may not, nor may you assist any other person or entity to -modify, translate, convert to another programming language, decompile, reverse -engineer, or disassemble any portion of the Software or otherwise attempt to -derive source code from any object code modules of the Software or any internal -data files generated by the Software. Your rights to redistribute the Software -shall be contingent upon your installation of this Agreement in its entirety in -the same directory as the Software. - -CONTRACTORS. For the purpose of this Agreement, and notwithstanding anything -to the contrary hereunder, solely with respect to the requirements for -compliance with the terms hereunder, any contractors or consultants that You -use to perform the work or otherwise assist You in the development or products -using this Software shall be deemed to be End Users and accordingly, upon -receipt of the Software, shall be bound by the terms of Exhibit A, Software -License Agreement. No additional agreement between You and such consultants or -contractors is required under this Agreement to detail such compliance. - -TRADEMARKS. Except as expressly provided herein, you shall not use Intel's -name in any publications, advertisements, or other announcements without -Intel's prior written consent. You do not have any rights to use any Intel -trademarks or logos. - -OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Software and accompanying materials, if -any, are owned by Intel or its suppliers and licensors and may be protected by -copyright, trademark, patent and trade secret law and international treaties. -Any rights, express or implied, in the intellectual property embodied in the -foregoing, other than those specified in this Agreement, are reserved by Intel -and its suppliers and licensors or otherwise as set forth in any applicable -open source license agreement. You will keep the Software free of liens, -attachments, and other encumbrances. You agree not to remove any proprietary -notices and/or any labels from the Software and accompanying materials without -prior written approval by Intel - -LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS AND LICENSORS -BE LIABLE FOR ANY DAMAGES WHATSOEVER FROM ANY CAUSE OF ACTION OF ANY KIND -(INCLUDING, WITHOUT LIMITATION, LOST PROFITS, BUSINESS INTERRUPTION, OR LOST -INFORMATION) ARISING OUT OF THE USE, MODIFICATION, OR INABILITY TO USE THE -INTEL SOFTWARE, OR OTHERWISE, NOR FOR PUNITIVE, INCIDENTAL, CONSEQUENTIAL, OR -SPECIAL DAMAGES OF ANY KIND, EVEN IF INTEL OR ITS SUPPLIERS AND LICENSORS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT -EXCLUSION OR LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES, CONSEQUENTIAL OR -INCIDENTAL DAMAGES, SO CERTAIN LIMITATIONS MAY NOT APPLY. YOU MAY ALSO HAVE -OTHER LEGAL RIGHTS THAT VARY BETWEEN JURISDICTIONS. - -EXCLUSION OF WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS" AND POSSIBLY WITH -FAULTS. UNLESS EXPRESSLY AGREED OTHERWISE, INTEL AND ITS SUPPLIERS AND -LICENSORS DISCLAIM ANY AND ALL WARRANTIES AND GUARANTEES, EXPRESS, IMPLIED OR -OTHERWISE, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. Intel does not warrant -or assume responsibility for the accuracy or completeness of any information, -text, graphics, links or other items contained within the Software. You assume -all liability, financial or otherwise, associated with Your use or disposition -of the Software. - -APPLICABLE LAW. Claims arising under this Agreement shall be governed by the -laws of State of California], excluding its principles of conflict of laws and -the United Nations Convention on Contracts for the Sale of Goods. - -WAIVER AND AMENDMENT. No modification, amendment or waiver of any provision of -this Agreement shall be effective unless in writing and signed by an officer of -Intel. No failure or delay in exercising any right, power, or remedy under -this Agreement shall operate as a waiver of any such right, power or remedy. -Without limiting the foregoing, terms and conditions on any purchase orders or -similar materials submitted by you to Intel, and any terms contained in Intel’s -standard acknowledgment form that are in conflict with these terms, shall be of -no force or effect. - -SEVERABILITY. If any provision of this Agreement is held by a court of -competent jurisdiction to be contrary to law, such provision shall be changed -and interpreted so as to best accomplish the objectives of the original -provision to the fullest extent allowed by law and the remaining provisions of -this Agreement shall remain in full force and effect. - -EXPORT RESTRICTIONS. Each party acknowledges that the Software is subject to -applicable import and export regulations of the United States and of the -countries in which each party transacts business, specifically including U.S. -Export Administration Act and Export Administration Regulations. Each party -shall comply with such laws and regulations, as well as all other laws and -regulations applicable to the Software. Without limiting the generality of the -foregoing, each party agrees that it will not export, re-export, transfer or -divert any of the Software or the direct programs thereof to any restricted -place or party in accordance with U.S. export regulations. Note that Software -containing encryption may be subject to additional restrictions. - -GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED RIGHTS." -Use, duplication, or disclosure by the Government is subject to restrictions as -set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or their successors. Use -of the Software by the Government constitutes acknowledgment of Intel's -proprietary rights therein. Contractor or Manufacturer is Intel Corporation, -2200 Mission College Blvd., Santa Clara, CA 95052. - -TERMINATION OF THE AGREEMENT. Intel may terminate this Agreement if you violate -its terms. Upon termination, you will immediately destroy the Software or -return all copies of the Software to Intel. - --------------------------------------------------------------------------------- - -EXHIBIT "A" - -SOFTWARE LICENSE AGREEMENT (Final, Single User) - -IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING. - -Do not use or load this firmware image (the "Software") until you have carefully -read the following terms and conditions. By loading or using the Software, you -agree to the terms of this Agreement. If you do not wish to so agree, do not -install or use the Software. - -LICENSE. You may copy and use the Software, subject to these conditions: -1. This Software is licensed for use only in conjunction with Intel component - products. Use of the Software in conjunction with non-Intel component - products is not licensed hereunder. -2. You may not copy, modify, rent, sell, distribute or transfer any part of the - Software except as provided in this Agreement, and you agree to prevent - unauthorized copying of the Software. -3. You may not reverse engineer, decompile, or disassemble the Software. -4. You may not sublicense the Software. -5. The Software may contain the software or other property of third party - suppliers. - -OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software -remains with Intel or its suppliers. The Software is copyrighted and protected -by the laws of the United States and other countries, and international treaty -provisions. You may not remove any copyright notices from the Software. Intel -may make changes to the Software, or items referenced therein, at any time -without notice, but is not obligated to support or update the Software. Except -as otherwise expressly provided, Intel grants no express or implied right under -Intel patents, copyrights, trademarks, or other intellectual property rights. -You may transfer the Software only if a copy of this license accompanies the -Software and the recipient agrees to be fully bound by these terms. - -EXCLUSION OF OTHER WARRANTIES EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS PROVIDED -"AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING -WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR -PURPOSE. Intel does not warrant or assume responsibility for the accuracy or -completeness of any information, text, graphics, links or other items contained -within the Software. - -LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE FOR -ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS, BUSINESS -INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR INABILITY TO -USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR LIMITATION OF LIABILITY FOR -IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE -LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE OTHER LEGAL RIGHTS THAT VARY -BETWEEN JURISDICTIONS. - -TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time if -you violate its terms. Upon termination, you will immediately destroy the -Software. - -APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the -laws of California, excluding its principles of conflict of laws and the United -Nations Convention on Contracts for the Sale of Goods. You may not export the -Software in violation of applicable export laws and regulations. Intel is not -obligated under any other agreements unless they are in writing and signed by -an authorized representative -of Intel. - -GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED RIGHTS." -Use, duplication, or disclosure by the Government is subject to restrictions as -set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or their successors. Use -of the Software by the Government constitutes acknowledgment of Intel's -proprietary rights therein. Contractor or Manufacturer is Intel Corporation, -2200 Mission College Blvd., Santa Clara, CA 95052. Index: usr.sbin/pc-sysinstall/conf/licenses/nvidia-en.txt =================================================================== --- usr.sbin/pc-sysinstall/conf/licenses/nvidia-en.txt +++ /dev/null @@ -1,53 +0,0 @@ -Section 3: NVIDIA driver license agreement --------------------------------------------------------------------------------- -License For Customer Use of NVIDIA Software - -IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries ("NVIDIA") downloadable herefrom, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download the SOFTWARE. - -RECITALS - -Use of NVIDIA's products requires three elements: the SOFTWARE, the hardware on a graphics controller board, and a personal computer. The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is not sold, and instead is only licensed for use, strictly in accordance with this document. The hardware is protected by various patents, and is sold, but this LICENSE does not cover that sale, since it may not necessarily be sold as a package with the SOFTWARE. This LICENSE sets forth the terms and conditions of the SOFTWARE LICENSE only. - -1. DEFINITIONS - -1.1 Customer. Customer means the entity or individual that downloads the SOFTWARE. - -2. GRANT OF LICENSE - -2.1 Rights and Limitations of Grant. NVIDIA hereby grants Customer the following non-exclusive, non-transferable right to use the SOFTWARE, with the following limitations: - -2.1.1 Rights. Customer may install and use one copy of the SOFTWARE on a single computer, and except for making one back-up copy of the Software, may not otherwise copy the SOFTWARE. This LICENSE of SOFTWARE may not be shared or used concurrently on different computers. - -2.1.2 Linux/FreeBSD Exception. Notwithstanding the foregoing terms of Section 2.1.1, SOFTWARE designed exclusively for use on the Linux or FreeBSD operating systems, or other operating systems derived from the source code to these operating systems, may be copied and redistributed, provided that the binary files thereof are not modified in any way (except for unzipping of compressed files). - -2.1.3 Limitations. - -No Reverse Engineering. Customer may not reverse engineer, decompile, or disassemble the SOFTWARE, nor attempt in any other manner to obtain the source code. - -No Separation of Components. The SOFTWARE is licensed as a single product. Its component parts may not be separated for use on more than one computer, nor otherwise used separately from the other parts. - -No Rental. Customer may not rent or lease the SOFTWARE to someone else. - -3. TERMINATION - -This LICENSE will automatically terminate if Customer fails to comply with any of the terms and conditions hereof. In such event, Customer must destroy all copies of the SOFTWARE and all of its component parts. - -Defensive Suspension. If Customer commences or participates in any legal proceeding against NVIDIA, then NVIDIA may, in its sole discretion, suspend or terminate all license grants and any other rights provided under this LICENSE during the pendency of such legal proceedings. - -4. COPYRIGHT - -All title and copyrights in and to the SOFTWARE (including but not limited to all images, photographs, animations, video, audio, music, text, and other information incorporated into the SOFTWARE), the accompanying printed materials, and any copies of the SOFTWARE, are owned by NVIDIA, or its suppliers. The SOFTWARE is protected by copyright laws and international treaty provisions. Accordingly, Customer is required to treat the SOFTWARE like any other copyrighted material, except as otherwise allowed pursuant to this LICENSE and that it may make one copy of the SOFTWARE solely for backup or archive purposes. - -5. APPLICABLE LAW - -This LICENSE shall be deemed to have been made in, and shall be construed pursuant to, the laws of the State of California. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed. - -6. DISCLAIMER OF WARRANTIES AND LIMITATION ON LIABILITY - -6.1 No Warranties. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED "AS IS" AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -6.2 No Liability for Consequential Damages. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. MISCELLANEOUS - -If any provision of this LICENSE is inconsistent with, or cannot be fully enforced under, the law, such provision will be construed as limited to the extent necessary to be consistent with and fully enforceable under the law. This LICENSE is the final, complete and exclusive agreement between the parties relating to the subject matter hereof, and supersedes all prior or contemporaneous understandings and agreements relating to such subject matter, whether oral or written. This LICENSE may only be modified in writing signed by an authorized officer of NVIDIA. Customer agrees that it will not ship, transfer or export the SOFTWARE into any country, or use the SOFTWARE in any manner, prohibited by the United States Bureau of Export Administration or any export laws, restrictions or regulations. Index: usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf =================================================================== --- usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# $FreeBSD$ -# Configuration options for pc-sysinstall - -TMPDIR="/tmp/.pc-sysinstall" -export TMPDIR - -# Create a fresh TMPDIR -if [ -d "${TMPDIR}" -a "$TMPDIR" != '/' ]; then rm -rf ${TMPDIR}; fi -mkdir -p ${TMPDIR} - -# Set our temp directory for storing partition information -PARTDIR="${TMPDIR}/part-info" -export PARTDIR - -# Set the SLICECFGDIR -SLICECFGDIR="${TMPDIR}/.slice-cfg" -export SLICECFGDIR - -# Set the MIRRORCFGDIR -MIRRORCFGDIR="${TMPDIR}/.mirror-cfg" -export MIRRORCFGDIR - -# Set the GELIKEYDIR -GELIKEYDIR="${TMPDIR}/.geli-keys" -export GELIKEYDIR - -# Set our log file -LOGOUT="${TMPDIR}/pc-sysinstall.log" -export LOGOUT - -# Set the number of rsync tries -RSYNCTRIES="3" -export RSYNCTRIES - -# Set our mount-points -CDMNT=${CDMNT-/cdmnt-install} -FSMNT=${FSMNT-/mnt} -UZIP_DIR="/usr" -BOOT_PART_MOUNT="/boot-mount" -export FSMNT CDMNT UZIP_DIR BOOT_PART_MOUNT - -# Set the location of component files on DVD / usb / ftp -# Relative to CDMNT or the FTP root -COMPFILEDIR="extras/" -export COMPFILEDIR - -# Set the component temp directory, which is relative to FSMNT -COMPTMPDIR="/usr/.componenttmp" -export COMPTMPDIR - -# set the package temp directory, which is relative to FSMNT -PKGTMPDIR="/usr/.pkgtmp" -export PKGTMPDIR - -# Variables to set the location of installation data -UZIP_FILE="PCBSD.ufs.uzip" -TAR_FILE="PCBSD.tbz" -export UZIP_FILE TAR_FILE - -# Locations of FreeBSD only install files -FBSD_UZIP_FILE="fbsd-release.ufs.uzip" -FBSD_TAR_FILE="fbsd-release.tbz" -FBSD_BRANCH="8.0-RELEASE" -FBSD_BRANCH_DIR="${FBSD_BRANCH}" -FBSD_ARCH=`uname -m` -export FBSD_UZIP_FILE FBSD_TAR_FILE FBSD_BRANCH FBSD_BRANCH_DIR FBSD_ARCH - -# Location of image file -IMAGE_FILE="/home/john/tmp/PCBSD8.1-x86-USB.img" -export IMAGE_FILE - -# Our internet mirror listing file location -NETSERVER="http://updates.pcbsd.org" -ARCH="`uname -m`" - -# Check if we are running on a PC-BSD Disk -if [ -e "/PCBSDVERSION" ] ; then - VERSION="`cat /PCBSDVERSION`" -else - VERSION="UNKNOWN" -fi - -MIRRORLIST="${NETSERVER}/mirrors-netinstall.php?ver=${VERSION}&arch=${ARCH}" Index: usr.sbin/pc-sysinstall/doc/Makefile =================================================================== --- usr.sbin/pc-sysinstall/doc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -FILES= help-disk-list help-disk-size help-index help-start-autoinstall - -FILESDIR=${SHAREDIR}/pc-sysinstall/doc - -.include Index: usr.sbin/pc-sysinstall/doc/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/doc/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/doc/help-disk-list =================================================================== --- usr.sbin/pc-sysinstall/doc/help-disk-list +++ /dev/null @@ -1 +0,0 @@ -Holder Index: usr.sbin/pc-sysinstall/doc/help-disk-size =================================================================== --- usr.sbin/pc-sysinstall/doc/help-disk-size +++ /dev/null @@ -1 +0,0 @@ -Holder Index: usr.sbin/pc-sysinstall/doc/help-index =================================================================== --- usr.sbin/pc-sysinstall/doc/help-index +++ /dev/null @@ -1,100 +0,0 @@ -pc-sysinstall Help Index ------------------------------------------------ -Help Commands - - help - Display this index file - - help - Display the help data for the specified command - -System Query Commands - install-image - Installs an image file to a device file - - disk-list - Provides a listing of the disk drives detected on this system - - disk-part - Queries the specified disk and returns information about its partitions - - disk-info - Returns information about the disks size, cyls, heads, and sectors - - detect-laptop - Tests to see if this system is a laptop or desktop - - detect-emulation - Tests to see if this system is actually running in an emulator such as VirtualBox - - detect-nics - Returns a listing of the detected network cards on this system - - list-config - Returns a listing of the pc-sysinstall configuration - - list-components - Returns a listing of the available components which can be installed - - list-mirrors [country] - Returns a listing of the available FTP mirrors - - list-packages [category] [package] - Returns a listing of the available packages - - list-rsync-backups - Returns a listing of available rsync-backups on the target server in the life-preserver/ dir - - list-tzones - Returns a listing of available timezones - - query-langs - Return a list of languages that the installer supports - - get-packages - Retrieves the list of packages from an FTP mirror - - sys-mem - Return the size of installed system RAM in MegaBytes - - set-mirror - Set FTP mirror - - test-netup - Test if an internet connection is available - - update-part-list - Return a list of PC-BSD & FreeBSD installs on this system for updates - - xkeyboard-layouts - Return a list of keyboard layouts that xorg supports - - xkeyboard-models - Return a list of keyboard models that xorg supports - - xkeyboard-variants - Return a list of keyboard variants that xorg supports - -Partition Management Commands - - create-part - Create a new MBR primary slice on the target using MB - - delete-part - Deletes the disk partition specified. If this is the last partition, - the disk partition layout will also be scrubbed, leaving a clean disk - ready for MBR or GPT file system layouts. - - -Installation Commands - - -c - Begin a install / upgrade with the specified cfg file - - start-autoinstall - Start an automated installation with the specified conf file - Normally only used by automated install scripts - - setup-ssh-keys - Setup SSH without a password for the target host and user and port - Use to prompt the user to log into a server before doing a rsync + ssh restore Index: usr.sbin/pc-sysinstall/doc/help-start-autoinstall =================================================================== --- usr.sbin/pc-sysinstall/doc/help-start-autoinstall +++ /dev/null @@ -1,39 +0,0 @@ -start-autoinstall - HELP ------------------------------------------------ - -About: - start-autoinstall is used when performing automated installationsr. It is able - to configure networking with provided settings, and fetch an installation script from - http / ftp server. This allows media to be created which fetches dynamic configuration - options from a server-side supplier. - -Usage: - pc-sysinstall start-autoinstall - -Config Syntax: - - The configuration file for start-autoinstall can contain the following options: - - pc_config: - - Location of the pc-sysinstall installation configuration file, can be local - or start with http:// or ftp:// to fetch from a remote system. - - shutdown_cmd: - - Command to execute post-installation, such as "shutdown -p now" or other. - - confirm_install: (YES/NO) - - Prompt on the console to begin installation. Defaults to YES. - Warning: Setting this to NO will start an installation as soon as start-autoinstall - is run. (I.E. after booting some install media) It may be dangerous if a disk is left - in a drive and the system is turned on! - - nic_config: (DHCP-ALL / ) - - When set to DHCP-ALL, the software will attempt to get a network address from DHCP on - any / all detected NICS. If set to some other command, it will be used as an argument - to "ifconfig" to enable networking. - - nic_dns: - - Use the following DNS server for networking - - nic_gateway: - - Use the following default route / gateway for networking Index: usr.sbin/pc-sysinstall/examples/Makefile =================================================================== --- usr.sbin/pc-sysinstall/examples/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -FILES= README pc-autoinstall.conf pcinstall.cfg.fbsd-netinstall \ - pcinstall.cfg.geli pcinstall.cfg.gmirror pcinstall.cfg.netinstall \ - pcinstall.cfg.restore pcinstall.cfg.rsync pcinstall.cfg.upgrade \ - pcinstall.cfg.zfs - -FILESDIR=${SHAREDIR}/examples/pc-sysinstall - -.include Index: usr.sbin/pc-sysinstall/examples/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/examples/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/examples/README =================================================================== --- usr.sbin/pc-sysinstall/examples/README +++ /dev/null @@ -1,403 +0,0 @@ -pc-sysinstall README - -This file documents many of the variables used in pc-sysinstall -config scripts -################################################################# - -# hostname= - -Using hostname= will set the specified hostname on the -installed system - -When hostname= is not present, pc-sysinstall will auto-generate -a hostname such as freebsd-XXXX or pcbsd-XXXX - -# installMode=(fresh/upgrade/extract) - -Set the type of install we are doing. - -Fresh installs will format and mount the target disks before -extracting the install images to the system. Using this mode -it is also possible to do a system restore, by specifying a -full system backup as the install source. - -Upgrades will mount the target disk, and extract the system -archive to the disk, overwriting files on the disk. -The conf/exclude-from-upgrade file can be used to specify -additional files to exclude from overwriting during the -install process. - -Extract will skip any disk setup, and perform an installation -to the directory specified by "installLocation=". This location -should be a directory with your pre-mounted file-systems ready -for file extraction. When using the "extract" option, /etc/fstab -on the installed system will *not* be automatically configured. - -# installLocation= - -Used only when installMode is set to extract. - -This is set to the location you want to extract your system to, -and should already be mounted properly. - -# installInteractive=(yes or no) - -Set if the installer is running in interactive mode, and -is able to prompt for input from the user, defaults to no - - -######################################################################## -# NETWORK SETTINGS -######################################################################## - -# netDev=(AUTO-DHCP or ) - -netDev specifies what type of networking to enable for the installer -Can be set to AUTO-DHCP or to a network interface, such as et0 - -When set to AUTO-DHCP, pc-sysinstall will probe for all network devices -and attempt to set DHCP mode on each, until a working network connection -is established - -If netDev= is set to a network interface such as et0, the following options -will need to be set in order to enable the interface - -# netIP=(IP address such as 192.168.0.100) - - Set netIP to an address that you wish to have the interface specified in - netDev set to - Only used when netDev is not set to AUTO-DHCP - -# netMask=(Netmask such as 255.255.255.0) - -Set netMask to the address you with to have the interface specified in -netDev set to -Only used when netDev is not set to AUTO-DHCP - - -# netNameServer=(DNS Server such as 192.168.0.1) - -Set netNameServer to the DNS address you want to use during the install -Only used when netDev is not set to AUTO-DHCP - - -# netDefaultRouter=(192.168.0.1) - -Set netDefaultRouter to the gateway you wish to have the installer use -Only used when netDev is not set to AUTO-DHCP - - - -# netSaveDev=(AUTO-DHCP or network interface) - -netSaveDev specifies what networking to enable on the installed system - -When set to AUTO-DHCP, pc-sysinstall will probe all network interfaces, and -set them all to DHCP in the systems /etc/rc.conf file. Wireless devices will also -have the corresponding wlan[0-9] device created. - -When set to a network interface, pc-sysinstall will set the target device with -the settings specified by the variables below. - -# netSaveIP=192.168.0.49 -# netSaveMask=255.255.255.0 -# netSaveNameServer=208.67.222.222 -# netSaveDefaultRouter=192.168.0.1 - - - - -######################################################################## -# DISK SLICE SETTINGS -######################################################################## - -The following section specifies the target disk(s) to be used in the -install or upgrade. - -# disk0=(disk device, such as ad0) - -The diskX= variable should be set to the target device for this drive, such -as ad0, da0 -The first should begin with disk0=, and additional drives to disk1=, disk2 -if additional disks are to be setup. - -When doing an upgrade, the disk0= line should be set to the root device or -root zpool of the target system to update. I.E: - # disk0=tank0 - # disk0=ada0s1a - - -# partition=(all, free, s1, s1, s3, s4, image) - -After setting disk[0-9], the partition= variable is used to specify which target -partition we will be working with for this device. - -Setting this to "all" will setup the disk with a single FreeBSD slice as "s1" - -Setting this to "free" will allow pc-sysinstall to search for the first available -primary slice with free space, and create the slice. - -Setting this to "s1, s2, s3 or s4" will use the specified MBR slice. - -Setting this to "image" will use an image to configure the disk. - -(This tag is unused for upgrades) - -# partscheme=(MBR/GPT) - -When performing a "full" disk (partition=all), the partscheme= variable is used -to determine the partition scheme type gpart will be using on the disk. Valid -choices are MBR or GPT. - -# mirror=(disk device such as ad1) - -Setting the mirror= variable will setup the target device as a gmirror -of the diskX= device. The mirror device must be the same size or larger -than the drive being mirrored. - - -# mirrorbal=(load, prefer, round-robin, split) - -Allows the setting of the mirror balance method to be used, if not -specified this defaults to "round-robin" - -# bootManager=(none, bsd) - -Setting this option will instruct pc-sysinstall to install the BSD boot Manager, -or leave it empty - -# image=(/path/to/image/file) (/mountpoint) - -Setting this option will instruct pc-sysinstall to write the image file -specified by the path to the disk. - -# commitDiskPart - -This command must be placed at the end of the diskX= section, before starting -the listing of any additional diskX= directives. - - -######################################################################## -# DISK PARTITION / MOUNT SETTINGS -######################################################################## - -The following settings specify the partitioning / mount points to setup -on the target partition - -# disk0-part=UFS+S 500 / (-n -o time) -# disk0-part=SWAP 2000 none -# disk0-part=UFS.eli 500 /usr -# encpass=mypass -# disk0-part=UFS+J 500 /tmp -# disk0-part=ZFS 0 /data,/storage (mirror: ad1) -# commitDiskLabel - -The above values instructs pc-sysinstall which partitions / mounts -to create on the target drive / slice, specified by "disk0". -(disk0 will resolve to the drive / slice specified in the previous section) - -The notation is as follows: - - -Available FileSystems: - UFS - Standard UFS2 FileSystem -UFS+S - UFS2 + Softupdates enabled -UFS+SUJ - UFS2 + Soft Updates + Journaling enabled -UFS+J - UFS2 + Journaling through gjournal - ZFS - Z File System, pools / mounts created automatically - SWAP - BSD Swap space partition, mountpoint should be set to "none" - -Adding the ".eli" extension to any of the above file systems -will enable disk encryption via geli -(UFS.eli, UFS+S.eli, UFS+SUJ.eli, UFS+J.eli, ZFS.eli, SWAP.eli) - -If you with to use a passphrase with this encrypted partition, on the next line -the flag "encpass=" should be entered: -encpass=mypass - -All sizes are expressed in MegaBytes -Specifying a size 0 instructs pc-sysinstall to use the rest of the -available slice size, and should only be used for the last partition / mount - -When using "UFS" and its various types, it is possible to specify custom options -for newfs using (). For examplei: -disk0-part=UFS+SUJ 1000 / (-o time) -In this case "-o time" would be passed to newfs when creating the "/" filesystem. - - -When using "ZFS" specifically, it is possible to specify additional disks / partitions -to include in the zpool. By using the syntax: (mirror: ad1,ad2) or (raidz: ad1,ad2), it is possible -to include the disk "ad1" into the zpool for this partition, using the raidz / mirror methods. -If you with to just include the disk into the pool in "basic" mode, then use (ad1,ad2) with no flags - -######################################################################## -# INSTALL OPTIONS / SOURCES -######################################################################## - -The following settings specify the type, locations and sources -for this installation - -# installMedium=(dvd, usb, ftp, rsync, image) - -Set installMedium= to the source type we will be using for this install. - -Available Types: - dvd - Search for and mount the DVD which contains the install archive -local - Pull files directly from a local directory - usb - Search for and mount the USB drive which contains the install archive - ftp - The install archive will be fetched from a FTP / HTTP server before install -rsync - Pull the system data from a ssh + rsync server, specified with variables below -image - Install system from an image - -# localPath=/usr/freebsd-dist - -Location of the directory we will be pulling installation files from - -# installType=(PCBSD, FreeBSD) - -Set the type of system we are installing, PCBSD or FreeBSD - -# installFile=fbsd-release.tbz - -The installer archive, if not using the defaults specified in conf/pc-sysinstall.conf - -# packageType=(tar, uzip, split, dist) - -The archive type we are extracting from when using dvd, usb or ftp - -# distFiles=base src kernel - -List of dist files to install when packageType=dist - -# ftpPath=ftp://ftp.pcbsd.org/pub/8.0/netinstall - -Location of the installer archive when using a installMedium=ftp - -# rsyncPath=life-preserver/back-2009-11-12T14_53_14 - -The location of the rsync data on the remote server when using installMedium=rsync - -# rsyncUser=rsyncuser - -The username to use for the ssh server running rsync - -# rsyncHost=192.168.0.50 - -The rsync / ssh server we wish to connect to - -# rsyncPort=22 - -The port to use when connecting to a ssh + rsync server - -# installComponents=amarok,firefox,ports - -The specified components to install, view available with "./pc-sysinstall list-components" - - -######################################################################## -# UPGRADE OPTIONS -######################################################################## - -Options specific to performing an upgrade - -# upgradeKeepDesktopProfile=(yes/no) - -This option allows you to specify if you wish to keep your existing users desktop -profile data. The default is NO, and your existing profile will be moved to -.kde4.preUpgrade automatically. - -######################################################################## -# USER OPTIONS -######################################################################## - -Options for setting up usernames and passwords on the installed system - -# rootPass=root - -Set the root password of the installed system to the specified plaintext string - -# rootEncPass= - -Set the root password of the installed system to the specified encrypted string - -The below variables are used to setup a user on the installed system -Be sure to call commitUser after after adding these values, and before -starting another user block - -# userName=kris -# userComment=Kris Moore -# userPass=mypass -or -# userEncPass= -# userShell=/bin/csh -# userHome=/home/kris -# userGroups=wheel,operator -# commitUser - -######################################################################## -# RUN COMMANDS -######################################################################## - -The following variables can be set to run commands post-installation, -allowing the user to further tweak / modify the system - -# runCommand= - -Run the specified command within chroot of the installed system - -# runScript= - -runScript will copy the specified script into FSMNT, and run it in chroot of the system -Useful when you have a 3rd party script on the DVD / USB, and you want to copy it into -the installed system and run - -# runExtCommand= - -runExtCommand is used when you wish to run a command outside the chroot -The variable $FSMNT is set to the mount-point of your installed system - - -######################################################################## -# PC-BSD SPECIFIC OPTIONS -######################################################################## - -Options for time-zones and NTP on the installed system - -# timeZone= - -timeZone can be set to the zone file in /usr/share/zoneinfo/ that is to be used -example: America/New_York - -# enableNTP= (yes / no) - -set enableNTP to yes or no to enable or disable the NTP service on the system - - -######################################################################## -# PC-BSD SPECIFC OPTIONS -######################################################################## - -Options specific to installing PC-BSD, such as localization, and KDE settings - -# localizeLang=en - -localizeLang will set the system console and Desktop to the target language - -# localizeKeyLayout=en - -localizeKeyLayout updates the system's xorg config to set the keyboard layout - -# localizeKeyModel=pc104 - -localizeKeyModel updates the system's xorg config to set the keyboard model - -# localizeKeyVariant=intl - -localizeKeyVariant is used to update the xorg config to set the keyboard variant - -# autoLoginUser=kris - -Setting autoLoginUser will enable the specified user to log into the desktop -automatically without entering a password - -$FreeBSD$ Index: usr.sbin/pc-sysinstall/examples/pc-autoinstall.conf =================================================================== --- usr.sbin/pc-sysinstall/examples/pc-autoinstall.conf +++ /dev/null @@ -1,52 +0,0 @@ -# pc-autoinstall.conf example -# $FreeBSD$ -# -# Usage: Modify these variables, and copy the file to -# /boot/pc-autoinstall.conf on your PC-BSD installation medium -# -# The conf will then be read at bootup, and your automated -# install will take place -################################################################## - -# Where the pc-sysinstall main config is located -# Can be either a file on the booted CD / DVD / USB media, -# or a remote file on http / ftp -# -# The value %%NIC_MAC%% is special, and will be substituted with -# the macaddress of the enabled NIC from DHCP or manually set -# with 'nic_config:' -################################################################## - -# Examples: -# pc_config: ftp://192.168.0.2/cust-install.cfg -# pc_config: http://192.168.0.2/cust-install.cfg -# pc_config: http://192.168.0.2/%%NIC_MAC%%.cfg -# pc_config: /boot/cust-install.cfg - -# Set this to yes if we should confirm before doing an install -# This should normally be set to yes, otherwise booting the wrong -# disk will result in a system wipe -# confirm_install: no -confirm_install: yes - -# Set the command to run post-install, usually best to run shutdown -# but this can be replaced with any other command / script you wish -# to execute post-install -# shutdown_cmd: shutdown -p now - -# Options for the network setup, should the cfg need to be fetched -# from a remote location, only necessary when using ftp or http -################################################################## - -# Special option, will attempt dhcp on all found NICs -# until the file can be fetched, or we run out of interfaces -# nic_config: dhcp-all - -# Line to be passed to the "ifconfig" command to bring up an interface -# nic_config: em0 192.168.0.101 255.255.255.0 - -# DNS server to use -# nic_dns: 192.168.0.1 - -# Default router / gateway -# nic_gateway: 192.168.0.1 Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall +++ /dev/null @@ -1,71 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=fresh -installInteractive=yes -hostname=pcbsd8 - -# Set the disk parameters -disk0=ad0 -partition=all -bootManager=none -commitDiskPart - -# Setup the disk label -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -disk0-part=UFS 1000 / -disk0-part=SWAP 2000 none -disk0-part=UFS 0 /usr -# Size 0 means use the rest of the slice size -# Do it now! -commitDiskLabel - -netDev=AUTO-DHCP -#netDev=nfe0 -#netIP=192.168.0.49 -#netMask=255.255.255.0 -#netNameServer=208.67.222.222 -#netDefaultRouter=192.168.0.1 - -netSaveDev=AUTO-DHCP -#netSaveDev=nfe0 -#netSaveIP=192.168.0.49 -#netSaveMask=255.255.255.0 -#netSaveNameServer=208.67.222.222 -#netSaveDefaultRouter=192.168.0.1 - -# Set if we are installing via optical, USB, or FTP -#installType=PCBSD -installType=FreeBSD -#installMedium=dvd -installMedium=ftp - -ftpPath=ftp://192.168.0.2/netinstall - -#packageType=uzip -packageType=tar - -# List our components to install -installComponents=ports,src - -# Setup user "kris" to log into the desktop automatically -autoLoginUser=kris - -# Set the root pass -rootPass=root - -# Setup our users -userName=kris -userComment=Kris Moore -userPass=kris -userShell=/bin/csh -userHome=/home/kris -userGroups=wheel,operator -commitUser - -# Options for localizing an install -localizeLang="ru" -localizeKeyLayout="ru" -localizeKeyModel="pc104" -localizeKeyVariant="intl" Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.geli =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.geli +++ /dev/null @@ -1,50 +0,0 @@ -# Auto-Generated pc-sysinstall configuration -#$FreeBSD$ - -installInteractive=no -installMode=fresh -installType=FreeBSD -packageType=tar -installMedium=dvd -netSaveDev=AUTO-DHCP - -# Timezone -timeZone=America/New_York -enableNTP=yes - -# Keyboard Layout Options -localizeKeyModel=pc104 -localizeKeyLayout=us - -# Disk Setup for ad0 -disk0=ad0 -partition=ALL -bootManager=none -commitDiskPart - -# Partition Setup for ad0(ALL) -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli -disk0-part=UFS 500 /boot -disk0-part=UFS.eli 500 / -disk0-part=UFS.eli 500 /usr -encpass=mypass -commitDiskLabel - -# Optional Components -installComponents= - -# Root Password -rootPass=mypass - -# Users -userName=kris -userComment=Kris Moore -userPass=mypass -userShell=/bin/csh -userHome=/home/kris -userGroups=wheel,operator -autoLoginUser=kris -commitUser - Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror +++ /dev/null @@ -1,45 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=fresh -installInteractive=yes -hostname=pcbsd8 - -# Set the disk parameters -disk0=ad0 -mirror=ad1 -mirrorbal=split -partition=all -bootManager=bsd -commitDiskPart - -# Setup the disk label -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -disk0-part=UFS+S 500 / -disk0-part=SWAP 2000 none -disk0-part=UFS+S 0 /usr -# Size 0 means use the rest of the slice size -# Do it now! -commitDiskLabel - -# Set if we are installing via optical, USB, or FTP -installType=FreeBSD -installMedium=dvd - -#packageType=uzip -packageType=tar -#installComponents=ports,src - -# Run any commands post-install -runCommand=echo 'root' | pw usermod root -h 0 -#runScript=/root/test.sh -#runExtCommand=echo 'hey there'; touch $FSMNT/touched - -#autoLoginUser=kris - -# Options for localizing an install -localizeLang="ru" -localizeKeyLayout="ru" -localizeKeyModel="pc104" -localizeKeyVariant="intl" Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall +++ /dev/null @@ -1,68 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=fresh -installInteractive=yes -hostname=pcbsd8 - -# Set the disk parameters -disk0=ad0 -partition=all -bootManager=none -commitDiskPart - -# Setup the disk label -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -disk0-part=UFS 1000 / -disk0-part=SWAP 2000 none -disk0-part=UFS 0 /usr -# Size 0 means use the rest of the slice size -# Do it now! -commitDiskLabel - -netDev=AUTO-DHCP -#netDev=nfe0 -#netIP=192.168.0.49 -#netMask=255.255.255.0 -#netNameServer=208.67.222.222 -#netDefaultRouter=192.168.0.1 - -netSaveDev=AUTO-DHCP -#netSaveDev=nfe0 -#netSaveIP=192.168.0.49 -#netSaveMask=255.255.255.0 -#netSaveNameServer=208.67.222.222 -#netSaveDefaultRouter=192.168.0.1 - -# Set if we are installing via optical, USB, or FTP -#installType=PCBSD -installType=FreeBSD -#installMedium=dvd -installMedium=ftp - -ftpPath=ftp://192.168.0.2/netinstall - -#packageType=uzip -packageType=tar -#installComponents=ports,src - -#autoLoginUser=kris - -# Set the root pass -rootPass=root - -# Setup our users -userName=kris -userComment=Kris Moore -userPass=kris -userShell=/bin/csh -userHome=/home/kris -userGroups=wheel,operator -commitUser - -# Options for localizing an install -localizeLang="ru" -localizeKeyLayout="ru" -localizeKeyModel="pc104" -localizeKeyVariant="intl" Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.restore =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.restore +++ /dev/null @@ -1,57 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=fresh -installInteractive=no -hostname=freebsd8 - -# Set the disk parameters -disk0=ad1 -partition=all -bootManager=none -commitDiskPart - -# Setup the disk label -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli -disk0-part=UFS+S 500 / -disk0-part=SWAP.eli 2000 none -disk0-part=UFS+S 0 /usr -# Size 0 means use the rest of the slice size -# Do it now! -commitDiskLabel - -# Set if we are installing via optical, USB, or FTP -installType=FreeBSD -installMedium=dvd -installFile=freebsd-release.tbz - -#packageType=uzip -packageType=tar -#installComponents=ports,src - -# Run any commands post-install -#runCommand=echo 'root' | pw usermod root -h 0 -#runScript=/root/test.sh -#runExtCommand=echo 'hey there'; touch $FSMNT/touched - -# Set the root pass -rootPass=root - -# Setup our users -userName=kris -userComment=Kris Moore -userPass=kris -userShell=/bin/csh -userHome=/home/kris -userGroups=wheel,operator -commitUser - -#autoLoginUser=kris - -# Options for localizing an install -localizeLang="ru" -localizeKeyLayout="ru" -localizeKeyModel="pc104" -localizeKeyVariant="intl" Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.rsync =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.rsync +++ /dev/null @@ -1,45 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=fresh -installInteractive=yes -hostname=pcbsd8 - -# Set the disk parameters -disk0=ad0 -partition=all -bootManager=none -commitDiskPart - -# Setup the disk label -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -disk0-part=UFS 2000 / -disk0-part=SWAP 2000 none -disk0-part=UFS 0 /usr -# Size 0 means use the rest of the slice size -# Do it now! -commitDiskLabel - -netDev=AUTO-DHCP -#netDev=nfe0 -#netIP=192.168.0.49 -#netMask=255.255.255.0 -#netNameServer=208.67.222.222 -#netDefaultRouter=192.168.0.1 - -# Set if we are installing via optical, USB, or FTP -#installType=PCBSD -installType=FreeBSD -#installMedium=dvd -installMedium=rsync - -rsyncPath=life-preserver/back-2009-11-12T14_53_14 -rsyncUser=lifep -rsyncHost=192.168.0.50 -rsyncPort=22 - -#packageType=uzip -packageType=tar -#installComponents=ports,src - Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# Sample configuration file for an installation using pc-sysinstall -#$FreeBSD$ - -installMode=upgrade -installInteractive=no -hostname=freebsd8 - -# Set the disk parameters -disk0=ada0s1a -bootManager=none -commitDiskPart - -# Set if we are installing via optical, USB, or FTP -installType=PCBSD -installMedium=dvd - -packageType=uzip -#installComponents=ports,src - -# Options for localizing an install -localizeLang="ru" -localizeKeyLayout="ru" -localizeKeyModel="pc104" -localizeKeyVariant="intl" Index: usr.sbin/pc-sysinstall/examples/pcinstall.cfg.zfs =================================================================== --- usr.sbin/pc-sysinstall/examples/pcinstall.cfg.zfs +++ /dev/null @@ -1,59 +0,0 @@ -# Auto-Generated pc-sysinstall configuration -#$FreeBSD$ -installInteractive=no -installMode=fresh -installType=FreeBSD -packageType=tar -installMedium=dvd -netSaveDev=AUTO-DHCP - -# Timezone -timeZone=America/New_York -enableNTP=yes - -# Keyboard Layout Options -localizeKeyModel=pc104 -localizeKeyLayout=us - -# Disk Setup for ad0 -disk0=ad0 -partition=ALL -bootManager=none -commitDiskPart - -# Partition Setup for ad0(ALL) -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli -disk0-part=ZFS 0 /,/usr,/var,/data (mirror: ad1) -commitDiskLabel - -# Disk Setup for ad3 -disk1=ad3 -partition=ALL -bootManager=none -commitDiskPart - -# Partition Setup for ad3(ALL) -# All sizes are expressed in MB -# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP -# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli -disk1-part=SWAP 0 none -commitDiskLabel - -# Optional Components -installComponents= - -# Root Password -rootPass=mypass - -# Users -userName=kris -userComment=Kris Moore -userPass=mypass -userShell=/bin/csh -userHome=/home/kris -userGroups=wheel,operator -autoLoginUser=kris -commitUser - Index: usr.sbin/pc-sysinstall/pc-sysinstall/Makefile =================================================================== --- usr.sbin/pc-sysinstall/pc-sysinstall/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD$ - -SCRIPTS=pc-sysinstall.sh -MAN= pc-sysinstall.8 - -.include Index: usr.sbin/pc-sysinstall/pc-sysinstall/Makefile.depend =================================================================== --- usr.sbin/pc-sysinstall/pc-sysinstall/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif Index: usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 =================================================================== --- usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 +++ /dev/null @@ -1,120 +0,0 @@ -.\" Copyright (c) 2010 -.\" iXsystems, Inc. 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 Jordan Hubbard 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$ -.\" -.Dd June 24, 2010 -.Dt PC-SYSINSTALL 8 -.Os -.Sh NAME -.Nm pc-sysinstall -.Nd System installer backend -.Sh SYNOPSIS -.Nm -.Op Fl c Ar file -.Op Ar command -.Sh DESCRIPTION -The -.Nm -utility is a hybrid backend for installing FreeBSD. When run in install mode -it takes a configuration file and performs an installation according to the -parameters specified in the configuration file. When called with one of -the system query commands it provides information about the system to aid a -front end in building an appropriate configuration file. -.Pp -The following options are available: -.Bl -tag -width indent -.It Fl c Ar file -Perform an installation as directed by -.Ar file. -.El -.Sh COMMANDS -The -.Cm command -can be any one of the following: -.Bl -tag -width indent -.It help -Display a list of all commands. -.It help Ar command -Display the help data for the specified command. -.It disk-list -Provide a listing of the storage devices detected on this system. -.It disk-part Ar disk -Queries the specified storage device and returns information about its -partitions. -.It disk-info Ar disk -Returns information about a storage device's size, cylinders, heads, and -sectors. -.It detect-laptop -Tests to see if this system is a laptop or desktop. -.It detect-emulation -Tests to see if this system is running in an emulator -.It detect-nics -Returns a listing of the detected network cards on this system. -.It list-components -Returns a listing of the available components which can be installed. -.It list-rsync-backups Ar user Ar host Ar port -Returns a listing of available rsync-backups on the target server in the -life-preserver/ directory. -.It list-tzones -Returns a listing of available timezones. -.It query-langs -Returns a list of languages that the installer supports. -.It sys-mem -Returns the size of installed system RAM in MegaBytes. -.It test-netup -test if an internet connection is available. -.It update-part-list -Returns a list of PC-BSD and FreeBSD installs on this system for updates. -.It xkeyboard-layouts -Returns a list of keyboard layouts that xorg supports. -.It xkeyboard-models -Returns a list of keyboard models that xorg supports. -.It xkeyboard-variants -Returns a list of keyboard variants that xorg supports. -.It create-part Ar disk Ar size -Create a new MBR primary slice on the target disk using size MB. -.It delete-part Ar partition -Delete the disk partition specified. If this is the last partition, the -disk partition layout will also be scrubbed, leaving a clean disk ready -for MBR or GPT file system layouts. -.It start-autoinstall Ar file -Start an automated installation with the specified file. Normally only -used by automated install scripts. -.It setup-ssh-keys Ar user Ar host Ar port -Setup SSH without a password for the target host, user, and port. Used to -prompt the user to log into a server before doing a rsync + ssh restore. -.El -.Sh HISTORY -This version of -.Nm -first appeared in -.Fx 9.0 . -.Sh AUTHORS -.An Kris Moore Aq Mt kmoore@FreeBSD.org -.Sh BUGS -This utility was written to install PC-BSD and has seen limited use as an -installer for FreeBSD. It's likely that usage to install FreeBSD will expose -edge cases that PC-BSD doesn't, as well as generate feature requests based -on unforeseen needs. Index: usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh =================================================================== --- usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/sh -##################################################################### -# Author: Kris Moore -# License: BSD -# Description: pc-sysinstall provides a backend for performing -# system installations, as well as calls which a front-end can use -# to retrive information about the system -##################################################################### -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD -# -# Copyright 2010 iXsystems -# All rights reserved -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted providing 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 ``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. -# -# $FreeBSD$ -##################################################################### - -# User-editable configuration variables - -# Set this to the program location -if [ -z "${PROGDIR}" ] -then - PROGDIR="/usr/share/pc-sysinstall" - export PROGDIR -fi - -# Set this to the components location -COMPDIR="${PROGDIR}/components" -export COMPDIR - -CONFDIR="${PROGDIR}/conf" -export CONFDIR - -# Set this to the packages location -PKGDIR="${CONFDIR}" -export PKGDIR - -# End of user-editable configuration -##################################################################### - -# Set our QUERYDIR -QUERYDIR="${PROGDIR}/backend-query" -export QUERYDIR - -# Set our BACKEND -BACKEND="${PROGDIR}/backend" -export BACKEND - -PARTMANAGERDIR="${PROGDIR}/backend-partmanager" -export PARTMANAGERDIR - -# Start by sourcing our conf file -if [ -e "${PROGDIR}/conf/pc-sysinstall.conf" ] -then - . ${PROGDIR}/conf/pc-sysinstall.conf -else - echo "ERROR: Could not find ${PROGDIR}/conf/pc-sysinstall.conf" - exit 1 -fi - -# Now source our functions.sh -if [ -e "${PROGDIR}/backend/functions.sh" ] -then - . ${PROGDIR}/backend/functions.sh -else - echo "ERROR: Could not find ${PROGDIR}/backend/functions.sh" - exit 1 -fi - - -# Check if we are called without any flags and display help -if [ -z "${1}" ] -then - # Display the help index - display_help - exit 0 -fi - -case $1 in - # The -c flag has been given, time to parse the script - -c) - if [ -z "${2}" ] - then - display_help - else - ${BACKEND}/parseconfig.sh ${2} - exit $? - fi - ;; - - # The user requsted help - help) - if [ -z "${2}" ] - then - display_help - else - display_command_help ${2} - fi - ;; - - # Install an image file to a device - install-image) ${BACKEND}/installimage.sh "${2}" "${3}" - ;; - - # Parse an auto-install directive, and begin the installation - start-autoinstall) ${BACKEND}/startautoinstall.sh ${2} - ;; - - # The user is wanting to create a new partition - create-part) ${PARTMANAGERDIR}/create-part.sh "${2}" "${3}" "${4}" "${5}" - ;; - - # The user is wanting to delete an existing partition - delete-part) ${PARTMANAGERDIR}/delete-part.sh "${2}" - ;; - - # The user is wanting to check if we are on a laptop or desktop - detect-laptop) ${QUERYDIR}/detect-laptop.sh - ;; - - # The user is wanting to see what nics are available on the system - detect-nics) ${QUERYDIR}/detect-nics.sh - ;; - - # The user is wanting to check if we are in emulation - detect-emulation) ${QUERYDIR}/detect-emulation.sh - ;; - - # The user is wanting to query a disk's information - disk-info) ${QUERYDIR}/disk-info.sh ${2} - ;; - - # The user is wanting to query which disks are available - disk-list) ${QUERYDIR}/disk-list.sh $* - ;; - - # The user is wanting to query a disk's partitions - disk-part) ${QUERYDIR}/disk-part.sh ${2} - ;; - - # Function allows the setting of networking by a calling front-end - enable-net) ${QUERYDIR}/enable-net.sh "${2}" "${3}" "${4}" "${5}" "${6}" "${7}" - ;; - - # Function which lists components available - list-components) ${QUERYDIR}/list-components.sh - ;; - - # Function which lists pc-sysinstall configuration - list-config) ${QUERYDIR}/list-config.sh - ;; - - # Function which lists available FTP mirrors - list-mirrors) ${QUERYDIR}/list-mirrors.sh "${2}" - ;; - - # Function which lists available packages - list-packages) ${QUERYDIR}/list-packages.sh "${2}" "${3}" - ;; - - # Function which lists available backups on a rsync/ssh server - list-rsync-backups) ${QUERYDIR}/list-rsync-backups.sh "${2}" "${3}" "${4}" - ;; - - # Function which lists timezones available - list-tzones) ${QUERYDIR}/list-tzones.sh - ;; - - # Requested a list of languages this install will support - query-langs) ${QUERYDIR}/query-langs.sh - ;; - - # Function which creates a error report, and mails it to the specified address - send-logs) ${QUERYDIR}/send-logs.sh ${2} - ;; - - # Function to get package index - get-packages) ${QUERYDIR}/get-packages.sh "${2}" - ;; - - # Function to set FTP mirror - set-mirror) ${QUERYDIR}/set-mirror.sh "${2}" - ;; - - # Function which allows setting up of SSH keys - setup-ssh-keys) ${QUERYDIR}/setup-ssh-keys.sh "${2}" "${3}" "${4}" - ;; - - # Function which lists the real memory of the system in MB - sys-mem) ${QUERYDIR}/sys-mem.sh - ;; - - # Run script which determines if we are booted from install media, or on disk - test-live) ${QUERYDIR}/test-live.sh - ;; - - # The user is wanting to test if the network is up and working - test-netup) ${QUERYDIR}/test-netup.sh - ;; - - # The user is wanting to get a list of partitions available to be updated / repaired - update-part-list) ${QUERYDIR}/update-part-list.sh - ;; - - # Requested a list of keyboard layouts that xorg supports - xkeyboard-layouts) ${QUERYDIR}/xkeyboard-layouts.sh - ;; - - # Requested a list of keyboard models that xorg supports - xkeyboard-models) ${QUERYDIR}/xkeyboard-models.sh - ;; - - # Requested a list of keyboard variants that xorg supports - xkeyboard-variants) ${QUERYDIR}/xkeyboard-variants.sh - ;; - - *) echo "Unknown Command: ${1}" - exit 1 ;; -esac - -# Exit with success if we made it to the end -exit $?