summaryrefslogtreecommitdiff
path: root/functions/packagelist.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:05:14 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:26 +0100
commit0d5ff4ca7596790f853cf637e0fe225cad810a76 (patch)
tree360ca9a49f3d82d589a4b49c98e5210dfcb3b74e /functions/packagelist.sh
parentcd5110f6b8eb77519d704972276cfd5be6bff055 (diff)
downloadvyos-live-build-0d5ff4ca7596790f853cf637e0fe225cad810a76.tar.gz
vyos-live-build-0d5ff4ca7596790f853cf637e0fe225cad810a76.zip
Adding live-helper 1.0~a18-1.
Diffstat (limited to 'functions/packagelist.sh')
-rwxr-xr-xfunctions/packagelist.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/functions/packagelist.sh b/functions/packagelist.sh
new file mode 100755
index 000000000..f25b5fbca
--- /dev/null
+++ b/functions/packagelist.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# packagelists.sh - expands package list includes
+# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
+#
+# live-helper 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
+
+Expand_packagelist ()
+{
+ # ${1} List name
+ # ${2} Default path to search
+ # ${3} Fallback path to search (optional)
+
+ # Does list exist in default path?
+ if [ -e "${2}/${1}" ];
+ then
+ Expand_packagelist_file "${2}/${1}" "${@}"
+ else
+ # If list exists in fallback, include it.
+ if [ -n "${3}" ] && [ -e "${3}/${1}" ]
+ then
+ Expand_packagelist_file "${3}/${1}" "${@}"
+ fi
+ fi
+}
+
+Expand_packagelist_file ()
+{
+ local FILE="${1}"
+ shift
+ shift
+
+ for INCLUDE in `sed -ne 's/^#<include> \(.*\)/\1/gp' "${FILE}"`;
+ do
+ Expand_packagelist "${INCLUDE}" "${@}"
+ done
+ sed -ne 's/^\([^#].*\)/\1\n/gp' "${FILE}"
+}