diff options
author | imp <imp@FreeBSD.org> | 2010-07-13 23:47:12 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2010-07-13 23:47:12 +0000 |
commit | c07c5231a154f8805d3b84e86f86f2c2c8f8a25b (patch) | |
tree | 3bb2723aeeed4a924ad8245c000bee868eda8da2 /usr.sbin/pc-sysinstall/backend-query | |
parent | 32ae1ad8de2b50b8f776eed075557edb4a4ea0c1 (diff) | |
download | FreeBSD-src-c07c5231a154f8805d3b84e86f86f2c2c8f8a25b.zip FreeBSD-src-c07c5231a154f8805d3b84e86f86f2c2c8f8a25b.tar.gz |
Add support for packages.
PR: 148584
Submitted by: John Hixon
Diffstat (limited to 'usr.sbin/pc-sysinstall/backend-query')
5 files changed, 141 insertions, 7 deletions
diff --git a/usr.sbin/pc-sysinstall/backend-query/Makefile b/usr.sbin/pc-sysinstall/backend-query/Makefile index 1deed3f..c042ac3 100644 --- a/usr.sbin/pc-sysinstall/backend-query/Makefile +++ b/usr.sbin/pc-sysinstall/backend-query/Makefile @@ -1,11 +1,11 @@ # $FreeBSD$ FILES= detect-laptop.sh detect-nics.sh detect-emulation.sh disk-info.sh \ - disk-list.sh disk-part.sh enable-net.sh list-config.sh list-components.sh \ - list-mirrors.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 + 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= 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..2c8eab2 --- /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$ + +# 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-config.sh b/usr.sbin/pc-sysinstall/backend-query/list-config.sh index d230814..b7edda2 100755 --- a/usr.sbin/pc-sysinstall/backend-query/list-config.sh +++ b/usr.sbin/pc-sysinstall/backend-query/list-config.sh @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2010 iX Systems, Inc. All rights reserved. +# 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 diff --git a/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh b/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh index 6fdeb00..0fe209d 100755 --- a/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh +++ b/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2010 iX Systems, Inc. All rights reserved. +# 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 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..02d3e9a --- /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$ + +# 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 |