VIF_GUEST=eth0
##########
-FEDORA_MIRROR_BASE="http://mirror.onelab.eu/fedora/"
+FEDORA_MIRROR="http://mirror.onelab.eu/"
FEDORA_MIRROR_KEYS="http://mirror.onelab.eu/keys/"
FEDORA_PREINSTALLED="dnf dnf-yum passwd rsyslog vim-minimal dhclient chkconfig rootfiles policycoreutils openssh-server openssh-clients"
DEBIAN_PREINSTALLED="openssh-server openssh-client"
# copy yum config and repo files
cp /etc/yum.conf $INSTALL_ROOT/etc/
- cp /etc/yum.repos.d/fedora* $INSTALL_ROOT/etc/yum.repos.d/
+ cp /etc/yum.repos.d/fedora{,-updates}.repo $INSTALL_ROOT/etc/yum.repos.d/
# append fedora repo files with desired ${fedora_release} and $basearch
for f in $INSTALL_ROOT/etc/yum.repos.d/* ; do
sed -i "s/\$basearch/$arch/g; s/\$releasever/${fedora_release}/g;" $f
done
- MIRROR_URL=$FEDORA_MIRROR_BASE/releases/${fedora_release}/Everything/$arch/os
+ MIRROR_URL=$FEDORA_MIRROR/fedora/releases/${fedora_release}/Everything/$arch/os
# since fedora18 the rpms are scattered by first name
# first try the second version of fedora-release first
RELEASE_URLS=""
local subindex
for subindex in 3 2 1; do
- RELEASE_URLS="$RELEASE_URLS $MIRROR_URL/Packages/f/fedora-release-${fedora_release}-1.noarch.rpm"
+ RELEASE_URLS="$RELEASE_URLS $MIRROR_URL/Packages/f/fedora-release-${fedora_release}-${subindex}.noarch.rpm"
done
RELEASE_TARGET=$INSTALL_ROOT/fedora-release-${fedora_release}.noarch.rpm
local guest_ifcfg=${lxc_root}/etc/sysconfig/network-scripts/ifcfg-$VIF_GUEST
mkdir -p $(dirname ${guest_ifcfg})
- # starting with f29, we go for NetworkManager as older network-scripts
- # is about to be deprecated
- local nm_controlled=false
- [[ $fcdistro == f29 ]] && nm_controlled=true
- [[ $fcdistro == f3[0-9] ]] && nm_controlled=true
-
+ # starting with f27, we go for NetworkManager
+ # no more NM_CONTROLLED nonsense
if [ -n "$NAT_MODE" ]; then
- write_guest_ifcfg_natip $nm_controlled
+ write_guest_ifcfg_natip
else
- write_guest_ifcfg_publicip $nm_controlled
+ write_guest_ifcfg_publicip
fi > $guest_ifcfg
[ -z "$IMAGE" ] && fedora_configure_yum $lxc $fcdistro $pldistro
echo "Initializing yum.repos.d in $lxc"
rm -f $lxc_root/etc/yum.repos.d/*
- cat > $lxc_root/etc/yum.repos.d/building.repo <<EOF
-[fedora]
-name=Fedora \$releasever - \$basearch
-baseurl=$FEDORA_MIRROR_BASE/releases/\$releasever/Everything/\$basearch/os/
-enabled=1
-metadata_expire=7d
-gpgcheck=1
-gpgkey=$FEDORA_MIRROR_KEYS/RPM-GPG-KEY-fedora-${fedora_release}-primary
-
-[updates]
-name=Fedora \$releasever - \$basearch - Updates
-baseurl=$FEDORA_MIRROR_BASE/updates/\$releasever/\$basearch/
-enabled=1
-metadata_expire=7d
-gpgcheck=1
-gpgkey=$FEDORA_MIRROR_KEYS/RPM-GPG-KEY-fedora-${fedora_release}-primary
-EOF
+ # use mirroring/ stuff instead of a hard-wired config
+ local repofile=$lxc_root/etc/yum.repos.d/building.repo
+ yumconf_mirrors $repofile ${DIRNAME} $fcdistro \
+ "" $FEDORA_MIRROR
+ # the keys stuff requires adjustment though
+ sed -i $repofile -e s,'gpgkey=.*',"gpgkey=${FEDORA_MIRROR_KEYS}/RPM-GPG-KEY-fedora-${fedora_release}-primary,"
# import fedora key so that gpgckeck does not whine or require stdin
# required since fedora24
# this one is dhcp-based
function write_guest_ifcfg_natip () {
- local nm_controlled=$1; shift
cat <<EOF
DEVICE=$VIF_GUEST
BOOTPROTO=dhcp
TYPE=Ethernet
MTU=1500
EOF
- [ "$nm_controlled" == true ] || echo NM_CONTROLLED=no
}
# use fixed GUEST_IP as specified by GUEST_HOSTNAME
function write_guest_ifcfg_publicip () {
- local nm_controlled=$1; shift
cat <<EOF
DEVICE=$VIF_GUEST
BOOTPROTO=static
TYPE=Ethernet
MTU=1500
EOF
- [ "$nm_controlled" == true ] || echo NM_CONTROLLED=no
}
function devel_or_test_tools () {