diff options
author | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:04:48 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 18:18:28 +0100 |
commit | 799d4bfb31c279b72088c8ee8a16c2710ab8a309 (patch) | |
tree | 4bbc1758ceaa46c5e81fe9d66ccdaacfec047ef8 /helpers/lh_chroot_apt | |
parent | 677415f6d7efc1e5b888570d70af311d2900c69c (diff) | |
download | vyos-live-build-799d4bfb31c279b72088c8ee8a16c2710ab8a309.tar.gz vyos-live-build-799d4bfb31c279b72088c8ee8a16c2710ab8a309.zip |
Adding live-helper 1.0~a3-1.
Diffstat (limited to 'helpers/lh_chroot_apt')
-rwxr-xr-x | helpers/lh_chroot_apt | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt index fd3701206..c80f22ff9 100755 --- a/helpers/lh_chroot_apt +++ b/helpers/lh_chroot_apt @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_apt(1) - manage /etc/apt/apt.conf +# 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 @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/apt/apt.conf" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -29,6 +41,12 @@ case "${1}" in # Checking stage file Check_stagefile .stage/chroot_apt + if [ -f chroot/etc/apt/apt.conf ] + then + # Remove old /etc/apt/apt.conf + rm -f chroot/etc/apt/apt.conf + fi + if [ "${LH_APT}" = "aptitude" ] && [ ! -d chroot/etc/apt/apt.conf.d ] then mkdir -p chroot/etc/apt/apt.conf.d @@ -110,6 +128,30 @@ case "${1}" in esac fi + # Configuring apt secure + if [ "${LH_APT_SECURE}" = "enabled" ] + then + case "${LH_APT}" in + apt|apt-get) + echo "APT::Get::AllowUnauthenticated \"0\";" >> chroot/etc/apt/apt.conf + ;; + + aptitude) + echo "APT::Get::AllowUnauthenticated \"0\";" > chroot/etc/apt/apt.conf.d/secure + ;; + esac + else + case "${LH_APT}" in + apt|apt-get) + echo "APT::Get::AllowUnauthenticated \"1\";" >> chroot/etc/apt/apt.conf + ;; + + aptitude) + echo "APT::Get::AllowUnauthenticated \"1\";" > chroot/etc/apt/apt.conf.d/secure + ;; + esac + fi + # Creating stage file Create_stagefile .stage/chroot_apt ;; @@ -130,12 +172,14 @@ case "${1}" in # Deconfiguring aptitude recommends rm -f chroot/etc/apt/apt.conf.d/recommends + # Deconfiguring aptitude secure + rm -f chroot/etc/apt/apt.conf.d/secure + # Removing stage file rm -f .stage/chroot_apt ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac |