Skip to content
Open
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
36 changes: 18 additions & 18 deletions kafka/kafka-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,34 @@ function remove_old_backports {
oldstable=$(curl -s https://deb.debian.org/debian/dists/oldstable/Release | awk '/^Codename/ {print $2}');
stable=$(curl -s https://deb.debian.org/debian/dists/stable/Release | awk '/^Codename/ {print $2}');

matched_files="$(grep -rsil '\-backports' /etc/apt/sources.list*)"
if [[ -n "$matched_files" ]]; then
for filename in "$matched_files"; do
local matched_files=( $(grep -rsil '\-backports' /etc/apt/sources.list* || true) )
if [[ ${#matched_files[@]} -gt 0 ]]; then
for filename in "${matched_files[@]}"; do
grep -e "$oldstable-backports" -e "$stable-backports" "$filename" || \
sed -i -e 's/^.*-backports.*$//' "$filename"
done
fi

local security_files=( $(grep -rsil 'bullseye-security' /etc/apt/sources.list*||:) )
if [[ ${#security_files[@]} -gt 0 ]]; then
local security_mirror="https://snapshot.debian.org/archive/debian-security/20260830T000000Z"
Comment thread
IshaAg marked this conversation as resolved.
Resolved
if curl -fsSLI --connect-timeout 5 --max-time 10 "https://archive.debian.org/debian-security/dists/bullseye-security/InRelease" >/dev/null 2>&1; then
security_mirror="https://archive.debian.org/debian-security"
fi
for filename in "${security_files[@]}"; do
sed -i "s|https\?://[^/]\+/debian-security|${security_mirror}|g" "${filename}"
done
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
fi
}

function main(){
local java_major_version=$(java -version 2>&1 | grep -oP 'version "?(1\.)?\K\d+' || true)
OS=$(. /etc/os-release && echo "${ID}")

# The remove_old_backports function is breaking the init action on
# Dataproc 2.1 (Debian 11) images.
#
# The function's logic fetches the current Debian stable (Trixie) and
# oldstable (Bookworm) codenames and deletes any backports repository
# that does not match.
#
# This incorrectly removes the essential bullseye-backports repository
# on Debian 11 systems, as "bullseye" is no longer stable or oldstable.
# This change disables the function to prevent it from damaging the
# system's valid apt configuration.
#
# if [[ ${OS} == debian ]] && [[ $(echo "${DATAPROC_IMAGE_VERSION} <= 2.1" | bc -l) == 1 ]]; then
# remove_old_backports
# fi
if [[ ${OS} == debian ]] && [[ $(echo "${DATAPROC_IMAGE_VERSION} <= 2.1" | bc -l) == 1 ]]; then
remove_old_backports
fi

if [[ ${java_major_version} -lt 11 ]]; then
echo "Error: Java 11 or higher is required for CMAK" >&2
Expand Down
21 changes: 17 additions & 4 deletions kafka/kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function recv_keys() {
mkdir -p /etc/apt/trusted.gpg.d
gpg --export B7B3B788A8D3785C > /etc/apt/trusted.gpg.d/mysql-repo.gpg
else
retry_apt_command "apt-get install -y gnupg2 && \
retry_apt_command "apt-get update || true && \
apt-get install -y gnupg2 && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C"
fi
}
Expand Down Expand Up @@ -212,13 +213,25 @@ function remove_old_backports {
oldstable=$(curl -s https://deb.debian.org/debian/dists/oldstable/Release | awk '/^Codename/ {print $2}');
stable=$(curl -s https://deb.debian.org/debian/dists/stable/Release | awk '/^Codename/ {print $2}');

matched_files="$(grep -rsil '\-backports' /etc/apt/sources.list*)"
if [[ -n "$matched_files" ]]; then
for filename in "$matched_files"; do
local matched_files=( $(grep -rsil '\-backports' /etc/apt/sources.list* || true) )
if [[ ${#matched_files[@]} -gt 0 ]]; then
for filename in "${matched_files[@]}"; do
grep -e "$oldstable-backports" -e "$stable-backports" "$filename" || \
sed -i -e 's/^.*-backports.*$//' "$filename"
done
fi

local security_files=( $(grep -rsil 'bullseye-security' /etc/apt/sources.list*||:) )
if [[ ${#security_files[@]} -gt 0 ]]; then
local security_mirror="https://snapshot.debian.org/archive/debian-security/20260830T000000Z"
Comment thread
IshaAg marked this conversation as resolved.
Resolved
if curl -fsSLI --connect-timeout 5 --max-time 10 "https://archive.debian.org/debian-security/dists/bullseye-security/InRelease" >/dev/null 2>&1; then
security_mirror="https://archive.debian.org/debian-security"
fi
for filename in "${security_files[@]}"; do
sed -i "s|https\?://[^/]\+/debian-security|${security_mirror}|g" "${filename}"
done
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
fi
}

function main() {
Expand Down