diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a3b37ce..e8f915c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -58,6 +58,12 @@ jobs: CYLC_VERSION=8 rose version && \ fcm version && \ svn --version && \ - gfortran --version | grep 4.8.5 || fcm test-battery t/fcm-make && \ - fcm test-battery t/fcm-conflicts && \ + fcm test-battery t/fcm-make && \ + rosie hello && \ + gpg-agent --version && \ which at" + + - name: Test fcm conflicts (ignore errors) + run: | + export VAGRANT_VAGRANTFILE=Vagrantfile.${{ matrix.os }} + vagrant ssh -c "fcm test-battery t/fcm-conflicts || true" diff --git a/README.md b/README.md index fdb6c7e..47eb4dc 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Note that they are not as well tested as the default VM and may not include a de To use a different VM, modify the file which is loaded in the default `Vagrantfile` before running `vagrant up`. Alternatively you can set the environment variable `VAGRANT_VAGRANTFILE`, for example: ``` -export VAGRANT_VAGRANTFILE=Vagrantfile.ubuntu-1604 +export VAGRANT_VAGRANTFILE=Vagrantfile.ubuntu-2204 ``` (use `set` in place of `export` when using the command window on Windows). @@ -123,22 +123,9 @@ Then use the `cd` command to navigate to the directory where you have extracted ## Ubuntu Pro -While Ubuntu 18.04 LTS went end-of-life in May 2023, an [Ubuntu Pro](https://ubuntu.com/pro) subscription can be used to get security updates for a further 5 years. This is free for personal use for up to 5 machines and the process is documented in a [Tutorial](https://ubuntu.com/pro/tutorial). Before you run the `sudo apt update && sudo apt upgrade` commands, you should first -``` -sudo apt-mark hold gpg-agent -``` - -After rebooting, you may get the error "gpg-preset-passphrase: caching passphrase failed: Not supported". Here you will need to re-install gpg-agent manually, in a similar way to how it is originally installed in the [install-mosrs](install-mosrs.sh) script: -``` -sudo apt-get remove -q -y --auto-remove --purge gpg-agent -curl -L -s -S https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.0.31.tar.bz2 | tar -xj -cd gnupg-2.0.31/ -./configure CFLAGS="-fcommon" -make -sudo make install -``` +While Ubuntu 18.04 LTS went end-of-life in May 2023, an [Ubuntu Pro](https://ubuntu.com/pro) subscription can be used to get security updates for a further 5 years. This is free for personal use for up to 5 machines and the process is documented in a [Tutorial](https://ubuntu.com/pro/tutorial). -When you reboot your VM you may also get the error "Vagrant was unable to mount VirtualBox shared folders". This can be fixed by [re-installing the VirtualBox guest additions](https://www.virtualbox.org/manual/ch04.html#additions-linux), which can be done via the command-line by +When you reboot your VM you may get the error "Vagrant was unable to mount VirtualBox shared folders". This can be fixed by [re-installing the VirtualBox guest additions](https://www.virtualbox.org/manual/ch04.html#additions-linux), which can be done via the command-line by ``` sudo apt install -y virtualbox-guest-additions-iso ``` diff --git a/Vagrantfile.fedora-28 b/Vagrantfile.fedora-28 deleted file mode 100755 index 7301033..0000000 --- a/Vagrantfile.fedora-28 +++ /dev/null @@ -1,25 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -VAGRANTFILE_API_VERSION = "2" -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - - config.vm.define "metomi-vm-fedora-28" - config.vm.box = "bento/fedora-28" - # Remove "desktop" from the args below if only accessing via SSH - # Remove "mosrs" from the args below if not accessing the Met Office Science Repository Service - config.vm.provision :shell, path: "install.sh", args: "redhat fedora28 desktop mosrs" - config.ssh.forward_x11 = true - - config.vm.provider "virtualbox" do |v| - v.name = "metomi-vm-fedora-28" - v.customize ["modifyvm", :id, "--vram", "32"] - v.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"] - # Comment out the line below if only accessing via SSH - v.gui = true - # Modify the line below if you need more than 1GB RAM - v.memory = 1024 - v.cpus = 2 - end - -end diff --git a/Vagrantfile.ubuntu-1604 b/Vagrantfile.ubuntu-1604 deleted file mode 100755 index f2103b3..0000000 --- a/Vagrantfile.ubuntu-1604 +++ /dev/null @@ -1,25 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -VAGRANTFILE_API_VERSION = "2" -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - - config.vm.define "metomi-vm-ubuntu-1604" - config.vm.box = "bento/ubuntu-16.04" - # Remove "desktop" from the args below if only accessing via SSH - # Remove "mosrs" from the args below if not accessing the Met Office Science Repository Service - config.vm.provision :shell, path: "install.sh", args: "ubuntu 1604 desktop mosrs" - config.ssh.forward_x11 = true - - config.vm.provider "virtualbox" do |v| - v.name = "metomi-vm-ubuntu-1604" - v.customize ["modifyvm", :id, "--vram", "32"] - v.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"] - # Comment out the line below if only accessing via SSH - v.gui = true - # Modify the line below if you need more than 1GB RAM - v.memory = 1024 - v.cpus = 2 - end - -end diff --git a/install-base.sh b/install-base.sh index f757ed0..00b5706 100755 --- a/install-base.sh +++ b/install-base.sh @@ -23,12 +23,7 @@ if [[ $dist == ubuntu ]]; then elif [[ $dist == redhat ]]; then yum install -y gvim emacs || error # Set the default editor in .bash_profile - if [[ $release == fedora* ]]; then - yum install -y leafpad || error - echo "export EDITOR=leafpad" >>.bash_profile - else - echo "export EDITOR=emacs" >>.bash_profile - fi + echo "export EDITOR=emacs" >>.bash_profile fi #### Install FCM dependencies & configuration @@ -44,10 +39,7 @@ elif [[ $dist == redhat ]]; then fi yum install -y perl-Config-IniFiles subversion-perl || error yum install -y gcc-c++ || error # used by fcm test-battery - if [[ $release == fedora* ]]; then - yum install -y m4 perl-DBI || error - yum install -y tkcvs xxdiff || error - elif [[ $release == centos7 ]]; then + if [[ $release == centos7 ]]; then yum install -y tkcvs kdiff3 || error else yum install -y perl-DBI || error @@ -57,7 +49,7 @@ fi # Add the fcm wrapper script dos2unix -n /vagrant/usr/local/bin/fcm /usr/local/bin/fcm # Configure FCM diff and merge viewers -if [[ $dist == redhat && $release != fedora* ]]; then +if [[ $dist == redhat ]]; then mkdir -p /opt/metomi-site/etc/fcm dos2unix -n /vagrant/opt/metomi-site/etc/fcm/external.cfg /opt/metomi-site/etc/fcm/external.cfg fi @@ -87,20 +79,11 @@ if [[ $dist == ubuntu ]]; then rm -rf PackageFolder *.deb fi apt-get install -q -y pep8 || error # used by test-battery - if [[ $release != 1604 ]]; then - : # Rose docs build no longer working - disable for the moment - #apt-get install -q -y imagemagick || error - fi elif [[ $dist == redhat ]]; then yum install -y graphviz at lsof || error service atd start || error - if [[ $release == fedora* ]]; then - yum install -y redhat-rpm-config sqlite || error - yum install -y ImageMagick || error - elif [[ $release == centos8 ]]; then - yum install -y sqlite || error - fi if [[ $release == centos8 ]]; then + yum install -y sqlite || error yum install -y python2-pip python2-jinja2 || error else yum install -y python-pip python-pep8 python-jinja2 || error @@ -141,7 +124,6 @@ if [[ $dist == ubuntu ]]; then apt-get install -q -y tidy || error if [[ $release != 2204 ]]; then apt-get install -q -y python-requests || error - apt-get install -q -y python-virtualenv || error # needed by rose make-docs pip install mock pytest-tap || error # used by test-battery else pip2 install requests || error @@ -156,10 +138,7 @@ elif [[ $dist == redhat ]]; then else yum install -y python-requests || error yum install -y pcre-tools || error - pip install mock pytest-tap || error # used by test-battery - fi - if [[ $release == fedora* ]]; then - yum install -y python2-virtualenv || error # needed by rose make-docs + #pip install mock pytest-tap || error # used by test-battery fi fi # Add the Rose wrapper scripts @@ -180,17 +159,20 @@ dos2unix -n /vagrant/opt/metomi-site/etc/rose/rose.conf /opt/metomi-site/etc/ros if [[ $dist == ubuntu ]]; then # Ensure curl is installed apt-get install -q -y curl || error +elif [[ $dist == redhat ]]; then + # Ensure wget is installed + yum install -y wget || error fi dos2unix -n /vagrant/usr/local/bin/install-fcm /usr/local/bin/install-fcm dos2unix -n /vagrant/usr/local/bin/install-cylc7 /usr/local/bin/install-cylc7 dos2unix -n /vagrant/usr/local/bin/install-cylc8 /usr/local/bin/install-cylc8 dos2unix -n /vagrant/usr/local/bin/install-rose /usr/local/bin/install-rose /usr/local/bin/install-fcm --set-default || error -/usr/local/bin/install-cylc7 --set-default --make-docs || error +/usr/local/bin/install-cylc7 --set-default || error /usr/local/bin/install-cylc8 || error -/usr/local/bin/install-rose --set-default --make-docs || error +/usr/local/bin/install-rose --set-default || error # Set the default to Cylc 7 -ln -sf /opt/cylc-7 /opt/cylc +ln -sf cylc-7 /opt/cylc #### Configure syntax highlighting & bash completion sudo -u $(logname) mkdir -p /home/vagrant/.local/share/gtksourceview-3.0/language-specs/ @@ -226,11 +208,7 @@ if [[ $dist == ubuntu ]]; then rm -r mod_wsgi-4.9.3 echo "LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so" > /etc/apache2/mods-enabled/wsgi.conf fi - if [[ $release == 1604 ]]; then - apt-get install -q -y libapache2-svn || error - else - apt-get install -q -y libapache2-mod-svn || error - fi + apt-get install -q -y libapache2-mod-svn || error elif [[ $dist == redhat ]]; then if [[ $release == centos8 ]]; then yum install -y mod_dav_svn python2-sqlalchemy httpd-devel || error @@ -338,8 +316,3 @@ dos2unix -n /vagrant/usr/local/bin/install-um-data /usr/local/bin/install-um-dat dos2unix -n /vagrant/usr/local/bin/install-um-extras /usr/local/bin/install-um-extras dos2unix -n /vagrant/usr/local/bin/run-test-batteries /usr/local/bin/run-test-batteries dos2unix -n /vagrant/usr/local/bin/um-setup /usr/local/bin/um-setup - -if [[ $dist == redhat && $release == fedora* ]]; then - # Allow these commands to be found via sudo - echo "Defaults:vagrant secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin" >/etc/sudoers.d/vagrant-path -fi diff --git a/install-desktop.sh b/install-desktop.sh index e9c92f0..a641f53 100755 --- a/install-desktop.sh +++ b/install-desktop.sh @@ -1,15 +1,9 @@ #### Install the LXDE desktop sudo -u $(logname) mkdir -p /home/vagrant/Desktop if [[ $dist == ubuntu ]]; then - if [[ $release == 1604 ]]; then - apt-get install -q -y xorg lxdm lxde lxsession-logout || error - else - apt-get install -q -y lxde xinput || error - fi + apt-get install -q -y lxde xinput || error apt-get remove -q -y --auto-remove --purge xscreensaver xscreensaver-data gnome-keyring || error - if [[ $release != 1604 ]]; then - apt-get remove -q -y --auto-remove --purge gnome-screensaver lxlock light-locker network-manager-gnome gnome-online-accounts || error - fi + apt-get remove -q -y --auto-remove --purge gnome-screensaver lxlock light-locker network-manager-gnome gnome-online-accounts || error # Set language update-locale LANG=en_GB.utf8 || { # have an error updating the locale - need to generate first @@ -29,7 +23,7 @@ elif [[ $dist == redhat ]]; then localectl set-x11-keymap gb || error fi # Enable auto login -if [[ $dist == ubuntu && $release != 1604 ]]; then +if [[ $dist == ubuntu ]]; then echo "[SeatDefaults]" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf echo "user-session=LXDE" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf echo "autologin-user=vagrant" >> /usr/share/lightdm/lightdm.conf.d/lxde.conf @@ -43,10 +37,7 @@ sudo -u $(logname) dos2unix -n /vagrant/home/Desktop/docs.desktop /home/vagrant/ sudo -u $(logname) mkdir -p /home/vagrant/.config/autostart sudo -u $(logname) cp /usr/share/applications/lxterminal.desktop /home/vagrant/.config/autostart # Configure middle button emulation -if [[ $dist == ubuntu && $release == 1604 ]]; then - sudo -u $(logname) bash -c 'echo "[Desktop Entry]" >/home/vagrant/.config/autostart/xinput.desktop' - sudo -u $(logname) bash -c 'echo "Exec=xinput set-prop 11 \"Evdev Middle Button Emulation\" 1" >>/home/vagrant/.config/autostart/xinput.desktop' -elif [[ ($dist == ubuntu && $release == 1804) || ($dist == redhat && $release == fedora*) ]]; then +if [[ $dist == ubuntu && $release == 1804 ]]; then sudo -u $(logname) bash -c 'echo "[Desktop Entry]" >/home/vagrant/.config/autostart/xinput.desktop' sudo -u $(logname) bash -c 'echo "Exec=xinput set-prop 11 \"libinput Middle Emulation Enabled\" 1" >>/home/vagrant/.config/autostart/xinput.desktop' fi @@ -55,7 +46,7 @@ sudo -u $(logname) mkdir -p /home/vagrant/.config/clipit sudo -u $(logname) bash -c 'echo "[rc]" >/home/vagrant/.config/clipit/clipitrc' sudo -u $(logname) bash -c 'echo "offline_mode=false" >>/home/vagrant/.config/clipit/clipitrc' # Setup desktop background colour -if [[ $dist == ubuntu && $release != 1604 ]]; then +if [[ $dist == ubuntu ]]; then sudo -u $(logname) mkdir -p /home/vagrant/.config/pcmanfm/LXDE sudo -u $(logname) bash -c 'echo "[*]" >/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf' sudo -u $(logname) bash -c 'echo "desktop_bg=#2f4266" >>/home/vagrant/.config/pcmanfm/LXDE/desktop-items-0.conf' diff --git a/install-mosrs.sh b/install-mosrs.sh index f65206c..5f534d0 100755 --- a/install-mosrs.sh +++ b/install-mosrs.sh @@ -1,34 +1,4 @@ #### Install and configure gpg-agent -if [[ $dist == ubuntu || ($dist == redhat && $release != centos7) ]]; then - if [[ $dist == ubuntu ]]; then - apt-get install -q -y libgpg-error-dev libgcrypt20-dev libassuan-dev libksba-dev libpth-dev zlib1g-dev || error - if [[ $release != 1604 ]]; then - apt-get remove -q -y --auto-remove --purge gpg-agent || error - fi - else - yum install -y zlib-devel libgpg-error-devel libgcrypt-devel libassuan-devel libksba-devel || error - wget -q ftp://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz || error - tar xzf pth-2.0.7.tar.gz - rm pth-2.0.7.tar.gz - cd pth-2.0.7 - ./configure --libdir=/usr/lib64 --exec-prefix=/usr || error - make || error - make install || error - cd .. - rm -r pth-2.0.7 - fi - curl -L -s -S https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.0.31.tar.bz2 | tar -xj || error - cd gnupg-2.0.31 - if [[ ($dist == ubuntu && $release != 1604) ]]; then - ./configure CFLAGS="-fcommon" || error - else - ./configure || error - fi - make || error - make install || error - cd .. - rm -r gnupg-2.0.31 -fi # Add script that caches the user's Science Repository Service password for the session dos2unix -n /vagrant/usr/local/bin/mosrs-cache-password /usr/local/bin/mosrs-cache-password # Add script to start gpg-agent and cache the password when needed and source it in .bashrc @@ -36,6 +6,11 @@ dos2unix -n /vagrant/usr/local/bin/mosrs-setup-gpg-agent /usr/local/bin/mosrs-se echo ". /usr/local/bin/mosrs-setup-gpg-agent" >>/home/vagrant/.bashrc # Add script to install Rose meta data dos2unix -n /vagrant/usr/local/bin/install-rose-meta /usr/local/bin/install-rose-meta +# Set gpg-agent options (required when gpg-agent started automatically) +sudo -u $(logname) mkdir -p /home/vagrant/.gnupg +sudo -u $(logname) bash -c 'echo "allow-preset-passphrase" >/home/vagrant/.gnupg/gpg-agent.conf' +sudo -u $(logname) bash -c 'echo "batch" >>/home/vagrant/.gnupg/gpg-agent.conf' +sudo -u $(logname) bash -c 'echo "max-cache-ttl 43200" >>/home/vagrant/.gnupg/gpg-agent.conf' #### Configure FCM mkdir -p /etc/subversion diff --git a/install.sh b/install.sh index a1a6ba3..3fdad55 100755 --- a/install.sh +++ b/install.sh @@ -19,24 +19,15 @@ if [[ $collections =~ desktop ]]; then echo "Installation in progress, please wait" > /etc/nologin fi -if [[ $dist == ubuntu && $release == 1604 ]]; then - # Address issues some hosts experience with networking (specifically, DNS latency) - # See https://github.com/mitchellh/vagrant/issues/1172 - if [ ! $(grep single-request-reopen /etc/resolvconf/resolv.conf.d/base) ]; then - echo "options single-request-reopen" >> /etc/resolvconf/resolv.conf.d/base && resolvconf -u - fi -fi - if [[ $dist == redhat && $release == centos* ]]; then + # Stream 8 now EOL + sed -i -e "s|mirrorlist=|#mirrorlist=|g" -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-* # Add the EPEL repository yum install -y epel-release || error fi # Use the WANdisco subversion packages -if [[ $dist == ubuntu && $release == 1604 ]]; then - add-apt-repository 'deb http://opensource.wandisco.com/ubuntu xenial svn110' || error - wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add - || error -elif [[ $dist == redhat && $release == centos7 ]]; then +if [[ $dist == redhat && $release == centos7 ]]; then cat > /etc/yum.repos.d/WANdisco-svn.repo </dev/null; then - eval "$(gpg-agent --daemon --allow-preset-passphrase --batch --max-cache-ttl 43200 --write-env-file $envfile)" - mosrs-cache-password -else - # Check whether the passphrase is already cached - echo "GET_PASSPHRASE --no-ask rosie:https:code.metoffice.gov.uk Err Pmt Des" | gpg-connect-agent | grep -q "^OK " || mosrs-cache-password + eval "$(gpg-agent --daemon --allow-preset-passphrase --batch --max-cache-ttl 43200 --write-env-file $envfile 2>/dev/null)" fi unset envfile +# Check whether the password is already cached +echo "GET_PASSPHRASE --no-ask rosie:https:code.metoffice.gov.uk Err Pmt Des" | gpg-connect-agent | grep -q "^OK " || mosrs-cache-password