Skip to content
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

Added debian11 as possible WN OS #320

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Changes since the last release

### New features / functionalities

- Added support for Debian 11 and Ubuntu 22 worker nodes (PR #320)

### Changed defaults / behaviours

### Deprecated / removed options and commands
Expand Down
65 changes: 51 additions & 14 deletions creation/web_base/condor_platform_select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ error_gen=$(gconfig_get ERROR_GEN_PATH "$glidein_config")
condor_vars_file=$(gconfig_get CONDOR_VARS_FILE "$glidein_config")

condor_os=$(gconfig_get CONDOR_OS "$glidein_config")
if [ -z "$condor_os" ]; then
if [[ -z "$condor_os" ]]; then
condor_os="default"
fi

Expand Down Expand Up @@ -72,13 +72,14 @@ findversion_debian() {
dist_id_line=$(grep "DISTRIB_ID" /etc/lsb-release)
dist_rel_line=$(grep "DISTRIB_RELEASE" /etc/lsb-release)
if [[ ${dist_id_line} == *"Debian"* ]]; then
[[ ${dist_rel_line:16:3} = "11." ]] && condor_os='linux-debian10' && return
[[ ${dist_rel_line:16:3} = "12." ]] && condor_os='linux-debian11' && return
mambelli marked this conversation as resolved.
Show resolved Hide resolved
[[ ${dist_rel_line:16:3} = "11." ]] && condor_os='linux-debian11' && return
[[ ${dist_rel_line:16:3} = "10." ]] && condor_os='linux-debian10' && return
[[ ${dist_rel_line:16:2} = "9." ]] && condor_os='linux-debian9' && return
[[ ${dist_rel_line:16:2} = "8." ]] && condor_os='linux-debian8' && return
[[ ${dist_rel_line:16:2} = "7." ]] && condor_os='linux-debian7' && return
elif [[ ${dist_id_line} == *"Ubuntu"* ]]; then
[[ ${dist_rel_line:16:3} = "22." ]] && condor_os='linux-ubuntu20' && return
[[ ${dist_rel_line:16:3} = "22." ]] && condor_os='linux-ubuntu22' && return
[[ ${dist_rel_line:16:3} = "20." ]] && condor_os='linux-ubuntu20' && return
[[ ${dist_rel_line:16:3} = "18." ]] && condor_os='linux-ubuntu18' && return
[[ ${dist_rel_line:16:3} = "16." ]] && condor_os='linux-ubuntu16' && return
Expand All @@ -87,8 +88,43 @@ findversion_debian() {
fi
}

findversion_os_release() {
local os_f=
local os_release dist_id dist_id_like ver major_ver
if [[ -f "/etc/os-release" ]]; then
os_f="/etc/os-release"
elif [[ -f "/usr/lib/os-release" ]]; then
os_f="/usr/lib/os-release"
else
echo "No os-release files"
return
fi
os_release=$(cat "$os_f")
dist_id=$(echo "$os_release" | awk -F '=' '/^ID=/ {print $2}')
dist_id_like=$(echo "$os_release" | awk -F '=' '/^ID_LIKE=/ {print $2}')
ver=$(echo "$os_release" | awk -F '=' '/^VERSION_ID=/ {print $2}' | tr -d '"')
major_ver="${ver%%.*}"
# write the release info
if [[ $dist_id_like =~ (rhel|centos|fedora) ]]; then
condor_os="linux-rhel${major_ver},rhel${major_ver}"
else
case "$dist_id" in
debian)
condor_os="linux-debian${major_ver}";;
ubuntu)
condor_os="linux-ubuntu${major_ver}";;
*)
echo "Unknown dist id"
esac
fi
}

# The current (since 2012) recommendation for release checking is /etc/os-release
# It should replace /etc/redhat-release and /etc/fedora-release and lsb
# https://www.freedesktop.org/software/systemd/man/os-release.html
# https://0pointer.de/blog/projects/os-release
if [[ "$condor_os" == "auto" ]]; then
if [ -f "/etc/redhat-release" ]; then
if [[ -f "/etc/redhat-release" ]]; then
# rhel, now determine the version
# default RHEL
condor_os='linux-rhel7,rhel7'
Expand All @@ -101,10 +137,10 @@ if [[ "$condor_os" == "auto" ]]; then
# # I am not aware of anything newer right now
# condor_os='linux-rhel5'
#fi
elif [ -f "/etc/lsb-release" ]; then
elif [[ -f "/etc/lsb-release" ]]; then
# debian/ubuntu, now determine the version
# default debian
condor_os='linux-debian10'
condor_os='linux-debian11'
findversion_debian
# elif [ -f "/etc/debian_version" ]; then
# # debian, now determine the version
Expand All @@ -116,7 +152,8 @@ if [[ "$condor_os" == "auto" ]]; then
# # I am not aware of anything newer right now
# condor_os='linux-debian50'
# fi

elif [[ -f "/etc/os-release" || -f "/usr/lib/os-release" ]]; then
findversion_os_release
else
#echo "Not a RHEL not Debian compatible system. Autodetect not supported" 1>&2
STR="Not a RHEL not Debian compatible system. Autodetect not supported"
Expand All @@ -128,7 +165,7 @@ if [[ "$condor_os" == "auto" ]]; then
# https://github.com/htcondor/htcondor/blob/7ecce4e5c16072162903844eef817b11c6e9b960/src/condor_scripts/condor_remote_cluster#L284-L310
# Ticket: https://github.com/glideinWMS/glideinwms/issues/97
echo "###OS RELEASE INFORMATION###"
if [ -f "/etc/os-release" ]; then
if [[ -f "/etc/os-release" ]]; then
os_release=`cat /etc/os-release`
dist_id=`echo "$os_release" | awk -F '=' '/^ID=/ {print $2}'`
dist_id_like=`echo "$os_release" | awk -F '=' '/^ID_LIKE=/ {print $2}'`
Expand All @@ -155,7 +192,7 @@ if [[ "$condor_os" == "auto" ]]; then
fi

condor_arch=$(gconfig_get CONDOR_ARCH "$glidein_config")
if [ -z "$condor_arch" ]; then
if [[ -z "$condor_arch" ]]; then
condor_arch="default"
fi

Expand All @@ -180,19 +217,19 @@ if [[ "$condor_arch" == "auto" ]]; then
fi

condor_version=$(gconfig_get CONDOR_VERSION "$glidein_config")
if [ -z "$condor_version" ]; then
if [[ -z "$condor_version" ]]; then
condor_version="default"
fi

condor_platform_check=""
for version_el in $(echo "$condor_version" | tr ',' ' '); do
if [ -z "$condor_platform_check" ]; then
if [[ -z "$condor_platform_check" ]]; then
# not yet found, try to find it
for os_el in $(echo "$condor_os" | tr ',' ' '); do
if [ -z "$condor_platform_check" ]; then
if [[ -z "$condor_platform_check" ]]; then
# not yet found, try to find it
for arch_el in $(echo "$condor_arch" | tr ',' ' '); do
if [ -z "$condor_platform_check" ]; then
if [[ -z "$condor_platform_check" ]]; then
# not yet found, try to find it
# combine the three
condor_platform="${version_el}-${os_el}-${arch_el}"
Expand All @@ -206,7 +243,7 @@ for version_el in $(echo "$condor_version" | tr ',' ' '); do
fi
done

if [ -z "$condor_platform_check" ]; then
if [[ -z "$condor_platform_check" ]]; then
# uhm... all tries failed
STR="Cannot find a supported platform\n"
STR+="CONDOR_VERSION '$condor_version'\n"
Expand Down
Loading