summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/examples
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsdconfig/examples')
-rw-r--r--usr.sbin/bsdconfig/examples/Makefile6
-rw-r--r--usr.sbin/bsdconfig/examples/Makefile.depend11
-rwxr-xr-xusr.sbin/bsdconfig/examples/add_some_packages.sh13
-rwxr-xr-xusr.sbin/bsdconfig/examples/browse_packages_http.sh32
-rw-r--r--usr.sbin/bsdconfig/examples/bsdconfigrc42
5 files changed, 104 insertions, 0 deletions
diff --git a/usr.sbin/bsdconfig/examples/Makefile b/usr.sbin/bsdconfig/examples/Makefile
new file mode 100644
index 0000000..f66c2b1
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+FILESDIR= ${SHAREDIR}/examples/bsdconfig
+FILES= add_some_packages.sh browse_packages_http.sh bsdconfigrc
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/bsdconfig/examples/Makefile.depend b/usr.sbin/bsdconfig/examples/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/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/bsdconfig/examples/add_some_packages.sh b/usr.sbin/bsdconfig/examples/add_some_packages.sh
new file mode 100755
index 0000000..8750908
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/add_some_packages.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This sample installs a short list of packages from the main HTTP site.
+#
+[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
+nonInteractive=1
+_httpPath=http://pkg.freebsd.org
+mediaSetHTTP
+mediaOpen
+for package in wget bash rsync; do
+ packageAdd
+done
diff --git a/usr.sbin/bsdconfig/examples/browse_packages_http.sh b/usr.sbin/bsdconfig/examples/browse_packages_http.sh
new file mode 100755
index 0000000..91b928d
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/browse_packages_http.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This sample downloads the package digests.txz and packagesite.txz files from
+# HTTP to /tmp (if they don't already exist) and then displays the package
+# configuration/management screen using the local files (resulting in faster
+# browsing of packages from-start since digests.txz/packagesite.txz can be
+# loaded from local media).
+#
+# NOTE: Packages cannot be installed unless staged to
+# /tmp/packages/$PKG_ABI/All
+#
+[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
+nonInteractive=1
+f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI
+TMPDIR=/tmp
+PKGDIR=$TMPDIR/packages/$PKG_ABI
+[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1
+for file in digests.txz packagesite.txz; do
+ [ -s "$PKGDIR/$file" ] && continue
+ if [ ! "$HTTP_INITIALIZED" ]; then
+ _httpPath=http://pkg.freebsd.org
+ mediaSetHTTP
+ mediaOpen
+ fi
+ f_show_info "Downloading %s from\n %s" "$file" "$_httpPath"
+ f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file ||
+ exit 1
+done
+_directoryPath=$TMPDIR
+mediaSetDirectory
+configPackages
diff --git a/usr.sbin/bsdconfig/examples/bsdconfigrc b/usr.sbin/bsdconfig/examples/bsdconfigrc
new file mode 100644
index 0000000..2e3155f
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/bsdconfigrc
@@ -0,0 +1,42 @@
+# Copyright (c) 2012 Ron McDowell
+# Copyright (c) 2012 Devin Teske
+# 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$
+
+# This file allows you to customize the behavior of bsdconfig.
+# Copy it to your $HOME/.bsdconfigrc and edit to suit.
+
+# Debugging aids for development
+#
+#debug=1
+#debugFile=$HOME/out
+#debugFile=+$HOME/out # includes debug to stdout
+
+# Optionally override functions to be more verbose (like including the date)
+#
+# f_dprintf() {
+# local format="$1"; shift
+# printf "$(date):$pgm:$format\n" "$@" >> $HOME/out
+# }
OpenPOWER on IntegriCloud