#!/usr/bin/env bash BLUE='\033[38;5;45m' PURPLE='\033[38;5;127m' GOLD='\033[38;5;178m' RED='\033[38;5;196m' NC='\033[0m' BFR='\r\033[K' catch_errors_lxc() { set -Eeuo pipefail trap 'echo "1" > /root/.install-${SESSION_ID:-unknown}.failed; exit 1' ERR } msg_info() { local msg="$1" echo -ne " ${BLUE}â„šī¸ ${msg}${NC}" } msg_ok() { local msg="$1" echo -e "${BFR} ${GOLD}✅ ${msg}${NC}" } msg_error() { local msg="$1" echo -e "${BFR} ${RED}❌ ${msg}${NC}" } set_std_mode() { if [[ "${VERBOSE:-no}" == "yes" ]]; then export STD="" else export STD="&>/dev/null" fi } update_os() { msg_info "Updating Container Core" if [[ "${PCT_OSTYPE}" == "alpine" ]]; then apk update $STD apk upgrade $STD else apt-get update $STD apt-get -y upgrade $STD fi msg_ok "Container Core Updated" } cleanup_lxc() { msg_info "Finalizing Stance" if [[ "${PCT_OSTYPE}" == "alpine" ]]; then apk cache clean $STD else apt-get -y autoremove $STD apt-get -y autoclean $STD fi rm -rf /tmp/* msg_ok "Stance Manifested" } catch_errors_lxc