Skip to content

Commit

Permalink
Merge pull request #35 from dpmatthews/gpg-agent
Browse files Browse the repository at this point in the history
Support gpg-agent version >2.0 + remove Ubuntu 1604 & Fedora 28 support
  • Loading branch information
dpmatthews authored Jun 27, 2024
2 parents 07ab6c1 + 6cf343f commit 1b1f14b
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 176 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -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
```
Expand Down
25 changes: 0 additions & 25 deletions Vagrantfile.fedora-28

This file was deleted.

25 changes: 0 additions & 25 deletions Vagrantfile.ubuntu-1604

This file was deleted.

51 changes: 12 additions & 39 deletions install-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
19 changes: 5 additions & 14 deletions install-desktop.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand Down
35 changes: 5 additions & 30 deletions install-mosrs.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
#### 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
dos2unix -n /vagrant/usr/local/bin/mosrs-setup-gpg-agent /usr/local/bin/mosrs-setup-gpg-agent
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
Expand Down
15 changes: 3 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
[WANdisco-svn]
name=WANdisco SVN Repo
Expand Down
2 changes: 1 addition & 1 deletion opt/metomi-site/etc/httpd/rosie-wsgi.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WSGIPythonPath /opt/cylc/lib:/opt/rose/lib/python
WSGIPythonPath /opt/cylc/lib:/opt/rose/lib/python:/usr/local/lib/python2.7/dist-packages
WSGIScriptAlias /rosie /opt/rose/lib/python/rosie/ws.py
WSGIScriptAlias /cylc-review /opt/cylc/bin/cylc-review

Expand Down
2 changes: 1 addition & 1 deletion usr/local/bin/install-cylc7
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ fi
if $set_default; then
echo Setting the default Cylc 7 version to $CYLC_VERSION
rm -f /opt/cylc-7
ln -sf /opt/cylc-$CYLC_VERSION /opt/cylc-7
ln -sf cylc-$CYLC_VERSION /opt/cylc-7
fi
2 changes: 1 addition & 1 deletion usr/local/bin/install-fcm
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ fi
if $set_default; then
echo Setting the default FCM version to $FCM_VERSION
rm -f /opt/fcm
ln -sf /opt/fcm-$FCM_VERSION /opt/fcm
ln -sf fcm-$FCM_VERSION /opt/fcm
fi
3 changes: 2 additions & 1 deletion usr/local/bin/install-rose
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ fi
if $set_default; then
echo Setting the default Rose version to $ROSE_VERSION
rm -f /opt/rose
ln -sf /opt/rose-$ROSE_VERSION /opt/rose
ln -sf rose-$ROSE_VERSION /opt/rose
ln -sf rose-$ROSE_VERSION /opt/rose-2019.01
fi
Loading

0 comments on commit 1b1f14b

Please sign in to comment.