summaryrefslogtreecommitdiff
path: root/functions/package.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:51 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:18:29 +0100
commit8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1 (patch)
tree621dc56a00a65ab0eb1fd4e7d42ad4e45d718741 /functions/package.sh
parent4739146fc6c4de8b16418517bb882312c475195c (diff)
downloadlive-build-8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1.zip
live-build-8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1.tar.gz
Adding live-helper 1.0~a7-1.
Diffstat (limited to 'functions/package.sh')
-rwxr-xr-xfunctions/package.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/functions/package.sh b/functions/package.sh
new file mode 100755
index 0000000..3d11873
--- /dev/null
+++ b/functions/package.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# packages.sh - handle packages installation
+# 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
+
+Check_package ()
+{
+ FILE="${1}"
+ PACKAGE="${2}"
+
+ if [ ! -f "${FILE}" ]
+ then
+ PACKAGES="${PACKAGES} ${PACKAGE}"
+ fi
+}
+
+Install_package ()
+{
+ if [ -n "${PACKAGES}" ]
+ then
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+}
+
+Remove_package ()
+{
+ if [ -n "${PACKAGES}" ]
+ then
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+}