diff options
Diffstat (limited to 'usr/sbin/pc-sysinstall/backend-query')
25 files changed, 1381 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..0f14446 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/Makefile,v 1.5 2010/07/13 23:47:12 imp Exp $ + +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 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 +NO_OBJ= + +.include <bsd.prog.mk> 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 100644 index 0000000..81f8f26 --- /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: src/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh,v 1.1 2010/07/06 23:31:52 imp Exp $ + +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 100644 index 0000000..5fdadf3 --- /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: src/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh,v 1.4 2010/07/07 00:03:06 imp Exp $ + +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 100644 index 0000000..b16d162 --- /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: src/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh,v 1.3 2010/07/06 23:29:55 imp Exp $ + +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 100644 index 0000000..75c0386 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/disk-info.sh @@ -0,0 +1,68 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/disk-info.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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}" + +get_disk_cyl "${DISK}" +CYLS="${VAL}" + +get_disk_heads "${DISK}" +HEADS="${VAL}" + +get_disk_sectors "${DISK}" +SECS="${VAL}" + +echo "cylinders=${CYLS}" +echo "heads=${HEADS}" +echo "sectors=${SECS}" + +# 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}) +echo "size=$MB" + +# Now get the Controller Type +CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`" +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 100644 index 0000000..06bf04b --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/disk-list.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: src/usr.sbin/pc-sysinstall/backend-query/disk-list.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# Create our device listing +SYSDISK=$(sysctl -n kern.disks) + +# 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 + case "${DEV}" in + acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; + esac + + # Check the dmesg output for some more info about this device + NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) + if [ -z "$NEWLINE" ]; then + NEWLINE=" <Unknown Device>" + 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 100644 index 0000000..9ddd47d --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/disk-part.sh @@ -0,0 +1,119 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/disk-part.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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 +gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null +if [ "$?" = "0" ] ; then + echo "${1}-format: GPT" + TYPE="GPT" +else + echo "${1}-format: MBR" + TYPE="MBR" +fi + +# 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 100644 index 0000000..9d40142 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/enable-net.sh @@ -0,0 +1,65 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/enable-net.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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" + +if [ -z "${NIC}" ] +then + echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>" + exit 150 +fi + +if [ "$NIC" = "AUTO-DHCP" ] +then + enable_auto_dhcp +else + echo "Enabling NIC: $NIC" + ifconfig ${NIC} ${IP} ${NETMASK} + + echo "nameserver ${DNS}" >/etc/resolv.conf + + route add default ${GATE} +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 100644 index 0000000..4ff17f6 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/get-packages.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: src/usr.sbin/pc-sysinstall/backend-query/get-packages.sh,v 1.1 2010/07/13 23:47:12 imp Exp $ + +# Script which lists the available packages for this release +########################################################################### + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/backend/functions-packages.sh + +DEFAULT_FTP_SERVER="ftp.freebsd.org" +FTP_SERVER="${1}" +ID=`id -u` + +if [ "${ID}" -ne "0" ] +then + echo "Error: must be root!" + exit 1 +fi + +if [ -z "${FTP_SERVER}" ] +then + FTP_SERVER="${DEFAULT_FTP_SERVER}" +fi + +if [ ! -f "${PKGDIR}/INDEX" ] +then + get_package_index "${FTP_SERVER}" +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 100644 index 0000000..299ce28 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/list-components.sh @@ -0,0 +1,54 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/list-components.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# Script which lists the available components for this release +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +echo "Available Components:" + +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 + 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 100644 index 0000000..6532031 --- /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: src/usr.sbin/pc-sysinstall/backend-query/list-config.sh,v 1.2 2010/07/13 23:47:12 imp Exp $ + +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 100644 index 0000000..a4b143f --- /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: src/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh,v 1.2 2010/07/13 23:47:12 imp Exp $ + +. ${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 100644 index 0000000..dcf7c00 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/list-packages.sh @@ -0,0 +1,74 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/list-packages.sh,v 1.1 2010/07/13 23:47:12 imp Exp $ + +# 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 + +echo "Available Packages:" +if [ "${NARGS}" -eq "0" ] +then + show_packages + +elif [ "${NARGS}" -eq "1" ] +then + show_packages_by_category "${PACKAGE_CATEGORY}" + +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 100644 index 0000000..3459528 --- /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: src/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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 100644 index 0000000..973f892 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/list-tzones.sh @@ -0,0 +1,43 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +# Backend script which lists all the available timezones for front-ends to display +while read line +do + echo "$line" | grep "^#" >/dev/null 2>/dev/null + if [ "$?" != "0" ] + then + echo "$line" | tr -s "\t" ":" | cut -d ":" -f 3-4 >>${TMPDIR}/.tzonetmp + fi +done < /usr/share/zoneinfo/zone.tab + +sort ${TMPDIR}/.tzonetmp +rm -f ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +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 100644 index 0000000..044f41b --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/query-langs.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: src/usr.sbin/pc-sysinstall/backend-query/query-langs.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +FOUND="0" + +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 100644 index 0000000..155169c --- /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: src/usr.sbin/pc-sysinstall/backend-query/send-logs.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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 >> ${TMPLOG} +fi + +# Save dmesg output +echo "" >>${TMPLOG} +echo "# DMESG OUTPUT " >>${TMPLOG} +dmesg >> ${TMPLOG} + +# Get gpart info on all disks +for i in `${PROGDIR}/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/setup-ssh-keys.sh b/usr/sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh new file mode 100644 index 0000000..9fe6b97 --- /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: src/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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 100644 index 0000000..6fcf9b2 --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/sys-mem.sh @@ -0,0 +1,31 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +MEM=`sysctl hw.realmem | sed "s|hw.realmem: ||g"` +MEM=`expr $MEM / 1024` +MEM=`expr $MEM / 1024` +echo $MEM 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 100644 index 0000000..7c61cae --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/test-live.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: src/usr.sbin/pc-sysinstall/backend-query/test-live.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# Script which checks if we are running from install media, or real system +############################################################################# + +dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "INSTALL-MEDIA" + exit 0 +else + echo "REAL-DISK" + exit 1 +fi + 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 100644 index 0000000..dc8c71a --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/test-netup.sh @@ -0,0 +1,50 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/test-netup.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + + +# Script which tests "fetch" when using a network connection, and saves +# if we are using direct connect, or need FTP passive mode +############################################################################# + +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 + +ping -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 100644 index 0000000..9a2a77e --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/update-part-list.sh @@ -0,0 +1,109 @@ +#!/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: src/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +# 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() { + + VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`" + if [ "$?" = "0" ] ; then + file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null + if [ "${?}" = "0" ] ; then + echo "${1}: FreeBSD ${VER} (32bit)" + else + echo "${1}: FreeBSD ${VER} (64bit)" + fi + fi + +} + +# 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 [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then + get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`" + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi +done + +# Now search for any ZFS root partitions +zpool import -o altroot=${FSMNT} -a + +# Unmount any auto-mounted stuff +umount_all_dir "${FSMNT}" + +# Get pools +_zps="`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`" +for _zpools in ${_zps} +do + mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then + get_fbsd_ver "${_zpools}" + 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 100644 index 0000000..5257d5c --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend-query/xkeyboard-layouts.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: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +FOUND="0" + +# 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 + exit 0 + else + echo "$line" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! layout' >/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-models.sh b/usr/sbin/pc-sysinstall/backend-query/xkeyboard-models.sh new file mode 100644 index 0000000..4fdf652 --- /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: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +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 100644 index 0000000..8886bc8 --- /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: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh,v 1.2 2010/06/27 16:46:11 imp Exp $ + +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 |