|
|
@ -154,7 +154,19 @@ network_check() { |
|
|
|
# This function updates the Container OS by running apt-get update and upgrade |
|
|
|
# This function updates the Container OS by running apt-get update and upgrade |
|
|
|
update_os() { |
|
|
|
update_os() { |
|
|
|
msg_info "Updating Container OS" |
|
|
|
msg_info "Updating Container OS" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Detect the OS |
|
|
|
|
|
|
|
if [ -f /etc/debian_version ]; then |
|
|
|
|
|
|
|
OS="debian" |
|
|
|
|
|
|
|
elif [ -f /etc/centos-release ]; then |
|
|
|
|
|
|
|
OS="centos" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
msg_error "Unsupported OS detected" |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [[ "$CACHER" == "yes" ]]; then |
|
|
|
if [[ "$CACHER" == "yes" ]]; then |
|
|
|
|
|
|
|
if [ "$OS" == "debian" ]; then |
|
|
|
echo "Acquire::http::Proxy-Auto-Detect \"/usr/local/bin/apt-proxy-detect.sh\";" >/etc/apt/apt.conf.d/00aptproxy |
|
|
|
echo "Acquire::http::Proxy-Auto-Detect \"/usr/local/bin/apt-proxy-detect.sh\";" >/etc/apt/apt.conf.d/00aptproxy |
|
|
|
cat <<EOF >/usr/local/bin/apt-proxy-detect.sh |
|
|
|
cat <<EOF >/usr/local/bin/apt-proxy-detect.sh |
|
|
|
#!/bin/bash |
|
|
|
#!/bin/bash |
|
|
@ -165,10 +177,23 @@ else |
|
|
|
fi |
|
|
|
fi |
|
|
|
EOF |
|
|
|
EOF |
|
|
|
chmod +x /usr/local/bin/apt-proxy-detect.sh |
|
|
|
chmod +x /usr/local/bin/apt-proxy-detect.sh |
|
|
|
|
|
|
|
elif [ "$OS" == "centos" ]; then |
|
|
|
|
|
|
|
cat <<EOF >/etc/yum.conf.d/proxy.conf |
|
|
|
|
|
|
|
[main] |
|
|
|
|
|
|
|
proxy=http://${CACHER_IP}:3142 |
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$OS" == "debian" ]; then |
|
|
|
$STD apt-get update |
|
|
|
$STD apt-get update |
|
|
|
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade |
|
|
|
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade |
|
|
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED |
|
|
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED |
|
|
|
|
|
|
|
elif [ "$OS" == "centos" ]; then |
|
|
|
|
|
|
|
$STD yum clean all |
|
|
|
|
|
|
|
$STD yum -y update |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
msg_ok "Updated Container OS" |
|
|
|
msg_ok "Updated Container OS" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|