From e2912927e0ccf106ac6f160a76736e4aa90e624c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 17 Dec 2010 23:43:04 -0500 Subject: Add new files --- usr/sbin/pc-sysinstall/Makefile.orig | 5 + usr/sbin/pc-sysinstall/Makefile.rej | 23 ++++ usr/sbin/pc-sysinstall/backend-query/set-mirror.sh | 40 +++++++ .../backend/functions-installpackages.sh | 125 +++++++++++++++++++++ usr/sbin/pc-sysinstall/backend/installimage.sh | 34 ++++++ 5 files changed, 227 insertions(+) create mode 100644 usr/sbin/pc-sysinstall/Makefile.orig create mode 100644 usr/sbin/pc-sysinstall/Makefile.rej create mode 100644 usr/sbin/pc-sysinstall/backend-query/set-mirror.sh create mode 100644 usr/sbin/pc-sysinstall/backend/functions-installpackages.sh create mode 100644 usr/sbin/pc-sysinstall/backend/installimage.sh (limited to 'usr/sbin') diff --git a/usr/sbin/pc-sysinstall/Makefile.orig b/usr/sbin/pc-sysinstall/Makefile.orig new file mode 100644 index 0000000..4705fc1 --- /dev/null +++ b/usr/sbin/pc-sysinstall/Makefile.orig @@ -0,0 +1,5 @@ +# $FreeBSD: src/usr.sbin/pc-sysinstall/Makefile,v 1.1 2010/06/24 22:21:47 imp Exp $ +SUBDIR=backend backend-partmanager backend-query conf doc examples +SUBDIR+=pc-sysinstall + +.include diff --git a/usr/sbin/pc-sysinstall/Makefile.rej b/usr/sbin/pc-sysinstall/Makefile.rej new file mode 100644 index 0000000..bb8e07b --- /dev/null +++ b/usr/sbin/pc-sysinstall/Makefile.rej @@ -0,0 +1,23 @@ +*************** +*** 1,10 **** +- # $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 +--- 1,10 ---- ++ # $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/Makefile,v 1.6 2010/08/19 05:59:27 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 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 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 100644 index 0000000..fe4daf8 --- /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: src/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh,v 1.2 2010/08/24 06:11:46 imp Exp $ + +. ${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/functions-installpackages.sh b/usr/sbin/pc-sysinstall/backend/functions-installpackages.sh new file mode 100644 index 0000000..b8f383a --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend/functions-installpackages.sh @@ -0,0 +1,125 @@ +#!/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/functions-installpackages.sh,v 1.3 2010/08/24 06:11:46 imp Exp $ + +# Functions which check and load any optional packages specified in the config + +. ${BACKEND}/functions.sh +. ${BACKEND}/functions-parse.sh + +# Recursively determine all dependencies for this package +determine_package_dependencies() +{ + local PKGNAME="${1}" + local DEPFILE="${2}" + + grep "${PKGNAME}" "${DEPFILE}" >/dev/null + if [ "$?" -ne "0" ] + then + echo "${PKGNAME}" >> "${DEPFILE}" + get_package_dependencies "${PKGNAME}" "1" + + local DEPS="${VAL}" + for d in ${DEPS} + do + determine_package_dependencies "${d}" "${DEPFILE}" + done + fi +}; + +# Fetch packages dependencies from a file +fetch_package_dependencies() +{ + local DEPFILE + local DEPS + local SAVEDIR + + DEPFILE="${1}" + DEPS=`cat "${DEPFILE}"` + SAVEDIR="${2}" + + for d in ${DEPS} + do + get_package_short_name "${d}" + SNAME="${VAL}" + + get_package_category "${SNAME}" + CATEGORY="${VAL}" + + fetch_package "${CATEGORY}" "${d}" "${SAVEDIR}" + done +}; + +# Check for any packages specified, and begin loading them +install_packages() +{ + # First, lets check and see if we even have any packages to install + get_value_from_cfg installPackages + if [ ! -z "${VAL}" ] + then + HERE=`pwd` + rc_nohalt "mkdir -p ${FSMNT}/${PKGTMPDIR}" + rc_nohalt "cd ${FSMNT}/${PKGTMPDIR}" + + if [ ! -f "${CONFDIR}/INDEX" ] + then + get_package_index + fi + + if [ ! -f "${CONFDIR}/INDEX.parsed" ] + then + parse_package_index + fi + + # Lets start by cleaning up the string and getting it ready to parse + strip_white_space ${VAL} + PACKAGES=`echo ${VAL} | sed -e "s|,| |g"` + for i in $PACKAGES + do + if get_package_name "${i}" + then + PKGNAME="${VAL}" + DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps" + + rc_nohalt "touch ${DEPFILE}" + determine_package_dependencies "${PKGNAME}" "${DEPFILE}" + fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}" + + # If the package is not already installed, install it! + if ! run_chroot_cmd "pkg_info -e ${PKGNAME}" + then + rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz" + fi + + rc_nohalt "rm ${DEPFILE}" + fi + + rc_nohalt "cd ${HERE}" + done + + rm -rf "${FSMNT}/${PKGTMPDIR}" + fi +}; diff --git a/usr/sbin/pc-sysinstall/backend/installimage.sh b/usr/sbin/pc-sysinstall/backend/installimage.sh new file mode 100644 index 0000000..3ef77dd --- /dev/null +++ b/usr/sbin/pc-sysinstall/backend/installimage.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: src/usr.sbin/pc-sysinstall/backend/installimage.sh,v 1.1 2010/09/09 03:33:07 imp Exp $ + +# Source our functions scripts +. ${BACKEND}/functions.sh + +IMAGE_FILE="${1}" +DEVICE_FILE="${2}" + +write_image "${IMAGE_FILE}" "${DEVICE_FILE}" -- cgit v1.1