diff options
Diffstat (limited to 'system-config/examples')
17 files changed, 261 insertions, 0 deletions
diff --git a/system-config/examples/README b/system-config/examples/README new file mode 100644 index 0000000..22daaf9 --- /dev/null +++ b/system-config/examples/README @@ -0,0 +1,15 @@ +live-config-foobar Example +-------------------------- + +Best practise for downstream projects and derivatives is to ship their custom +live-config components in an own debian package. + +The following live-config-foobar example package should be used as a starting +point. The following things should minimally be changed: + + * Replace any mentioning of 'Joe Doe' with your own name. + * Replace any mentioning of 'example.org' with your own domain name. + * Replace any mentioning of 'foobar', 'Foobar' and 'FOOBAR' with the name of + your custom componentsor project name. + + -- Daniel Baumann <mail@daniel-baumann.ch> Wed, 01 Jan 2014 00:00:00 +0100 diff --git a/system-config/examples/hooks/cat b/system-config/examples/hooks/cat new file mode 100755 index 0000000..cee5cde --- /dev/null +++ b/system-config/examples/hooks/cat @@ -0,0 +1,26 @@ +#!/bin/sh + +echo +echo "live-config hook: cat" + +_FILENAME="" + +while [ "${_FILENAME}" != q ] +do + echo + echo -n "Enter filename [q for quit]: " + + read _FILENAME + + if [ -n "${_FILENAME}" ] + then + echo + echo "Begin: ${_FILENAME}" + echo "--------------------------------------------------------------------------------" + + cat "${_FILENAME}" + + echo "--------------------------------------------------------------------------------" + echo "End: ${_FILENAME}" + fi +done diff --git a/system-config/examples/hooks/passwd b/system-config/examples/hooks/passwd new file mode 100755 index 0000000..38b5171 --- /dev/null +++ b/system-config/examples/hooks/passwd @@ -0,0 +1,30 @@ +#!/bin/sh + +echo +echo "live-config hook: passwd" + +_USERNAME="" + +while [ "${_USERNAME}" != q ] +do + echo + echo -n "Enter username [q for quit]: " + + read _USERNAME + + _USERNAME="${_USERNAME:-${LIVE_USERNAME}}" + + case "${_USERNAME}" in + root) + passwd + ;; + + *) + if [ -n "${_USERNAME}" ] + then + echo + passwd "${_USERNAME}" + fi + ;; + esac +done diff --git a/system-config/examples/hooks/rm b/system-config/examples/hooks/rm new file mode 100755 index 0000000..a7ffbbf --- /dev/null +++ b/system-config/examples/hooks/rm @@ -0,0 +1,19 @@ +#!/bin/sh + +echo +echo "live-config hook: rm" + +_FILENAME="" + +while [ "${_FILENAME}" != q ] +do + echo + echo -n "Enter filename [q for quit]: " + + read _FILENAME + + if [ -n "${_FILENAME}" ] + then + rm -rf "${_FILENAME}" + fi +done diff --git a/system-config/examples/hooks/sh b/system-config/examples/hooks/sh new file mode 100755 index 0000000..737bcd7 --- /dev/null +++ b/system-config/examples/hooks/sh @@ -0,0 +1,9 @@ +#!/bin/sh + +echo +echo "live-config hook: sh" + +echo +echo "Starting shell [logout for quit]: " + +sh diff --git a/system-config/examples/hooks/vi b/system-config/examples/hooks/vi new file mode 100755 index 0000000..2ae99e6 --- /dev/null +++ b/system-config/examples/hooks/vi @@ -0,0 +1,16 @@ +#!/bin/sh + +echo +echo "live-config hook: vi" + +_FILENAME="" + +while [ "${_FILENAME}" != q ] +do + echo + echo -n "Enter filename [q for quit]: " + + read _FILENAME + + vi "${_FILENAME}" +done diff --git a/system-config/examples/live-config-foobar/components/9000-foobar b/system-config/examples/live-config-foobar/components/9000-foobar new file mode 100755 index 0000000..136943b --- /dev/null +++ b/system-config/examples/live-config-foobar/components/9000-foobar @@ -0,0 +1,67 @@ +#!/bin/sh + +## live-config-foobar(7) - Additional Configuration Components for live systems +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## Copyright (C) 2015 John Doe <john@example.org> +## +## live-config-foobar comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +set -e + +Cmdline () +{ + # Boot parameters can be acted up either this way... + if ! echo ${LIVE_CONFIG_CMDLINE} | grep -qs "example.foobar" && \ + ! echo ${LIVE_CONFIG_CMDLINE} | grep -qs "foobar" + then + return + fi + + # ...or if you want to specify certain options: + for _PARAMETER in ${LIVE_CONFIG_CMDLINE} + do + case "${_PARAMETER}" in + example.foobar=*|foobar=*) + EXAMPLE_FOOBAR="${_PARAMETER#*foobar=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/foobar.list ] || \ + [ -e /var/lib/live/config/foobar ] + then + exit 0 + fi + + echo -n " foobar" +} + +Config () +{ + # Configuring foobar either this way... + if [ -n "${EXAMPLE_FOOBAR}" ] + then + sleep 1 + fi + + # ...or if you want to specify certain options: + case "${EXAMPLE_FOOBAR}" in + foo) + sleep 1 + ;; + esac + + # Creating state file + touch /var/lib/live/config/foobar +} + +Cmdline +Init +Config diff --git a/system-config/examples/live-config-foobar/configs/foobar.conf b/system-config/examples/live-config-foobar/configs/foobar.conf new file mode 100644 index 0000000..eaa3e2c --- /dev/null +++ b/system-config/examples/live-config-foobar/configs/foobar.conf @@ -0,0 +1,12 @@ +# /etc/live/config.conf.d/foobar.conf + +## live-config-foobar(7) - Additional Configuration Components for live systems +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## Copyright (C) 2015 John Doe <john@example.org> +## +## live-config-foobar comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +EXAMPLE_FOOBAR="foobar" diff --git a/system-config/examples/live-config-foobar/debian/changelog b/system-config/examples/live-config-foobar/debian/changelog new file mode 100644 index 0000000..d68a822 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/changelog @@ -0,0 +1,6 @@ +live-config-foobar (5-1) unstable; urgency=low + + * Initial release based on the live-config-foobar example package + included in live-config. + + -- John Doe <john@example.org> Wed, 01 Jan 2015 00:00:00 +0100 diff --git a/system-config/examples/live-config-foobar/debian/compat b/system-config/examples/live-config-foobar/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/compat @@ -0,0 +1 @@ +9 diff --git a/system-config/examples/live-config-foobar/debian/control b/system-config/examples/live-config-foobar/debian/control new file mode 100644 index 0000000..f976b16 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/control @@ -0,0 +1,18 @@ +Source: live-config-foobar +Section: misc +Priority: extra +Maintainer: John Doe <john@example.org> +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: http://www.example.org/foobar/ +Vcs-Browser: http://git.example.org/?p=live-config-foobar.git +Vcs-Git: git://git.example.org/git/live-config-foobar.git + +Package: live-config-foobar +Architecture: all +Depends: ${misc:Depends}, live-config (>= 5), live-config (<< 6) +Description: Additional Live System Configuration Components (foobar) + live-config contains the components that configure a live system during the + boot process (late userspace). + . + This package contains the additional foobar component(s). diff --git a/system-config/examples/live-config-foobar/debian/copyright b/system-config/examples/live-config-foobar/debian/copyright new file mode 100644 index 0000000..de1526a --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/copyright @@ -0,0 +1,30 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: live-config-foobar +Upstream-Contact: John Doe <john@example.org> +Source: http://www.example.org/foobar/ +Comment: + This package is based on the live-config-foobar example package + included in live-config which can be obtained from + http://live-systems.org/devel/live-config/. + +Files: * +Copyright: 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> + 2015 John Doe <john@example.org> +License: GPL-3+ + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + . + The complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-3 file. diff --git a/system-config/examples/live-config-foobar/debian/install b/system-config/examples/live-config-foobar/debian/install new file mode 100644 index 0000000..dd1fb94 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/install @@ -0,0 +1,2 @@ +configs/* /etc/live/config.conf.d +components/* /lib/live/config diff --git a/system-config/examples/live-config-foobar/debian/rules b/system-config/examples/live-config-foobar/debian/rules new file mode 100755 index 0000000..bd5d614 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +%: + dh ${@} + +override_dh_builddeb: + dh_builddeb -- -Zxz diff --git a/system-config/examples/live-config-foobar/debian/source/format b/system-config/examples/live-config-foobar/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/system-config/examples/live-config-foobar/debian/source/local-options b/system-config/examples/live-config-foobar/debian/source/local-options new file mode 100644 index 0000000..2ee6f0f --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/source/local-options @@ -0,0 +1 @@ +abort-on-upstream-changes diff --git a/system-config/examples/live-config-foobar/debian/source/options b/system-config/examples/live-config-foobar/debian/source/options new file mode 100644 index 0000000..5bd47b7 --- /dev/null +++ b/system-config/examples/live-config-foobar/debian/source/options @@ -0,0 +1 @@ +compression = xz |