Adding apt/aptitude options.

By using APT_OPTIONS and APTITUDE_OPTIONS in config/common,
one can manipulate the default options wich is made to each
and every apt and aptitude call.
This commit is contained in:
Daniel Baumann 2008-02-21 20:03:57 +01:00
parent 20ffe176ed
commit fa3c63f5dc
14 changed files with 67 additions and 82 deletions

View File

@ -64,6 +64,9 @@ Set_defaults ()
# Setting apt pipeline # Setting apt pipeline
# LH_APT_PIPELINE # LH_APT_PIPELINE
APT_OPTIONS="${APT_OPTIONS:---yes}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
# Setting apt recommends # Setting apt recommends
case "${LH_MODE}" in case "${LH_MODE}" in
debian-edu) debian-edu)

23
functions/wrapper.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# wrapper.sh - external command wrappers
# 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
Apt ()
{
case "${LH_APT}" in
apt|apt-get)
Chroot "apt-get ${APT_OPTIONS} ${@}"
;;
aptitude)
Chroot "aptittude ${APTITUDE_OPTIONS} ${@}"
;;
esac
}

View File

@ -250,7 +250,7 @@ if [ "${LH_DEBIAN_INSTALLER}" != "netboot" ]; then
DI_PACKAGES="${DI_PACKAGES} cryptsetup lvm2" DI_PACKAGES="${DI_PACKAGES} cryptsetup lvm2"
Chroot "apt-get -o Dir::Cache=/binary.deb --download-only install --yes ${DI_PACKAGES}" Chroot "apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install ${DI_PACKAGES}"
mv chroot/binary.deb ./ mv chroot/binary.deb ./
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status

View File

@ -60,7 +60,7 @@ then
# Downloading additional packages # Downloading additional packages
Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get -o Dir::Cache=/binary.deb --download-only install --yes" Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install"
done done
for FILE in chroot/binary.deb/archives/*.deb for FILE in chroot/binary.deb/archives/*.deb

View File

@ -54,15 +54,7 @@ case "${LH_BINARY_IMAGES}" in
net) net)
if [ ! -f chroot/usr/bin/smbmount ] if [ ! -f chroot/usr/bin/smbmount ]
then then
case "${LH_APT}" in Apt install smbfs
apt|apt-get)
Chroot "apt-get install --yes smbfs"
;;
aptitude)
Chroot "aptitude install --assume-yes smbfs"
;;
esac
fi fi
if [ ! -d chroot/etc/initramfs-tools ] if [ ! -d chroot/etc/initramfs-tools ]

View File

@ -88,15 +88,7 @@ EOF
fi fi
# Installing linux-image, modules and ${LH_INITRAMFS} # Installing linux-image, modules and ${LH_INITRAMFS}
case "${LH_APT}" in Apt install ${PACKAGES}
apt|apt-get)
Chroot "apt-get install --yes ${PACKAGES}"
;;
aptitude)
Chroot "aptitude install --assume-yes ${PACKAGES}"
;;
esac
if ls config/chroot_local-packages/${LH_INITRAMFS}*.deb > /dev/null 2>&1 if ls config/chroot_local-packages/${LH_INITRAMFS}*.deb > /dev/null 2>&1
then then
@ -107,15 +99,7 @@ EOF
Chroot "xargs --arg-file=/root/initfs dpkg -i" || true Chroot "xargs --arg-file=/root/initfs dpkg -i" || true
# Cleaning dependencies # Cleaning dependencies
case "${LH_APT}" in Apt install -f
apt|apt-get)
Chroot "apt-get install -f --yes"
;;
aptitude)
Chroot "aptitude install --assume-yes ${LH_INITRAMFS}"
;;
esac
# Removing package files # Removing package files
rm -f chroot/root/${LH_INITRAMFS}*.deb rm -f chroot/root/${LH_INITRAMFS}*.deb

View File

@ -68,15 +68,7 @@ then
Chroot "xargs --arg-file=/root/local-packages dpkg -i" || true Chroot "xargs --arg-file=/root/local-packages dpkg -i" || true
# Cleaning dependencies # Cleaning dependencies
case "${LH_APT}" in Apt install -f
apt|apt-get)
Chroot "apt-get install -f --yes"
;;
aptitude)
Chroot "aptitude install -f --assume-yes"
;;
esac
# Removing package files # Removing package files
rm -f chroot/root/*.deb rm -f chroot/root/*.deb

View File

@ -60,11 +60,11 @@ then
# Installing package list # Installing package list
case "${LH_APT}" in case "${LH_APT}" in
apt|apt-get) apt|apt-get)
Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get install --yes" Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get ${APT_OPTIONS} install"
;; ;;
aptitude) aptitude)
Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) aptitude install --assume-yes" Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) aptitude ${APTITUDE_OPTIONS} install"
;; ;;
esac esac

View File

@ -53,15 +53,7 @@ then
Restore_cache cache/packages_packages Restore_cache cache/packages_packages
# Installing packages # Installing packages
case "${LH_APT}" in Apt install ${LH_PACKAGES}
apt|apt-get)
Chroot "apt-get install --yes ${LH_PACKAGES}"
;;
aptitude)
Chroot "aptitude install --assume-yes ${LH_PACKAGES}"
;;
esac
# Saving cache # Saving cache
Save_cache cache/packages_packages Save_cache cache/packages_packages

View File

@ -62,11 +62,11 @@ then
# Installing package list # Installing package list
case "${LH_APT}" in case "${LH_APT}" in
apt|apt-get) apt|apt-get)
Chroot "xargs --arg-file=/root/${LIST} apt-get install --yes" Chroot "xargs --arg-file=/root/${LIST} apt-get ${APT_OPTIONS} install"
;; ;;
aptitude) aptitude)
Chroot "xargs --arg-file=/root/${LIST} aptitude install --assume-yes" Chroot "xargs --arg-file=/root/${LIST} aptitude ${APTITUDE_OPTIONS} install"
;; ;;
esac esac

View File

@ -122,7 +122,7 @@ case "${1}" in
if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ]
then then
Chroot "apt-get install --yes --force-yes aptitude" Chroot "apt-get ${APT_OPTIONS} install aptitude"
fi fi
else # Get fresh indices else # Get fresh indices
# Check local gpg keys # Check local gpg keys
@ -148,29 +148,20 @@ case "${1}" in
fi fi
# Installing aptitude # Installing aptitude
if [ "${LH_APT}" = "apt" ] || [ "${LH_APT}" = "apt-get" ] if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ]
then then
Chroot "apt-get update" Chroot "apt-get ${APT_OPTIONS} update"
Chroot "apt-get --yes upgrade" Chroot "apt-get ${APT_OPTIONS} install aptitude"
Chroot "apt-get --yes dist-upgrade"
elif [ "${LH_APT}" = "aptitude" ]
then
if [ ! -x /usr/bin/aptitude ]
then
Chroot "apt-get update"
Chroot "apt-get install --yes --force-yes aptitude"
fi
Chroot "aptitude update"
Chroot "aptitude --assume-yes upgrade"
Chroot "aptitude --assume-yes dist-upgrade"
fi fi
Apt upgrade
Apt dist-upgrade
# Installing keyring packages # Installing keyring packages
if [ -n "${LH_KEYRING_PACKAGES}" ] if [ -n "${LH_KEYRING_PACKAGES}" ]
then then
Chroot "apt-get install --yes --force-yes ${LH_KEYRING_PACKAGES}" Apt --force-yes install "${LH_KEYRING_PACKAGES}"
Chroot "apt-get update" Apt update
fi fi
if [ "${LH_CACHE_INDICES}" = "enabled" ] if [ "${LH_CACHE_INDICES}" = "enabled" ]
@ -262,15 +253,8 @@ case "${1}" in
done done
fi fi
case "${LH_APT}" in # Updating indices
apt|apt-get) Apt update
Chroot "apt-get update"
;;
aptitude)
Chroot "aptitude update"
;;
esac
fi fi
# Cleaning apt packages cache # Cleaning apt packages cache

View File

@ -69,7 +69,7 @@ then
# Installing tasks # Installing tasks
case "${LH_TASKSEL}" in case "${LH_TASKSEL}" in
aptitude) aptitude)
Chroot "aptitude install --assume-yes ${LH_TASKS}" Chroot "aptitude ${APTITUDE_OPTIONS} install ${LH_TASKS}"
;; ;;
tasksel) tasksel)

View File

@ -24,6 +24,8 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--apt-ftp-proxy URL]\n\ \t [--apt-ftp-proxy URL]\n\
\t [--apt-http-proxy URL]\n\ \t [--apt-http-proxy URL]\n\
\t [--apt-pdiffs enabled|disabled]\n\ \t [--apt-pdiffs enabled|disabled]\n\
\t [--apt-options OPTION|\"OPTIONS\"]\n\
\t [--aptitude-options OPTION|\"OPTIONS\"]\n\
\t [--apt-pipeline FIXME]\n\ \t [--apt-pipeline FIXME]\n\
\t [--apt-recommends enabled|disabled]\n\ \t [--apt-recommends enabled|disabled]\n\
\t [--apt-secure enabled|disabled]\n\ \t [--apt-secure enabled|disabled]\n\
@ -111,7 +113,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
Local_arguments () Local_arguments ()
{ {
ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
if [ "${?}" != "0" ] if [ "${?}" != "0" ]
then then
@ -141,7 +143,16 @@ Local_arguments ()
;; ;;
--apt-pdiffs) --apt-pdiffs)
LH_APT_PDIFFS="${2}" APT_PDIFFS="${2}"
shift 2
;;
--apt-options)
APT_OPTIONS="${2}"
shift 2
;;
--aptitude-options)
LH_APTITUDE_OPTIONS="${2}"
shift 2 shift 2
;; ;;
@ -770,6 +781,10 @@ LH_QUIET="${LH_QUIET}"
# \$LH_VERBOSE: enable verbose # \$LH_VERBOSE: enable verbose
# (Default: ${LH_VERBOSE}) # (Default: ${LH_VERBOSE})
#LH_VERBOSE="${LH_VERBOSE}" #LH_VERBOSE="${LH_VERBOSE}"
# Internal stuff (FIXME)
APT_OPTIONS="${APT_OPTIONS}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS}"
EOF EOF
# Creating lh_bootstrap_* configuration # Creating lh_bootstrap_* configuration

View File

@ -93,7 +93,7 @@ fi
;; ;;
esac esac
Chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get source --download-only" Chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get ${APT_OPTIONS} --download-only source"
rm -f chroot/root/dpkg-selection.txt rm -f chroot/root/dpkg-selection.txt
# Sort sources # Sort sources