From 6fc75796a3b59ad937e19d4e4f0f29ca0abb0e23 Mon Sep 17 00:00:00 2001 From: Jason Hee Date: Mon, 18 Apr 2022 04:57:03 +0800 Subject: [PATCH] Add support for 22.04 (#16) * Add Vagrantfile for Jammy * Fix configuration of NTP for Jammy * Update setup text to be more accurate * Update README --- README.md | 2 +- setup.sh | 2 +- setupLibrary.sh | 2 +- tests/Vagrant/Vagrantfile.jammy64 | 6 ++++++ tests/unit-tests.sh | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 tests/Vagrant/Vagrantfile.jammy64 diff --git a/README.md b/README.md index 8744ecb..29ad207 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ cat ~/.ssh/user_server_ed25519.pub Finally, you will be prompted to specify a [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the server. It will be set to 'Asia/Singapore' if you do not specify a value. # Supported versions -This setup script has been tested against Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04 and Ubuntu 20.04. +This setup script has been tested against Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04 and Ubuntu 22.04. # Running tests Tests are run against a set of Vagrant VMs. To run the tests, run the following in the project's directory: diff --git a/setup.sh b/setup.sh index 7de83e5..9dc67d1 100644 --- a/setup.sh +++ b/setup.sh @@ -52,7 +52,7 @@ function main() { setupTimezone - echo "Installing Network Time Protocol... " >&3 + echo "Configuring System Time... " >&3 configureNTP sudo service ssh restart diff --git a/setupLibrary.sh b/setupLibrary.sh index 0216422..455d9a4 100644 --- a/setupLibrary.sh +++ b/setupLibrary.sh @@ -125,7 +125,7 @@ function setTimezone() { function configureNTP() { ubuntu_version="$(lsb_release -sr)" - if [[ $ubuntu_version == '20.04' ]]; then + if [[ $(bc -l <<< "${ubuntu_version} >= 20.04") -eq 1 ]]; then sudo systemctl restart systemd-timesyncd else sudo apt-get update diff --git a/tests/Vagrant/Vagrantfile.jammy64 b/tests/Vagrant/Vagrantfile.jammy64 new file mode 100644 index 0000000..629d7f7 --- /dev/null +++ b/tests/Vagrant/Vagrantfile.jammy64 @@ -0,0 +1,6 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "ubuntu/jammy64" +end diff --git a/tests/unit-tests.sh b/tests/unit-tests.sh index c4b0e50..2a28841 100644 --- a/tests/unit-tests.sh +++ b/tests/unit-tests.sh @@ -116,7 +116,7 @@ function testNTP() { configureNTP ubuntu_version="$(lsb_release -sr)" - if [[ $ubuntu_version == '18.04' || $ubuntu_version == '20.04' ]]; then + if [[ $(bc -l <<< "${ubuntu_version} >= 18.04") -eq 1 ]]; then sleep 2 assertContains "System clock synchronized: yes" "$(timedatectl status)" else