|
|
|
@ -40,7 +40,7 @@ REMOVE_PKGS=("centos-linux-release" "centos-gpg-keys" "centos-linux-repos" \
|
|
|
|
|
"kernel-uek" "kernel-uek-core" "kernel-uek-modules" \
|
|
|
|
|
"libreport-plugin-rhtsupport" "libreport-rhel" "insights-client" \
|
|
|
|
|
"libreport-rhel-anaconda-bugzilla" "libreport-rhel-bugzilla" \
|
|
|
|
|
"linux-firmware-core" \
|
|
|
|
|
"linux-firmware-core" "iwlax2xx-firmware" \
|
|
|
|
|
"almalinux-release" "almalinux-gpg-keys" "almalinux-repos" \
|
|
|
|
|
"almalinux-obsolete-packages" "libblockdev-btrfs" \
|
|
|
|
|
"oraclelinux-release" "oraclelinux-release-el8" \
|
|
|
|
@ -51,13 +51,15 @@ REMOVE_PKGS=("centos-linux-release" "centos-gpg-keys" "centos-linux-repos" \
|
|
|
|
|
"vzlinux-release" "vzlinux-gpg-keys" "vzlinux-repos" "vzlinux-obsolete-packages" \
|
|
|
|
|
"evolution-data-server-ui" "epel-next-release")
|
|
|
|
|
REDHAT_DNF_PLUGINS=("product-id" "subscription-manager" "upload-profile")
|
|
|
|
|
REDHAT_REPO_FILES=("/etc/yum.repos.d/redhat.repo" "/etc/yum.repos.d/ubi.repo")
|
|
|
|
|
REDHAT_RHSM_RPMS=("subscription-manager" "subscription-manager-cockpit" "cockpit" "rhc")
|
|
|
|
|
|
|
|
|
|
module_list_enabled=""
|
|
|
|
|
module_list_installed=""
|
|
|
|
|
is_container=0
|
|
|
|
|
|
|
|
|
|
setup_log_files() {
|
|
|
|
|
exec > >(tee /var/log/msvsphere-deploy.log)
|
|
|
|
|
exec > >(tee /var/log/msvsphere-deploy.log) 2>&1
|
|
|
|
|
exec 5> /var/log/msvsphere-deploy.debug.log
|
|
|
|
|
BASH_XTRACEFD=5
|
|
|
|
|
}
|
|
|
|
@ -549,6 +551,21 @@ restore_issue() {
|
|
|
|
|
save_status_of_stage "restore_issue"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Cleanup sssd(8) cache
|
|
|
|
|
cleanup_sss_cache() {
|
|
|
|
|
if get_status_of_stage "cleanup_sss_cache"; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
if [[ "${DOWNGRADE}" == 'YES' ]]; then
|
|
|
|
|
for file in /var/lib/sss/db/cache_*.ldb; do
|
|
|
|
|
if [ -f "${file}" ]; then
|
|
|
|
|
mv -f "${file}" "${file}.bak"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
save_status_of_stage "cleanup_sss_cache"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Recursively removes a given directory.
|
|
|
|
|
#
|
|
|
|
|
# $1 - Directory path.
|
|
|
|
@ -1067,6 +1084,42 @@ disable_redhat_dnf_plugins() {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subscription_manager_unregister() {
|
|
|
|
|
if get_status_of_stage "subscription_manager_unregister"; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
if subscription-manager status >/dev/null 2>&1; then
|
|
|
|
|
subscription-manager remove --all
|
|
|
|
|
subscription-manager unregister
|
|
|
|
|
subscription-manager clean
|
|
|
|
|
fi
|
|
|
|
|
report_step_done "Red Hat Subscription Manager deactivated"
|
|
|
|
|
save_status_of_stage "subscription_manager_unregister"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remove_redhat_rhsm_rpms() {
|
|
|
|
|
if get_status_of_stage "remove_redhat_rhsm_rpms"; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
rpm -e --nodeps "${REDHAT_RHSM_RPMS[@]}" >/dev/null 2>&1 || true
|
|
|
|
|
report_step_done "Red Hat Subscription Manager packages are removed (with rpm --nodeps)"
|
|
|
|
|
save_status_of_stage "remove_redhat_rhsm_rpms"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remove_redhat_repo_files() {
|
|
|
|
|
if get_status_of_stage "remove_redhat_repo_files"; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
local repo
|
|
|
|
|
for repo in "${REDHAT_REPO_FILES[@]}"; do
|
|
|
|
|
if [ -e "${repo}" ]; then
|
|
|
|
|
mv -f "${repo}" "${repo}.$(date -u '+%s')"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
report_step_done "Remove RHEL repositories' files if any"
|
|
|
|
|
save_status_of_stage "remove_redhat_repo_files"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main() {
|
|
|
|
|
is_migration_completed
|
|
|
|
|
local arch
|
|
|
|
@ -1090,6 +1143,7 @@ main() {
|
|
|
|
|
assert_supported_panel "${panel_type}" "${panel_version}"
|
|
|
|
|
|
|
|
|
|
release_url=$(get_release_file_url "${os_version}" "${arch}")
|
|
|
|
|
|
|
|
|
|
tmp_dir=$(mktemp -d --tmpdir="${BASE_TMP_DIR}" .alma.XXXXXX)
|
|
|
|
|
# shellcheck disable=SC2064
|
|
|
|
|
trap "cleanup_tmp_dir ${tmp_dir}" EXIT
|
|
|
|
@ -1097,10 +1151,12 @@ main() {
|
|
|
|
|
|
|
|
|
|
release_path=$(download_release_files "${tmp_dir}" "${release_url}")
|
|
|
|
|
report_step_done 'Download msvsphere-release package'
|
|
|
|
|
if mount | grep -q fuse.lxcfs ||
|
|
|
|
|
if mount 2>/dev/null | grep -q fuse.lxcfs ||
|
|
|
|
|
env | grep -q 'container=lxc' ||
|
|
|
|
|
awk '{print $1}' /proc/vz/veinfo 2>/dev/null ||
|
|
|
|
|
grep docker '/proc/1/cgroup' >/dev/null; then
|
|
|
|
|
grep docker '/proc/1/cgroup' >/dev/null ||
|
|
|
|
|
test -e /.dockerenv; then
|
|
|
|
|
printf '\033[0;32mDeploying inside container\033[0m\n'
|
|
|
|
|
is_container=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
@ -1112,7 +1168,9 @@ main() {
|
|
|
|
|
backup_issue
|
|
|
|
|
|
|
|
|
|
if [[ "${os_type}" == "rhel" ]]; then
|
|
|
|
|
disable_redhat_dnf_plugins
|
|
|
|
|
subscription_manager_unregister
|
|
|
|
|
remove_redhat_rhsm_rpms
|
|
|
|
|
remove_redhat_repo_files
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
case "${os_version}" in
|
|
|
|
@ -1144,6 +1202,7 @@ main() {
|
|
|
|
|
restore_module_streams
|
|
|
|
|
restore_alternatives
|
|
|
|
|
restore_issue
|
|
|
|
|
cleanup_sss_cache
|
|
|
|
|
# don't do this steps if we inside the lxc container
|
|
|
|
|
if [ $is_container -eq 0 ]; then
|
|
|
|
|
install_kernel
|
|
|
|
|