diff --git a/scripts/cloudron-setup b/scripts/cloudron-setup index 0d622dbeb..c52f19480 100755 --- a/scripts/cloudron-setup +++ b/scripts/cloudron-setup @@ -101,8 +101,8 @@ fi # Only --help works with mismatched ubuntu ubuntu_version=$(lsb_release -rs) -if [[ "${ubuntu_version}" != "16.04" && "${ubuntu_version}" != "18.04" && "${ubuntu_version}" != "20.04" ]]; then - echo "Cloudron requires Ubuntu 16.04, 18.04 or 20.04" > /dev/stderr +if [[ "${ubuntu_version}" != "16.04" && "${ubuntu_version}" != "18.04" && "${ubuntu_version}" != "20.04" && "${ubuntu_version}" != "22.04" ]]; then + echo "Cloudron requires Ubuntu 18.04, 20.04, 22.04" > /dev/stderr exit 1 fi diff --git a/scripts/init-ubuntu.sh b/scripts/init-ubuntu.sh index ec7caa922..84f79765b 100755 --- a/scripts/init-ubuntu.sh +++ b/scripts/init-ubuntu.sh @@ -18,6 +18,14 @@ export DEBIAN_FRONTEND=noninteractive readonly ubuntu_codename=$(lsb_release -cs) readonly ubuntu_version=$(lsb_release -rs) +# enable ubuntu proposed for collectd (https://launchpad.net/ubuntu/+source/collectd) +if [[ "${ubuntu_version}" == "22.04" ]]; then + cat </etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list +# Enable Ubuntu proposed archive +deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe +EOF +fi + # hold grub since updating it breaks on some VPS providers. also, dist-upgrade will trigger it apt-mark hold grub* >/dev/null apt-get -o Dpkg::Options::="--force-confdef" update -y @@ -31,10 +39,33 @@ debconf-set-selections <<< 'mysql-server mysql-server/root_password_again passwo # this enables automatic security upgrades (https://help.ubuntu.com/community/AutomaticSecurityUpdates) # resolvconf is needed for unbound to work property after disabling systemd-resolved in 18.04 +case "${ubuntu_version}" in +16.04) + gpg_package="gnupg" + mysql_package="mysql-server-5.7" + ntpd_package="" + python_package="python2.7" + ;; +18.04) + gpg_package="gpg" + mysql_package="mysql-server-5.7" + ntpd_package="" + python_package="python2.7" + ;; +20.04) + gpg_package="gpg" + mysql_package="mysql-server-8.0" + ntpd_package="systemd-timesyncd" + python_package="python3.8" + ;; +22.04) + gpg_package="gpg" + mysql_package="mysql-server-8.0" + ntpd_package="systemd-timesyncd" + python_package="python3.10" + ;; +esac -gpg_package=$([[ "${ubuntu_version}" == "16.04" ]] && echo "gnupg" || echo "gpg") -mysql_package=$([[ "${ubuntu_version}" == "20.04" ]] && echo "mysql-server-8.0" || echo "mysql-server-5.7") -ntpd_package=$([[ "${ubuntu_version}" == "20.04" ]] && echo "systemd-timesyncd" || echo "") apt-get -y install --no-install-recommends \ acl \ apparmor \ @@ -47,7 +78,7 @@ apt-get -y install --no-install-recommends \ $gpg_package \ ipset \ iptables \ - libpython2.7 \ + lib${python_package} \ linux-generic \ logrotate \ $mysql_package \ @@ -71,8 +102,7 @@ apt-get -o Dpkg::Options::="--force-confold" install -y --no-install-recommends # debconf-set-selection of unattended-upgrades/enable_auto_updates + dpkg-reconfigure does not work cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades -apt-get install -y --no-install-recommends python # Install python which is required for npm rebuild -[[ "$(python --version 2>&1)" == "Python 2.7."* ]] || die "Expecting python version to be 2.7.x" +apt-get install -y --no-install-recommends $python_package # Install python which is required for npm rebuild # do not upgrade grub because it might prompt user and break this script echo "==> Enable memory accounting" @@ -89,7 +119,11 @@ if ! apt-get install -y --no-install-recommends libcurl3-gnutls collectd collect sed -e 's/^FQDNLookup true/FQDNLookup false/' -i /etc/collectd/collectd.conf fi # https://bugs.launchpad.net/ubuntu/+source/collectd/+bug/1872281 -[[ "${ubuntu_version}" == "20.04" ]] && echo -e "\nLD_PRELOAD=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so" >> /etc/default/collectd +if [[ "${ubuntu_version}" == "20.04" ]]; then + echo -e "\nLD_PRELOAD=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so" >> /etc/default/collectd +elif [[ "${ubuntu_version}" == "22.04" ]]; then + echo -e "\nLD_PRELOAD=/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so" >> /etc/default/collectd +fi # some hosts like atlantic install ntp which conflicts with timedatectl. https://serverfault.com/questions/1024770/ubuntu-20-04-time-sync-problems-and-possibly-incorrect-status-information echo "==> Configuring host"