-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Liberty registration script support for sll7 clients #1095
Changes from 3 commits
2eb53b9
4a93460
aa5bd37
1dba2e1
1da895d
9db1c42
9e18c90
e09cdb9
851509f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
------------------------------------------------------------------- | ||
Thu Feb 20 15:36:00 UTC 2024 - Zuzana Petrova <[email protected]> | ||
|
||
- Fix for SUSE Liberty registration script to allow RHEL7/SLL7/CentOS7 | ||
clients to register to RMT servers | ||
|
||
------------------------------------------------------------------- | ||
Thu Feb 08 15:33:00 UTC 2024 - Felix Schnizlein <[email protected]> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ SUSECONNECT=/usr/bin/SUSEConnect | |
RPM=/usr/bin/rpm | ||
DNF=/usr/bin/dnf | ||
CURL=/usr/bin/curl | ||
YUM=/usr/bin/yum | ||
YUM_CONFIG_MGR=/usr/bin/yum-config-manager | ||
|
||
TEMPFILE="/etc/pki/ca-trust/source/anchors/rmt.crt" | ||
UPDATE_CA_TRUST=/usr/bin/update-ca-trust | ||
RPM_GPG_KEY_LOCATION="/etc/pki/rpm-gpg" | ||
|
@@ -74,7 +77,7 @@ fi | |
|
||
if [ -z "$REGURL" ]; then | ||
echo "Missing registration URL. Abort." | ||
usage | ||
exit 1 | ||
fi | ||
|
||
if [ ! -x $RPM ]; then | ||
|
@@ -87,6 +90,11 @@ if [ ! -x $CURL ]; then | |
exit 1 | ||
fi | ||
|
||
if [[ ! -e /etc/os-release ]]; then | ||
echo "/etc/os-release file not found. Couldn't determine OS. Abort." | ||
exit 1 | ||
fi | ||
|
||
# Import Self-signed CERT as Trusted | ||
if [ -z "$REGCERT" ]; then | ||
CERTURL=`echo "$REGURL" | awk -F/ '{print "https://" $3 "/rmt.crt"}'` | ||
|
@@ -112,43 +120,43 @@ if [ -x $UPDATE_CA_TRUST ]; then | |
fi | ||
|
||
SLL_version=`cat /etc/os-release | grep "VERSION_ID" | cut -d\" -f2 | cut -d\. -f1` | ||
if [[ ${SLL_version} > 8 ]]; then | ||
if [[ ${SLL_version} > 8 ]]; then | ||
SLL_name="SLL"; | ||
SLL_release_package="sll-release" | ||
elif [[ ${SLL_version} -eq 7 ]]; then | ||
SLL_name="RES"; | ||
SLL_release_package="sles_es-release-server" | ||
elif [[ ${SLL_version} -eq 8 ]]; then | ||
SLL_name="RES"; | ||
SLL_release_package="sles_es-release" | ||
else | ||
SLL_name="RES"; | ||
SLL_release_package="sles_es-release" | ||
echo "Unsupported or unknown base version. Abort"; | ||
exit 1 | ||
fi | ||
|
||
echo "detect ${SLL_name} version... ${SLL_version}" | ||
|
||
echo "Disabling all repositories" | ||
dnf config-manager --disable $(dnf repolist -q | awk '{ print $1 }' | grep -v repo) | ||
#sed -i 's/^enabled=1/enabled=0/' /etc/yum.repos.d/* | ||
|
||
# on Centos /usr/share/redhat-release is a file, on RHEL and RES it is a directory | ||
# so this is CentOS only workaround | ||
if [ -f /usr/share/redhat-release ] | [ -h /usr/share/redhat-release ]; then | ||
rm -f /usr/share/redhat-release; | ||
fi | ||
|
||
# on RHEL9 (not RHEL8) redhat-release is protected and cannot be updated to sll-release | ||
if [ -f /etc/dnf/protected.d/redhat-release.conf ]; then | ||
rm -f /etc/dnf/protected.d/redhat-release.conf; | ||
fi | ||
|
||
echo "Importing repomd.xml.key" | ||
$CURL --silent --show-error --insecure ${REGURL}/repo/SUSE/Updates/${SLL_name}/${SLL_version}/x86_64/update/repodata/repomd.xml.key --output repomd.xml.key | ||
$RPM --import repomd.xml.key | ||
|
||
if [ ! -x $SUSECONNECT ]; then | ||
echo "Downloading SUSEConnect" | ||
if [[ ${SLL_version} > 7 ]]; then | ||
|
||
if [ ! -x $DNF ]; then | ||
echo "dnf command not found. Abort." | ||
exit 1 | ||
fi | ||
|
||
echo "Disabling all repositories" | ||
$DNF config-manager --disable $(dnf repolist -q | awk '{ print $1 }' | grep -v repo) | ||
#sed -i 's/^enabled=1/enabled=0/' /etc/yum.repos.d/* | ||
# on RHEL9 (not RHEL8) redhat-release is protected and cannot be updated to sll-release | ||
if [ -f /etc/dnf/protected.d/redhat-release.conf ]; then | ||
rm -f /etc/dnf/protected.d/redhat-release.conf; | ||
fi | ||
|
||
$DNF config-manager --add-repo ${REGURL}/repo/SUSE/Updates/${SLL_name}/${SLL_version}/x86_64/update | ||
$DNF config-manager --add-repo ${REGURL}/repo/SUSE/Updates/${SLL_name}-AS/${SLL_version}/x86_64/update | ||
$DNF install --allowerasing ${SLL_release_package} | ||
|
@@ -161,6 +169,30 @@ if [ ! -x $SUSECONNECT ]; then | |
$DNF install SUSEConnect librepo | ||
$DNF config-manager --set-disabled "${RMTNAME}_repo_SUSE_Updates_${SLL_name}_${SLL_version}_x86_64_update" | ||
$DNF config-manager --set-disabled "${RMTNAME}_repo_SUSE_Updates_${SLL_name}-AS_${SLL_version}_x86_64_update" | ||
|
||
elif [[ ${SLL_version} -eq 7 ]]; then | ||
# For SLL7 we need to have yum, yum_config_mgr, sles_os-release-server, etc.. | ||
if [ ! -x "$YUM_CONFIG_MGR" ]; then | ||
echo "YUM config manager is not installed. Please install yum-config-manager and retry. Abort." | ||
exit 1 | ||
fi | ||
|
||
echo "Disabling all repositories" | ||
$YUM_CONFIG_MGR --disable \* | ||
|
||
# on Centos /usr/share/redhat-release is a file, on RHEL and RES it is a directory | ||
# so this is CentOS only workaround (on some system it is a normal file, on some systems a symlink) | ||
if [ -f /usr/share/redhat-release ] | [ -h /usr/share/redhat-release ]; then | ||
rm -f /usr/share/redhat-release; | ||
fi | ||
|
||
$YUM_CONFIG_MGR --add-repo ${REGURL}/repo/SUSE/Updates/${SLL_name}/${SLL_version}/x86_64/update | ||
$YUM_CONFIG_MGR --enable *suse.* | ||
|
||
$YUM install SUSEConnect librepo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this install also the sll-release package or at least make sure that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added the fix to this pull request (at least I hope I did it correctly). |
||
|
||
|
||
fi | ||
elif [[ ${SLL_version} -eq 8 ]]; then | ||
# For SLL8, the release package is already installed, just import the keys | ||
import_rpm_signing_keys | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This produces a lot of output. Can this be piped to
/dev/null
or is the output required?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I redirected output of
$YUM_CONFIG_MGR --disable *
and
$YUM_CONFIG_MGR --enable suse.
to /dev/null
error output is not redirected.
see last two commits