1
0

Use self-contained config file for DNF with repos defined

With self-contained configuration, the repository definitions
will be predictable based on the target architecture and avoid
leaking anything from the host.
This commit is contained in:
Neal Gompa 2020-01-05 13:38:45 -05:00
parent b59ebbab15
commit 9d2fe5306d
2 changed files with 43 additions and 5 deletions

View File

@ -108,7 +108,8 @@ function createchroot()
# enabling extra Mageia repositories # enabling extra Mageia repositories
function genusemirroroptions() function genusemirroroptions()
{ {
DNF_MIRROROPTS="--nogpgcheck --releasever=${MAGEIA_VERSION}" DNF_CONFIGPATH="$(dirname $(realpath "$0"))/mageia4arm-dnf.conf"
DNF_MIRROROPTS="--config=${DNF_CONFIGPATH} --forcearch=${ARM_VERSION} --nogpgcheck --releasever=${MAGEIA_VERSION}"
if [ ! -z "${MIRROR}" ]; then if [ ! -z "${MIRROR}" ]; then
DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=\* --repofrompath=mgarel,${MIRROR}/media/core/release/ --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgarel --enablerepo=mgaup" DNF_MIRROROPTS="${DNF_MIRROROPTS} --disablerepo=\* --repofrompath=mgarel,${MIRROR}/media/core/release/ --repofrompath=mgaup,${MIRROR}/media/core/updates/ --enablerepo=mgarel --enablerepo=mgaup"
if [ ${NONFREE} -eq 1 ]; then if [ ${NONFREE} -eq 1 ]; then
@ -217,22 +218,22 @@ function installbasesystem()
fi fi
title "installing basesystem" title "installing basesystem"
/usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install shadow-utils basesystem-minimal
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting" error "line ${LINENO} error installing shadow-utils or basesystem-minimal : exiting"
exit ${ERR_1} exit ${ERR_1}
fi fi
#/usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install basesystem-minimal #/usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install basesystem-minimal
#if [ ${?} -ne 0 ]; then #if [ ${?} -ne 0 ]; then
# error "line ${LINENO} error installing basesystem-minimal : exiting" # error "line ${LINENO} error installing basesystem-minimal : exiting"
# exit ${ERR_1} # exit ${ERR_1}
#fi #fi
/usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales u-boot /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install dnf dnf-plugins-core locales u-boot
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
error "line ${LINENO} error installing dnf or locales : exiting" error "line ${LINENO} error installing dnf or locales : exiting"
exit ${ERR_1} exit ${ERR_1}
fi fi
/usr/bin/dnf --installroot="${BUILD_PATH}" --setopt=ignorearch=True ${DNF_MIRROROPTS} --assumeyes install urpmi /usr/bin/dnf --installroot="${BUILD_PATH}" ${DNF_MIRROROPTS} --assumeyes install urpmi
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
error "line ${LINENO} error installing urpmi : exiting" error "line ${LINENO} error installing urpmi : exiting"
exit ${ERR_1} exit ${ERR_1}

37
mageia4arm-dnf.conf Normal file
View File

@ -0,0 +1,37 @@
# mageia4arm dnf configuration
[main]
keepcache=1
debuglevel=2
reposdir=/dev/null
logfile=/var/log/mga4arm-dnf.log
retries=20
obsoletes=1
syslog_ident=mageia4arm
syslog_device=
metadata_expire=0
best=1
protected_packages=
# repos
[mageia-$arch]
name=Mageia $releasever - $arch
#baseurl=http://mirrors.kernel.org/mageia/distrib/$releasever/$arch/media/core/release/
#metalink=https://mirrors.mageia.org/metalink?distrib=mageia-$releasever&arch=$arch@&section=core&repo=release
mirrorlist=https://www.mageia.org/mirrorlist/?release=$releasever&arch=$arch&section=core&repo=release
fastestmirror=1
gpgcheck=1
gpgkey=file:///usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia
enabled=1
skip_if_unavailable=False
[updates-$arch]
name=Mageia $releasever - $arch - Updates
#baseurl=http://mirrors.kernel.org/mageia/distrib/$releasever/$arch/media/core/updates/
#metalink=https://mirrors.mageia.org/metalink?distrib=mageia-$releasever&arch=$arch@&section=core&repo=updates
mirrorlist=https://www.mageia.org/mirrorlist/?release=$releasever&arch=$arch&section=core&repo=updates
fastestmirror=1
gpgcheck=1
gpgkey=file:///usr/share/distribution-gpg-keys/mageia/RPM-GPG-KEY-Mageia
enabled=1
skip_if_unavailable=False