%PDF- %PDF-
Direktori : /proc/2/cwd/opt/imunify360/venv/share/imunify360/scripts/ |
Current File : //proc/2/cwd/opt/imunify360/venv/share/imunify360/scripts/imunify-force-update.sh |
#!/usr/bin/env bash set -o pipefail set -o errexit # Script to upgrade ImunifyAV and/or Imunify360 # bypassing gradual rollout PRODUCT='' detect_ostype() { if [ ! -f /etc/os-release ] then OSTYPE=centos else source /etc/os-release if echo $ID $ID_LIKE | grep debian >/dev/null then OSTYPE=debian else OSTYPE=centos fi fi } detect_product_debian() { if dpkg -s imunify-antivirus | grep '^Status: ' | grep -q installed; then PRODUCT='imunify-antivirus' fi if dpkg -s imunify360-firewall | grep '^Status: ' | grep -q installed; then PRODUCT='imunify360-firewall' fi } detect_product_centos() { if rpm -q imunify-antivirus; then PRODUCT='imunify-antivirus' fi if rpm -q imunify360-firewall; then PRODUCT='imunify360-firewall' fi } update_centos() { yum -y update $PRODUCT --enablerepo="imunify360-rollout-*-bypass" } update_debian() { # first enable rollout bypass repos APT_REPO_PATH="/etc/apt/sources.list.d/imunify-rollout-bypass.list" UPDATE_PARAMS='' cp "${APT_REPO_PATH}.disabled" $APT_REPO_PATH apt-get update # for silent mode # force save old config files. new files will be saved by dpkg if [ "$DEBIAN_FRONTEND" == "noninteractive" ]; then # see dpkg options https://man7.org/linux/man-pages/man1/dpkg.1.html # the same options as in the daily update cronjob </dev/null apt-get install --only-upgrade -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" "$PRODUCT" else # interactive apt-get install --only-upgrade -y "$PRODUCT" fi rm $APT_REPO_PATH } detect_ostype detect_product_${OSTYPE} if [ -z $PRODUCT ]; then echo "Neither ImunifyAV nor Imunify360 found installed" exit 1 fi update_${OSTYPE}