Skip to content

Commit

Permalink
Move package version hold to OCI script for postinst issues (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-antonyuk authored Apr 10, 2024
1 parent c0944da commit 39753af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions install/OneClickInstall/install-Debian/install-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ elif [ "$UPDATE" = "true" ] && [ "$PRODUCT_INSTALLED" = "true" ]; then
fi
fi

hold_package_version dotnet-host opensearch redis-server rabbitmq-server

if [ "$MAKESWAP" == "true" ]; then
make_swap
fi
Expand Down
12 changes: 12 additions & 0 deletions install/OneClickInstall/install-Debian/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ command_exists () {
type "$1" &> /dev/null;
}

# Function to prevent package auto-update
hold_package_version() {
for package in "$@"; do
if command -v apt-mark >/dev/null 2>&1 &&
dpkg -s "$package" >/dev/null 2>&1 &&
! apt-mark showhold | grep -q "$package" >/dev/null 2>&1
then
apt-mark hold "$package"
fi
done
}

check_hardware () {
DISK_REQUIREMENTS=40960;
MEMORY_REQUIREMENTS=8000;
Expand Down
14 changes: 0 additions & 14 deletions install/common/product-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -780,16 +780,6 @@ check_connection_external_services() {
return $HOST_RESPONCE
}

# Function to prevent package auto-update
hold_package_version(){
if command -v apt >/dev/null 2>&1 &&
dpkg -s $1 >/dev/null 2>&1 &&
! apt-mark showhold | grep -q $1 >/dev/null 2>&1
then
apt-mark hold $1 >/dev/null 2>&1
fi
}

if command -v yum >/dev/null 2>&1; then
DIST="RedHat"
PACKAGE_MANAGER="rpm -q"
Expand All @@ -802,7 +792,6 @@ elif command -v apt >/dev/null 2>&1; then
MYSQL_PACKAGE="mysql"
REDIS_PACKAGE="redis-server"
SYSTEMD_DIR="$(dirname $(dpkg-query -L ${PRODUCT}-api | grep systemd/system/))"
hold_package_version dotnet-host
fi

install_json
Expand Down Expand Up @@ -831,23 +820,20 @@ if [[ ! -z $EXTERNAL_ELK_FLAG ]]; then
setup_elasticsearch "EXTERNAL_ELASTIC_SERVER"
elif $PACKAGE_MANAGER opensearch >/dev/null 2>&1; then
setup_elasticsearch "LOCAL_ELASTIC_SERVER"
hold_package_version opensearch
fi

if [[ ! -z $EXTERNAL_REDIS_FLAG ]]; then
check_connection_external_services "$REDIS_HOST" "$REDIS_PORT" "Redis"
setup_redis "EXTERNAL_REDIS_SERVER"
elif $PACKAGE_MANAGER $REDIS_PACKAGE >/dev/null 2>&1; then
setup_redis "LOCAL_REDIS_SERVER"
hold_package_version $REDIS_PACKAGE
fi

if [[ ! -z $EXTERNAL_RABBITMQ_FLAG ]]; then
check_connection_external_services "$RABBITMQ_HOST" "$RABBITMQ_PORT" "RabbitMQ"
setup_rabbitmq "EXTERNAL_RABBITMQ_SERVER"
elif $PACKAGE_MANAGER rabbitmq-server >/dev/null 2>&1; then
setup_rabbitmq "LOCAL_RABBITMQ_SERVER"
hold_package_version rabbitmq-server
fi

restart_services

0 comments on commit 39753af

Please sign in to comment.