jammy
Ubuntu 22.04 preparation.
This commit is contained in:
parent
5d875971a5
commit
d97f422872
6 changed files with 58 additions and 36 deletions
13
lib/general
13
lib/general
|
@ -4,12 +4,12 @@
|
|||
# Prevent 'tput' errors when running from Cron
|
||||
[[ -z $TERM || $TERM == "unknown" || $TERM == "dumb" ]] && export TERM=dumb
|
||||
|
||||
readonly app_version="1.16.4"
|
||||
readonly app_version="1.16.5"
|
||||
readonly svr_version="1.7"
|
||||
readonly os_ubuntu_supported=(bionic focal)
|
||||
readonly php_supported=(7.4 8.0 8.1)
|
||||
readonly os_ubuntu_supported=(bionic focal) # https://ubuntu.com/about/release-cycle
|
||||
readonly php_supported=(7.4 8.0 8.1) # https://www.php.net/supported-versions.php
|
||||
readonly php_default="8.0"
|
||||
readonly mysql_supported=(10.4 10.5 10.6)
|
||||
readonly mysql_supported=(10.4 10.5 10.6) # https://mariadb.com/kb/en/mariadb-server-release-dates/
|
||||
readonly mysql_default="10.6"
|
||||
readonly datadog_agent_ver="7"
|
||||
readonly tools_port_default="22222"
|
||||
|
@ -26,9 +26,8 @@ readonly dim=`tput dim`
|
|||
# Check for BASH Shell
|
||||
# This is a very "shity" method, but checking if file exists is very reliable
|
||||
# If modified: this same script is in installer, general lib and verify
|
||||
shell_tty=$(echo $(tty) | grep -Eo "pts/[0-9]+")
|
||||
if [[ -n $shell_tty ]]; then
|
||||
shell_pid=$(ps -au | grep -E "${shell_tty}[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
if [[ -n $(echo $(tty) | grep -Eo "pts/[0-9]+") && -n $(logname) ]]; then
|
||||
shell_pid=$(ps -au | grep -E "^$(logname).*pts/[0-9]+[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
[[ -n $shell_pid && -f /proc/$shell_pid/cmdline ]] && shell_current=$(tr -d '\000' < /proc/$shell_pid/cmdline)
|
||||
[[ -n $shell_pid && -f /proc/$shell_pid/status ]] && shell_status=$(grep -Eo '^Name:.*bash.*' /proc/$shell_pid/status) # Double check!!!
|
||||
|
||||
|
|
11
lib/install
11
lib/install
|
@ -530,7 +530,8 @@ nginx_tool_bkp() {
|
|||
# Backend for S3
|
||||
sudo apt -y install python3-boto3
|
||||
# Duplicity installation directly from source
|
||||
sudo pip3 install duplicity
|
||||
# Temporal fix to remove warning - wait for: https://github.com/pypa/pip/issues/10556 - remove from stack purge too!
|
||||
sudo pip3 install duplicity 2>&1 | grep -v "pip as the 'root' user"
|
||||
|
||||
# Temporal dynvar - in the next stack update we will update all the old snap installations
|
||||
# Be sure to remove it from "stack" command too.
|
||||
|
@ -822,9 +823,9 @@ stack_builder() {
|
|||
if [[ $1 == "nginx" && $(conf_read nginx) != "true" ]]; then
|
||||
sudo apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key'
|
||||
if [[ $(conf_read nginx-ppa) == "mainline" ]]; then
|
||||
sudo add-apt-repository "deb https://nginx.org/packages/mainline/ubuntu/ $(check_osname) nginx"
|
||||
echo | sudo add-apt-repository "deb https://nginx.org/packages/mainline/ubuntu/ $(check_osname) nginx"
|
||||
else
|
||||
sudo add-apt-repository "deb https://nginx.org/packages/ubuntu/ $(check_osname) nginx"
|
||||
echo | sudo add-apt-repository "deb https://nginx.org/packages/ubuntu/ $(check_osname) nginx"
|
||||
fi
|
||||
local code="run"
|
||||
elif [[ $1 == "nginx" ]]; then
|
||||
|
@ -851,9 +852,9 @@ stack_builder() {
|
|||
if [[ $3 =~ ^(mysql|mysql-client)$ && $(conf_read mysql-client) != "true" ]]; then
|
||||
[[ -n $(conf_read mysql-ver) && $(check_mysql_version $(conf_read mysql-ver)) == "true" ]] || conf_write mysql-ver $mysql_default
|
||||
|
||||
# https://downloads.mariadb.org/mariadb/repositories/
|
||||
# https://mariadb.org/download/?t=repo-config
|
||||
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
|
||||
sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/$(conf_read mysql-ver)/ubuntu $(check_osname) main"
|
||||
echo | sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirrors.syringanetworks.net/mariadb/repo/$(conf_read mysql-ver)/ubuntu $(check_osname) main"
|
||||
local code="run"
|
||||
elif [[ $3 == "mysql-client" && $(conf_read mysql-client) == "true" ]]; then
|
||||
echo "${dim}MySQL Client is already installed!${end}"
|
||||
|
|
50
lib/verify
50
lib/verify
|
@ -273,13 +273,22 @@ if [[ $(conf_read nginx) == "true" ]]; then
|
|||
echo "- [ERROR] File: /etc/nginx/nginx.conf not found!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/trusted.gpg || -z $(grep -Fi "nginx signing key" /etc/apt/trusted.gpg) ]]; then
|
||||
|
||||
|
||||
if [[ ! -f /etc/apt/trusted.gpg || -z $(grep -Foia "nginx signing key" /etc/apt/trusted.gpg) ]]; then
|
||||
echo "- [ERROR] Nginx Apt Key not found!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list || -z $(grep -Fo "nginx.org/packages/" /etc/apt/sources.list) ]]; then
|
||||
echo "- [ERROR] Nginx PPA not found in sources list!"
|
||||
local ver_two_err="1"
|
||||
if [[ $(lsb_release -c | cut -d':' -f 2 | xargs) =~ ^(bionic|focal)$ ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list || -z $(grep -Fo "nginx.org/packages/" /etc/apt/sources.list) ]]; then
|
||||
echo "- [ERROR] Nginx PPA not found in sources list!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
else
|
||||
if [[ ! -f /etc/apt/sources.list.d/archive_uri-https_nginx_org_packages_ubuntu_-jammy.list || -z $(grep -Fo "nginx.org/packages/" /etc/apt/sources.list.d/archive_uri-https_nginx_org_packages_ubuntu_-jammy.list) ]]; then
|
||||
echo "- [ERROR] Nginx PPA not found in sources list!"
|
||||
local ver_two_err="1"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -455,7 +464,8 @@ if [[ $(conf_read php) == "true" ]]; then
|
|||
echo "- [ERROR] File: /etc/php/$(conf_read php-ver)/fpm/php.ini not found!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg || ! -s /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg ]]; then
|
||||
# First check is used before 22.04
|
||||
if [[ ( ! -f /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg || ! -s /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg ) && ( ! -f /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg || ! -s /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg ) ]]; then
|
||||
echo "- [ERROR] PHP Apt Key not found!"
|
||||
local ver_three_err="1"
|
||||
fi
|
||||
|
@ -570,18 +580,28 @@ local ver_four_war="0"
|
|||
|
||||
# MySQL
|
||||
if [[ $(conf_read mysql) == "true" ]]; then
|
||||
# To check supported versions: https://mariadb.com/kb/en/mariadb-server/
|
||||
local ver_mysql_ver=$(sudo mysql --version | sed 's/.*Distrib \([^\-]*\).*/\1/' | cut -f 1-2 -d'.')
|
||||
|
||||
if [[ ! -d /etc/mysql ]]; then
|
||||
echo "- [ERROR] Folder: /etc/mysql not found!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/trusted.gpg || -z $(grep -Fi "mariadb signing key" /etc/apt/trusted.gpg) ]]; then
|
||||
if [[ ! -f /etc/apt/trusted.gpg || -z $(grep -Foia "mariadb signing key" /etc/apt/trusted.gpg) ]]; then
|
||||
echo "- [ERROR] MariaDB Apt Key not found!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/sources.list || -z $(grep -Fo "mirrors.syringanetworks.net/mariadb/repo" /etc/apt/sources.list) ]]; then
|
||||
if [[ $(lsb_release -c | cut -d':' -f 2 | xargs) =~ ^(bionic|focal)$ ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list || -z $(grep -Fo "mirrors.syringanetworks.net/mariadb/repo" /etc/apt/sources.list) ]]; then
|
||||
echo "- [ERROR] MariaDB PPA not found in sources list!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
else
|
||||
if [[ ! -f /etc/apt/sources.list.d/archive_uri-http_mirrors_syringanetworks_net_mariadb_repo_$(echo $ver_mysql_ver | sed 's/\./_/')_ubuntu-jammy.list || -z $(grep -Fo "mirrors.syringanetworks.net/mariadb/repo" /etc/apt/sources.list.d/archive_uri-http_mirrors_syringanetworks_net_mariadb_repo_$(echo $ver_mysql_ver | sed 's/\./_/')_ubuntu-jammy.list) ]]; then
|
||||
echo "- [ERROR] MariaDB PPA not found in sources list!"
|
||||
local ver_four_err="1"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# MySQL Connection
|
||||
|
@ -604,10 +624,7 @@ fi
|
|||
|
||||
if [[ -z $critical_mode ]]; then
|
||||
# Check for MySQL version
|
||||
if [[ $(conf_read mysql) == "true" ]]; then
|
||||
# To check supported versions: https://mariadb.com/kb/en/mariadb-server/
|
||||
local ver_mysql_ver=$(sudo mysql --version | sed 's/.*Distrib \([^\-]*\).*/\1/' | cut -f 1-2 -d'.')
|
||||
|
||||
if [[ $(conf_read mysql) == "true" ]]; then
|
||||
if [[ $(conf_read mysql-ver) != $ver_mysql_ver ]]; then
|
||||
echo "${dim}- [WARNING] MariaDB (MySQL) Version corrupted in Configuration file! (Installed: $ver_mysql_ver != Conf: $(conf_read mysql-ver)) ${end}${red}"
|
||||
local ver_four_war="1"
|
||||
|
@ -734,7 +751,9 @@ elif [[ $(check_ubuntu_release) != "true" ]]; then
|
|||
echo "- [ERROR] This Ubuntu version is not supported!"
|
||||
local ver_six_err="1"
|
||||
elif [[ $(lsb_release -c | cut -d':' -f 2 | xargs) == "bionic" ]]; then
|
||||
echo "${blu}${dim}- [INFO] You should start considering moving to Ubuntu 20.04 ${end}${red}"
|
||||
#echo "${blu}${dim}- [INFO] You should start considering moving to Ubuntu 20.04 ${end}${red}"
|
||||
echo "${dim}- [WARNING] Support for Ubuntu 18.04 will be removed very soon! ${end}${red}"
|
||||
local ver_six_war="1"
|
||||
fi
|
||||
# Double-Check for sudo/root privileges
|
||||
if [[ $(whoami) != "root" ]]; then
|
||||
|
@ -753,9 +772,8 @@ if [[ -z $critical_mode ]]; then
|
|||
# Check for BASH Shell
|
||||
# This is a very "shity" method, but checking if file exists is very reliable
|
||||
# If modified: this same script is in installer, general lib and verify
|
||||
local ver_shell_tty=$(echo $(tty) | grep -Eo "pts/[0-9]+")
|
||||
if [[ -n $ver_shell_tty ]]; then
|
||||
local ver_shell_pid=$(ps -au | grep -E "${ver_shell_tty}+[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
if [[ -n $(echo $(tty) | grep -Eo "pts/[0-9]+") && -n $(logname) ]]; then
|
||||
local ver_shell_pid=$(ps -au | grep -E "^$(logname).*pts/[0-9]+[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
[[ -n $ver_shell_pid && -f /proc/$ver_shell_pid/cmdline ]] && local ver_shell_current=$(tr -d '\000' < /proc/$ver_shell_pid/cmdline)
|
||||
[[ -n $ver_shell_pid && -f /proc/$ver_shell_pid/status ]] && ver_shell_status=$(grep -Eo '^Name:.*bash.*' /proc/$ver_shell_pid/status) # Double check!!!
|
||||
|
||||
|
@ -809,7 +827,7 @@ if [[ $(conf_read php-tool-redis) == "true" ]]; then
|
|||
echo "- [ERROR] Folder: /etc/redis not found!"
|
||||
local ver_seven_err="1"
|
||||
fi
|
||||
if [[ ! -f /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg ]]; then
|
||||
if [[ ( ! -f /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs_ubuntu_redis.gpg ) && ( ! -f /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg || ! -s /etc/apt/trusted.gpg.d/redislabs-ubuntu-redis.gpg ) ]]; then
|
||||
echo "- [ERROR] Redis Apt Key not found!"
|
||||
local ver_seven_err="1"
|
||||
fi
|
||||
|
|
|
@ -42,7 +42,8 @@ kernel.dmesg_restrict = 1
|
|||
kernel.kptr_restrict = 1
|
||||
|
||||
# Sets the time before the kernel considers migrating a proccess to another core
|
||||
kernel.sched_migration_cost_ns = 5000000
|
||||
# This variable is no longer in sysctl, moved to: /sys/kernel/debug/sched/migration_cost_ns
|
||||
#kernel.sched_migration_cost_ns = 5000000
|
||||
|
||||
# Group tasks by TTY
|
||||
kernel.sched_autogroup_enabled = 0
|
||||
|
|
12
usr/stack
12
usr/stack
|
@ -24,7 +24,7 @@ fi
|
|||
purge_mysql_client() {
|
||||
local mysqlver=$(conf_read mysql-ver)
|
||||
sudo apt -y purge mariadb-client
|
||||
sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
|
||||
echo | sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
|
||||
sudo apt-key del 0xF1656F24C74CD1D8
|
||||
conf_write mysql-client purged
|
||||
}
|
||||
|
@ -82,7 +82,11 @@ if [[ -n $purge && ( -n $html || -n $nginx ) ]]; then
|
|||
sudo systemctl stop nginx
|
||||
sudo apt -y purge nginx nginx-common # Common package is no longer installed, but we purge it in case of old stacks built before 1.14.0.
|
||||
|
||||
[[ $(conf_read nginx-ppa) == "mainline" ]] && sudo add-apt-repository --remove "deb https://nginx.org/packages/mainline/ubuntu/ $(check_osname) nginx" || sudo add-apt-repository --remove "deb https://nginx.org/packages/ubuntu/ $(check_osname) nginx"
|
||||
if [[ $(conf_read nginx-ppa) == "mainline" ]]; then
|
||||
echo | sudo add-apt-repository --remove "deb https://nginx.org/packages/mainline/ubuntu/ $(check_osname) nginx"
|
||||
else
|
||||
echo | sudo add-apt-repository --remove "deb https://nginx.org/packages/ubuntu/ $(check_osname) nginx"
|
||||
fi
|
||||
sudo apt-key del 7BD9BF62
|
||||
|
||||
# Remove SSL Cron
|
||||
|
@ -221,7 +225,7 @@ elif [[ -n $purge && -n $mysql ]]; then
|
|||
# Purge is better, instead of remove even when keep-data is enabled, it prevents warnings during reinstallation.
|
||||
sudo apt -y purge mariadb-server mariadb-common mysql-common
|
||||
purge_mysql_client
|
||||
sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
|
||||
echo | sudo add-apt-repository --remove "http://mirrors.syringanetworks.net/mariadb/repo/${mysqlver}/ubuntu"
|
||||
purge_autoremove="true"
|
||||
|
||||
if [[ $mysql != "keep-data" ]]; then
|
||||
|
@ -308,7 +312,7 @@ elif [[ -n $purge && -n $backups ]]; then
|
|||
echo "${gre}${dim}Backup (duply) profiles deleted!${end}"
|
||||
fi
|
||||
|
||||
[[ -z $(conf_read bkp-source-tmp) ]] && sudo snap remove duplicity || sudo pip3 uninstall -y duplicity
|
||||
[[ -z $(conf_read bkp-source-tmp) ]] && sudo snap remove duplicity || sudo pip3 uninstall -y duplicity 2>&1 | grep -v "pip as the 'root' user"
|
||||
sudo apt -y purge python3-boto3
|
||||
sudo rm -rf /usr/bin/duply
|
||||
|
||||
|
|
5
weby
5
weby
|
@ -16,9 +16,8 @@ fi
|
|||
# Check for BASH Shell
|
||||
# This is a very "shity" method, but checking if file exists is very reliable
|
||||
# If modified: this same script is in installer, general lib and verify
|
||||
ins_shell_tty=$(echo $(tty) | grep -Eo "pts/[0-9]+")
|
||||
if [[ -n $ins_shell_tty ]]; then
|
||||
ins_shell_pid=$(ps -au | grep -E "${ins_shell_tty}[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
if [[ -n $(echo $(tty) | grep -Eo "pts/[0-9]+") && -n $(logname) ]]; then
|
||||
ins_shell_pid=$(ps -au | grep -E "^$(logname).*pts/[0-9]+[ ]+S[s]?[ ]+" | tail -n 1 | awk '{print $2}')
|
||||
[[ -n $ins_shell_pid && -f /proc/$ins_shell_pid/cmdline ]] && ins_shell_current=$(tr -d '\000' < /proc/$ins_shell_pid/cmdline)
|
||||
[[ -n $ins_shell_pid && -f /proc/$ins_shell_pid/status ]] && ins_shell_status=$(grep -Eo '^Name:.*bash.*' /proc/$ins_shell_pid/status) # Double check!!!
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue