Doit
view release on metacpan or search on metacpan
# apt_get_update_opts).
sub _fix_Dockerfile_for_dist {
my($distro_spec, $add_opts_ref) = @_;
if ($distro_spec =~ m{^debian:(wheezy|jessie|stretch|7|8|9)$}) {
my $codename = $1;
if ($codename eq '7') { $codename = 'wheezy' }
elsif ($codename eq '8') { $codename = 'jessie' }
elsif ($codename eq '9') { $codename = 'stretch' }
# https://unix.stackexchange.com/questions/508724/failed-to-fetch-jessie-backports-repository
$add_opts_ref->{apt_get_update_opts} = ' -o Acquire::Check-Valid-Until=false';
# https://askubuntu.com/questions/74345/how-do-i-bypass-ignore-the-gpg-signature-checks-of-apt
$add_opts_ref->{apt_get_install_opts} = ' -o APT::Get::AllowUnauthenticated=true';
<<EOF;
RUN echo 'deb [check-valid-until=no] http://archive.debian.org/debian $codename main' > /etc/apt/sources.list
RUN echo 'deb [check-valid-until=no] http://archive.debian.org/debian-security/ $codename/updates main' >> /etc/apt/sources.list
EOF
} elsif ($distro_spec =~ m{^perl:(5\.18\.\d+|.*stretch)$}) { # XXX add more perl versions based on jessie/stretch/... containers
# docker perl images are based on debian base images; older
# ones need patching
$add_opts_ref->{apt_get_install_opts} = ' -o APT::Get::AllowUnauthenticated=true';
<<'EOF';
my $distro_spec = delete $opts{distro_spec} || die 'Please specify distro_spec';
die 'Unhandled options: ' . join(' ', %opts) if %opts;
if ($distro_spec eq 'centos:6') {
$doit->mkdir("$dir/.distro_support");
# Instructions from https://gcore.de/de/hilfe/linux/centos6-repo-nach-eol-anpassen.php
$doit->write_binary("$dir/.distro_support/CentOS.repo", <<'EOF');
[base]
name=CentOS-6.10 - Base
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
#released updates
[updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
# additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
# additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
EOF
$doit->write_binary("$dir/.distro_support/epel.repo", <<'EOF');
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
metadata_expire=never
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch/debug
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
metadata_expire=never
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/SRPMS
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
metadata_expire=never
EOF
$doit->write_binary("$dir/.distro_support/run.sh", <<'EOF');
#! /bin/sh
set -ex
rm -f /etc/yum.repos.d/CentOS*.repo
rm -f /etc/yum.repos.d/epel.repo
cp .distro_support/CentOS.repo /etc/yum.repos.d/
cp .distro_support/epel.repo /etc/yum.repos.d/
yum clean all
lib/Doit/Deb.pm view on Meta::CPAN
if ($keyserver) {
error "Don't define both url and keyserver";
}
}
my $found_key;
if ($key) {
$key =~ s{\s}{}g; # convenience: strip spaces from key ('apt-key finger' returns them with spaces)
local $ENV{LC_ALL} = 'C';
# XXX If run with $sudo, then this will emit warnings in the form
# gpg: WARNING: unsafe ownership on configuration file `$HOME/.gnupg/gpg.conf'
# Annoying, but harmless. Could be workarounded by specifying
# '--homedir=/root/.gpg', but this would create gpg files under ~root. Similar
# if using something like
# local $ENV{HOME} = (getpwuid($<))[7];
# Probably better would be to work with privilege escalation and run
# this command as normal user (to be implemented).
#
# Older Debian (jessie and older?) have only /etc/apt/trusted.gpg,
# newer ones (stretch and newer?) have /etc/apt/trusted.gpg.d/*.gpg
SEARCH_FOR_KEY: {
require File::Glob;
for my $keyfile ('/etc/apt/trusted.gpg', File::Glob::bsd_glob('/etc/apt/trusted.gpg.d/*.gpg')) {
if (-r $keyfile) {
my @cmd = ('gpg', '--keyring', $keyfile, '--list-keys', '--fingerprint', '--with-colons');
open my $fh, '-|', @cmd
or error "Running '@cmd' failed: $!";
while(<$fh>) {
if (m{^fpr:::::::::\Q$key\E:$}) {
$found_key = 1;
last SEARCH_FOR_KEY;
}
}
close $fh
or error "Running '@cmd' failed: $!";
( run in 0.865 second using v1.01-cache-2.11-cpan-e1769b4cff6 )