How to install nextcloud GUI client on Ubuntu using the PPA

The following script will install the nextcloud client and file manager integrations for all installed file managers. Run as root!

sudo add-apt-repository -y ppa:nextcloud-devs/client
sudo apt-get update
sudo apt -y install nextcloud-client

# Install Nautilus integration if nautilus is installed
dpkg --status nautilus > /dev/null 2>/dev/null
retVal=$?
if [ $retVal -eq 0 ]; then
    sudo apt -y install nautilus-nextcloud
fi

# Install Dolphin integration if nautilus is installed
dpkg --status dolphin > /dev/null 2>/dev/null
retVal=$?
if [ $retVal -eq 0 ]; then
    sudo apt -y install dolphin-nextcloud
fi

# Install Caja integration if nautilus is installed
dpkg --status caja > /dev/null 2>/dev/null
retVal=$?
if [ $retVal -eq 0 ]; then
    sudo apt -y install caja-nextcloud
fi

# Install Nemo integration if nautilus is installed
dpkg --status nemo > /dev/null 2>/dev/null
retVal=$?
if [ $retVal -eq 0 ]; then
    sudo apt -y install nemo-nextcloud
fi