Commit c2332c60 authored by Neal Gompa's avatar Neal Gompa Committed by Commit Bot

Linux: Drop support for configuring mdkrepo repositories with urpmi

Both major members of Mandriva Linux family today either use DNF
as the sole package manager (OpenMandriva Lx) or as a fully supported
co-primary package manager as part of a transition (Mageia).

There are no actively supported releases of either distribution where
DNF isn't available and functional, so to simplify things and eliminate
some potentially poorly tested cruft, let's just get rid of it.

Change-Id: I7aa39f4e93219c4807f03af8de2adbe8935926fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553249
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830276}
parent e2bfd3aa
......@@ -225,18 +225,9 @@ determine_rpm_package_manager() {
if [ -x "$LSB_RELEASE" ]; then
RELEASE=$(lsb_release -i 2> /dev/null | sed 's/:\t/:/' | cut -d ':' -f 2-)
case $RELEASE in
"Fedora"|"Amazon")
"Fedora"|"Amazon"|"Mageia"|"OpenMandrivaLinux")
PACKAGEMANAGERS=(yum)
;;
"Mageia")
PACKAGEMANAGERS=(urpmi)
if [ "$(lsb_release -rs 2> /dev/null)" -ge "6" ]; then
PACKAGEMANAGERS=(yum urpmi)
fi
;;
"MandrivaLinux")
PACKAGEMANAGERS=(urpmi)
;;
"SUSE LINUX"|"openSUSE")
PACKAGEMANAGERS=(yast)
;;
......@@ -248,35 +239,18 @@ determine_rpm_package_manager() {
fi
# Fallback methods that are probably unnecessary on modern systems.
if [ -f "/etc/lsb-release" ]; then
# file missing on Fedora, does not contain DISTRIB_ID on OpenSUSE.
eval $(sed -e '/DISTRIB_ID/!d' /etc/lsb-release)
case $DISTRIB_ID in
MandrivaLinux)
PACKAGEMANAGERS=(urpmi)
;;
esac
fi
if [ "$PACKAGEMANAGERS" ]; then
return
fi
if [ -f "/etc/fedora-release" ] || [ -f "/etc/redhat-release" ]; then
PACKAGEMANAGERS=(yum)
elif [ -f "/etc/system-release" ] && grep -Fq "Amazon Linux" "/etc/system-release"; then
PACKAGEMANAGERS=(yum)
elif [ -f "/etc/SuSE-release" ]; then
PACKAGEMANAGERS=(yast)
elif [ -f "/etc/mandriva-release" ]; then
PACKAGEMANAGERS=(urpmi)
fi
}
DEFAULT_ARCH="@@ARCHITECTURE@@"
YUM_REPO_FILE="/etc/yum.repos.d/@@PACKAGE@@.repo"
ZYPPER_REPO_FILE="/etc/zypp/repos.d/@@PACKAGE@@.repo"
URPMI_REPO_FILE="/etc/urpmi/urpmi.cfg"
install_yum() {
install_rpm_key
......@@ -297,36 +271,6 @@ REPOCONTENT
fi
}
# This is called by the cron job, rather than in the RPM postinstall.
# We cannot do this during the install when urpmi is running due to
# database locking. We also need to enable the repository, and we can
# only do that while we are online.
# see: https://qa.mandriva.com/show_bug.cgi?id=31893
configure_urpmi() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
urpmq --list-media | grep -q -s "^@@PACKAGE@@$"
if [ "$?" -eq "0" ]; then
# Repository already configured
return 0
fi
urpmi.addmedia --update \
"@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
}
install_urpmi() {
# urpmi not smart enough to pull media_info/pubkey from the repository?
install_rpm_key
# Defer urpmi.addmedia to configure_urpmi() in the cron job.
# See comment there.
#
# urpmi.addmedia --update \
# "@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
}
install_yast() {
if [ ! "$REPOCONFIG" ]; then
return 0
......@@ -362,9 +306,6 @@ verify_install() {
"yast")
[ -f "$ZYPPER_REPO_FILE" ]
;;
"urpmi")
urpmq --list-url | grep -q -s "\b@@PACKAGE@@\b"
;;
esac
}
......@@ -385,9 +326,6 @@ update_bad_repo() {
"yast")
update_repo_file "$ZYPPER_REPO_FILE"
;;
"urpmi")
update_urpmi_cfg
;;
esac
done
}
......@@ -428,26 +366,6 @@ update_repo_file() {
sed -i -e "s,^baseurl=.*,baseurl=$REPOCONFIG/$DEFAULT_ARCH," "$REPO_FILE"
}
update_urpmi_cfg() {
REPOCFG=$(urpmq --list-url | grep "\b@@PACKAGE@@\b")
if [ ! "$REPOCFG" ]; then
# Don't do anything if the repo isn't there, since that probably means the
# user deleted it.
return 0
fi
# See if it's the right repo URL
REPOMATCH=$(echo "$REPOCFG" | grep "\b$REPOCONFIG/$DEFAULT_ARCH\b")
# If so, nothing to do
if [ "$REPOMATCH" ]; then
return 0
fi
# Looks like it's the wrong URL, so recreate it.
urpmi.removemedia "@@PACKAGE@@" && \
urpmi.addmedia --update "@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
}
# We only remove the repository configuration during a purge. Since RPM has
# no equivalent to dpkg --purge, the code below is actually never used. We
# keep it only for reference purposes, should we ever need it.
......@@ -456,17 +374,6 @@ update_urpmi_cfg() {
# rm -f "$YUM_REPO_FILE"
#}
#
#remove_urpmi() {
# # Ideally, we would run: urpmi.removemedia "@@PACKAGE@@"
# # but that does not work when urpmi is running.
# # Sentinel comment text does not work either because urpmi.update removes
# # all comments. So we just delete the entry that matches what we originally
# # inserted. If such an entry was added manually, that's tough luck.
# if [ -f "$URPMI_REPO_FILE" ]; then
# sed -i '\_^@@PACKAGE@@ $REPOCONFIG/$DEFAULT_ARCH {$_,/^}$/d' "$URPMI_REPO_FILE"
# fi
#}
#
#remove_yast() {
# # Ideally, we would run: zypper removerepo "@@PACKAGE@@"
# # but that does not work when zypper is running.
......
......@@ -37,15 +37,6 @@ if [ "$repo_add_once" = "true" ]; then
if [ $? -ne 0 ]; then
install_${PACKAGEMANAGER}
fi
# Now do any extra configuration that couldn't be done by post-install.
case $PACKAGEMANAGER in
"urpmi")
# We need to configure urpmi after the install has finished.
# See configure_urpmi() for details.
configure_urpmi
;;
esac
done
if [ $? -eq 0 ]; then
......
......@@ -138,9 +138,6 @@ if [ "$repo_add_once" = "true" ]; then
"yum")
install_yum
;;
"urpmi")
install_urpmi
;;
"yast")
install_yast
;;
......@@ -219,9 +216,6 @@ fi
# "yum")
# remove_yum
# ;;
# "urpmi")
# remove_urpmi
# ;;
# "yast")
# remove_yast
# ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment