diff options
Diffstat (limited to 'functions/package.sh')
-rwxr-xr-x | functions/package.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/functions/package.sh b/functions/package.sh new file mode 100755 index 000000000..3d11873c2 --- /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 +} |