summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2008-02-21 20:03:57 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:36:05 +0100
commit09f88a6e3837f71343dacb1bf7c6411183cca2cf (patch)
tree93f74f348b4bb727f53393a42177a86a965d5d54
parent1ffce292fb24b3e77605a76e2388172927bebae7 (diff)
downloadvyos-live-build-09f88a6e3837f71343dacb1bf7c6411183cca2cf.tar.gz
vyos-live-build-09f88a6e3837f71343dacb1bf7c6411183cca2cf.zip
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.
-rwxr-xr-xfunctions/defaults.sh3
-rwxr-xr-xfunctions/wrapper.sh23
-rwxr-xr-xhelpers/lh_binary_debian-installer2
-rwxr-xr-xhelpers/lh_binary_local-packageslists2
-rwxr-xr-xhelpers/lh_chroot_hacks10
-rwxr-xr-xhelpers/lh_chroot_linux-image20
-rwxr-xr-xhelpers/lh_chroot_local-packages10
-rwxr-xr-xhelpers/lh_chroot_local-packageslists4
-rwxr-xr-xhelpers/lh_chroot_packages10
-rwxr-xr-xhelpers/lh_chroot_packageslists4
-rwxr-xr-xhelpers/lh_chroot_sources38
-rwxr-xr-xhelpers/lh_chroot_tasks2
-rwxr-xr-xhelpers/lh_config19
-rwxr-xr-xhelpers/lh_source_debian2
14 files changed, 67 insertions, 82 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 4214db14b..177520fc4 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -64,6 +64,9 @@ Set_defaults ()
# Setting apt pipeline
# LH_APT_PIPELINE
+ APT_OPTIONS="${APT_OPTIONS:---yes}"
+ APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
+
# Setting apt recommends
case "${LH_MODE}" in
debian-edu)
diff --git a/functions/wrapper.sh b/functions/wrapper.sh
new file mode 100755
index 000000000..90144e740
--- /dev/null
+++ b/functions/wrapper.sh
@@ -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
+}
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer
index 096ca47b9..79fe2c68f 100755
--- a/helpers/lh_binary_debian-installer
+++ b/helpers/lh_binary_debian-installer
@@ -250,7 +250,7 @@ if [ "${LH_DEBIAN_INSTALLER}" != "netboot" ]; then
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/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
diff --git a/helpers/lh_binary_local-packageslists b/helpers/lh_binary_local-packageslists
index 011386eac..3afa7fe85 100755
--- a/helpers/lh_binary_local-packageslists
+++ b/helpers/lh_binary_local-packageslists
@@ -60,7 +60,7 @@ then
# 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
for FILE in chroot/binary.deb/archives/*.deb
diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks
index 1dd48502e..ffa9d9c67 100755
--- a/helpers/lh_chroot_hacks
+++ b/helpers/lh_chroot_hacks
@@ -54,15 +54,7 @@ case "${LH_BINARY_IMAGES}" in
net)
if [ ! -f chroot/usr/bin/smbmount ]
then
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install --yes smbfs"
- ;;
-
- aptitude)
- Chroot "aptitude install --assume-yes smbfs"
- ;;
- esac
+ Apt install smbfs
fi
if [ ! -d chroot/etc/initramfs-tools ]
diff --git a/helpers/lh_chroot_linux-image b/helpers/lh_chroot_linux-image
index 7d3ee3145..d8718af36 100755
--- a/helpers/lh_chroot_linux-image
+++ b/helpers/lh_chroot_linux-image
@@ -88,15 +88,7 @@ EOF
fi
# Installing linux-image, modules and ${LH_INITRAMFS}
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install --yes ${PACKAGES}"
- ;;
-
- aptitude)
- Chroot "aptitude install --assume-yes ${PACKAGES}"
- ;;
- esac
+ Apt install ${PACKAGES}
if ls config/chroot_local-packages/${LH_INITRAMFS}*.deb > /dev/null 2>&1
then
@@ -107,15 +99,7 @@ EOF
Chroot "xargs --arg-file=/root/initfs dpkg -i" || true
# Cleaning dependencies
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install -f --yes"
- ;;
-
- aptitude)
- Chroot "aptitude install --assume-yes ${LH_INITRAMFS}"
- ;;
- esac
+ Apt install -f
# Removing package files
rm -f chroot/root/${LH_INITRAMFS}*.deb
diff --git a/helpers/lh_chroot_local-packages b/helpers/lh_chroot_local-packages
index 96565a2fb..5b7d2979a 100755
--- a/helpers/lh_chroot_local-packages
+++ b/helpers/lh_chroot_local-packages
@@ -68,15 +68,7 @@ then
Chroot "xargs --arg-file=/root/local-packages dpkg -i" || true
# Cleaning dependencies
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install -f --yes"
- ;;
-
- aptitude)
- Chroot "aptitude install -f --assume-yes"
- ;;
- esac
+ Apt install -f
# Removing package files
rm -f chroot/root/*.deb
diff --git a/helpers/lh_chroot_local-packageslists b/helpers/lh_chroot_local-packageslists
index 2c03f3c6b..4c3a100c3 100755
--- a/helpers/lh_chroot_local-packageslists
+++ b/helpers/lh_chroot_local-packageslists
@@ -60,11 +60,11 @@ then
# Installing package list
case "${LH_APT}" in
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)
- Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) aptitude install --assume-yes"
+ Chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) aptitude ${APTITUDE_OPTIONS} install"
;;
esac
diff --git a/helpers/lh_chroot_packages b/helpers/lh_chroot_packages
index 661b33543..9fe2984ad 100755
--- a/helpers/lh_chroot_packages
+++ b/helpers/lh_chroot_packages
@@ -53,15 +53,7 @@ then
Restore_cache cache/packages_packages
# Installing packages
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install --yes ${LH_PACKAGES}"
- ;;
-
- aptitude)
- Chroot "aptitude install --assume-yes ${LH_PACKAGES}"
- ;;
- esac
+ Apt install ${LH_PACKAGES}
# Saving cache
Save_cache cache/packages_packages
diff --git a/helpers/lh_chroot_packageslists b/helpers/lh_chroot_packageslists
index 7d0cdefb9..651e35979 100755
--- a/helpers/lh_chroot_packageslists
+++ b/helpers/lh_chroot_packageslists
@@ -62,11 +62,11 @@ then
# Installing package list
case "${LH_APT}" in
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)
- Chroot "xargs --arg-file=/root/${LIST} aptitude install --assume-yes"
+ Chroot "xargs --arg-file=/root/${LIST} aptitude ${APTITUDE_OPTIONS} install"
;;
esac
diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources
index 25713a150..6cb0b3ea5 100755
--- a/helpers/lh_chroot_sources
+++ b/helpers/lh_chroot_sources
@@ -122,7 +122,7 @@ case "${1}" in
if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ]
then
- Chroot "apt-get install --yes --force-yes aptitude"
+ Chroot "apt-get ${APT_OPTIONS} install aptitude"
fi
else # Get fresh indices
# Check local gpg keys
@@ -148,29 +148,20 @@ case "${1}" in
fi
# Installing aptitude
- if [ "${LH_APT}" = "apt" ] || [ "${LH_APT}" = "apt-get" ]
- then
- Chroot "apt-get update"
- Chroot "apt-get --yes upgrade"
- Chroot "apt-get --yes dist-upgrade"
- elif [ "${LH_APT}" = "aptitude" ]
+ if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/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"
+ Chroot "apt-get ${APT_OPTIONS} update"
+ Chroot "apt-get ${APT_OPTIONS} install aptitude"
fi
+ Apt upgrade
+ Apt dist-upgrade
+
# Installing keyring packages
if [ -n "${LH_KEYRING_PACKAGES}" ]
then
- Chroot "apt-get install --yes --force-yes ${LH_KEYRING_PACKAGES}"
- Chroot "apt-get update"
+ Apt --force-yes install "${LH_KEYRING_PACKAGES}"
+ Apt update
fi
if [ "${LH_CACHE_INDICES}" = "enabled" ]
@@ -262,15 +253,8 @@ case "${1}" in
done
fi
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get update"
- ;;
-
- aptitude)
- Chroot "aptitude update"
- ;;
- esac
+ # Updating indices
+ Apt update
fi
# Cleaning apt packages cache
diff --git a/helpers/lh_chroot_tasks b/helpers/lh_chroot_tasks
index 46277d72b..7a19be943 100755
--- a/helpers/lh_chroot_tasks
+++ b/helpers/lh_chroot_tasks
@@ -69,7 +69,7 @@ then
# Installing tasks
case "${LH_TASKSEL}" in
aptitude)
- Chroot "aptitude install --assume-yes ${LH_TASKS}"
+ Chroot "aptitude ${APTITUDE_OPTIONS} install ${LH_TASKS}"
;;
tasksel)
diff --git a/helpers/lh_config b/helpers/lh_config
index 02056f381..2f2596a20 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -24,6 +24,8 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--apt-ftp-proxy URL]\n\
\t [--apt-http-proxy URL]\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-recommends enabled|disabled]\n\
\t [--apt-secure enabled|disabled]\n\
@@ -111,7 +113,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
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" ]
then
@@ -141,7 +143,16 @@ Local_arguments ()
;;
--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
;;
@@ -770,6 +781,10 @@ LH_QUIET="${LH_QUIET}"
# \$LH_VERBOSE: enable verbose
# (Default: ${LH_VERBOSE})
#LH_VERBOSE="${LH_VERBOSE}"
+
+# Internal stuff (FIXME)
+APT_OPTIONS="${APT_OPTIONS}"
+APTITUDE_OPTIONS="${APTITUDE_OPTIONS}"
EOF
# Creating lh_bootstrap_* configuration
diff --git a/helpers/lh_source_debian b/helpers/lh_source_debian
index 31ee006e7..6a86ddc83 100755
--- a/helpers/lh_source_debian
+++ b/helpers/lh_source_debian
@@ -93,7 +93,7 @@ fi
;;
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
# Sort sources