summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall/backend-query
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pc-sysinstall/backend-query')
-rw-r--r--usr.sbin/pc-sysinstall/backend-query/Makefile12
-rw-r--r--usr.sbin/pc-sysinstall/backend-query/Makefile.depend11
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/detect-emulation.sh41
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/detect-laptop.sh32
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/detect-nics.sh36
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/disk-info.sh60
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/disk-list.sh112
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/disk-part.sh111
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/enable-net.sh114
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/get-packages.sh52
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-components.sh55
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-config.sh30
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-mirrors.sh37
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-packages.sh86
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh70
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/list-tzones.sh34
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/query-langs.sh30
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/send-logs.sh83
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/set-mirror.sh40
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh64
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/sys-mem.sh39
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/test-live.sh33
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/test-netup.sh69
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/update-part-list.sh99
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh67
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh58
-rwxr-xr-xusr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh56
27 files changed, 1531 insertions, 0 deletions
diff --git a/usr.sbin/pc-sysinstall/backend-query/Makefile b/usr.sbin/pc-sysinstall/backend-query/Makefile
new file mode 100644
index 0000000..e5541b7
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/Makefile
@@ -0,0 +1,12 @@
+# $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 <bsd.prog.mk>
diff --git a/usr.sbin/pc-sysinstall/backend-query/Makefile.depend b/usr.sbin/pc-sysinstall/backend-query/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh b/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh
new file mode 100755
index 0000000..5eefd26
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh
new file mode 100755
index 0000000..d23a420
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh
new file mode 100755
index 0000000..2f7272a
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/disk-info.sh b/usr.sbin/pc-sysinstall/backend-query/disk-info.sh
new file mode 100755
index 0000000..adaeaa5
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/disk-info.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+#-
+# 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}"
diff --git a/usr.sbin/pc-sysinstall/backend-query/disk-list.sh b/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
new file mode 100755
index 0000000..2616ef9
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+#-
+# 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 find some identification information with camcontrol
+ NEWLINE=$(camcontrol identify $DEV 2>/dev/null | sed -ne 's/^device model *//p')
+ if [ -z "$NEWLINE" ]; then
+ NEWLINE=" <Unknown Device>"
+ fi
+
+ if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null
+ then
+ NEWLINE=" <Memory Disk>"
+ 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/disk-part.sh b/usr.sbin/pc-sysinstall/backend-query/disk-part.sh
new file mode 100755
index 0000000..e5e7355
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/disk-part.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+#-
+# 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"
diff --git a/usr.sbin/pc-sysinstall/backend-query/enable-net.sh b/usr.sbin/pc-sysinstall/backend-query/enable-net.sh
new file mode 100755
index 0000000..8cd72a1
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/enable-net.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+#-
+# 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 <nic> <ip> <netmask> <dns> <gateway> <ipv6> " \
+ "<ipv6gateway> <ipv6dns>"
+ 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/get-packages.sh b/usr.sbin/pc-sysinstall/backend-query/get-packages.sh
new file mode 100755
index 0000000..6bdcd3b
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/get-packages.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-components.sh b/usr.sbin/pc-sysinstall/backend-query/list-components.sh
new file mode 100755
index 0000000..a7cde89
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-components.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-config.sh b/usr.sbin/pc-sysinstall/backend-query/list-config.sh
new file mode 100755
index 0000000..b7edda2
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-config.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh b/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh
new file mode 100755
index 0000000..0fe209d
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-packages.sh b/usr.sbin/pc-sysinstall/backend-query/list-packages.sh
new file mode 100755
index 0000000..45941ff
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-packages.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh b/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh
new file mode 100755
index 0000000..68ced7f
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#-
+# 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 <user> <host> <port>"
+ 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh b/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh
new file mode 100755
index 0000000..c7009b0
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/query-langs.sh b/usr.sbin/pc-sysinstall/backend-query/query-langs.sh
new file mode 100755
index 0000000..2ce6066
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/query-langs.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/send-logs.sh b/usr.sbin/pc-sysinstall/backend-query/send-logs.sh
new file mode 100755
index 0000000..b81087c
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/send-logs.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh b/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh
new file mode 100755
index 0000000..23306bb
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh b/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh
new file mode 100755
index 0000000..ac3d6ac
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+#-
+# 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 <user> <host> <port>"
+ 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"
diff --git a/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh b/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh
new file mode 100755
index 0000000..a726370
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/test-live.sh b/usr.sbin/pc-sysinstall/backend-query/test-live.sh
new file mode 100755
index 0000000..86acc30
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/test-live.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#-
+# 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'
diff --git a/usr.sbin/pc-sysinstall/backend-query/test-netup.sh b/usr.sbin/pc-sysinstall/backend-query/test-netup.sh
new file mode 100755
index 0000000..e0a3eba
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/test-netup.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh b/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh
new file mode 100755
index 0000000..298609b
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
new file mode 100755
index 0000000..17821be
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh
new file mode 100755
index 0000000..c89811e
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#-
+# 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
diff --git a/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh
new file mode 100755
index 0000000..c8c0aa5
--- /dev/null
+++ b/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#-
+# 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
OpenPOWER on IntegriCloud