Skip to content
Snippets Groups Projects
Commit 3aef7387 authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

first attempt at apt cache file override

parent 92f08cda
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,33 @@ ...@@ -7,7 +7,33 @@
# We install filter-syslog rules, so make sure that newsyslog is always # We install filter-syslog rules, so make sure that newsyslog is always
# installed. # installed.
class base::os::debian { #
# PARAMETERS
# ----------
#
# $apt_cache_notin_tmp: If you want apt to use a directory other than
# /tmp for its temporary cache, set this parameter to "true". This is needed
# if the /tmp partition is set to "noexec" (apt often needs to execture
# configuration files as part of an install or uninstall).
#
# If $apt_cache_notin_tmp is set to "true" and $apt_cache_directory is
# undefined, then apt will use /var/cache/apt/tmp for its temporary
# directory. If you want to specify a different directory, set
# the $apt_cache_tmp_dir.
#
# $apt_cache_tmp_dir: if $apt_cache_notin_tmp is set to "false" this
# parameter is ignored. If $apt_cache_notin_tmp is set to "true" then we
# configure apt to use $apt_cache_tmp_dir as apt's temporary directory
# during package installs and uninstalls.
#
# NOTE! If you use $apt_cache_tmp_dir to override the default, then you
# must have $apt_cache_tmp_dir as a file resource in your own Puppet
# code, otherwise Puppet will fail.
class base::os::debian (
$apt_cache_notin_tmp = false,
$apt_cache_tmp_dir = '/var/cache/apt/tmp'
){
include base::newsyslog include base::newsyslog
# This really needs to be put somewhere else so that all possible uses of # This really needs to be put somewhere else so that all possible uses of
...@@ -76,6 +102,22 @@ class base::os::debian { ...@@ -76,6 +102,22 @@ class base::os::debian {
content => template('base/os/preferences/backports.erb'); content => template('base/os/preferences/backports.erb');
} }
if ($apt_cache_notin_tmp) {
# If we did NOT override the apt cache directory make sure that
# '/var/cache/apt/tmp' exists.
if ($apt_cache_tmp_dir == '/var/cache/apt/tmp') {
file { $apt_cache_tmp_dir:
ensure => directory,
require => Package['apt'],
}
}
file { '/etc/apt/preferences.d/apt_cache_tmp':
content => template('base/os/etc/apt/preferences.d/apt_cache_tmp.erb'),
require => File[$apt_cache_tmp_dir],
}
}
# lsb-release pulls in all of lsb unless we disable recommends handling # lsb-release pulls in all of lsb unless we disable recommends handling
# first, so make sure that we've done that. That should be handled by the # first, so make sure that we've done that. That should be handled by the
# global Package require set above. # global Package require set above.
...@@ -119,7 +161,7 @@ class base::os::debian { ...@@ -119,7 +161,7 @@ class base::os::debian {
'wheezy': { package { 'emacs23-nox': ensure => present } } 'wheezy': { package { 'emacs23-nox': ensure => present } }
'jessie': { package { 'emacs24-nox': ensure => present } } 'jessie': { package { 'emacs24-nox': ensure => present } }
} }
# Ensure this file exists, containing only a comment. # Ensure this file exists, containing only a comment.
file { '/etc/default/locale': file { '/etc/default/locale':
ensure => present, ensure => present,
......
APT::ExtractTemplates::TempDir "<%= @apt_cache_tmp_dir %>";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment