#!/bin/sh

# Setting up PPAs...

# Enable for geogebra
# Doing this here will enable geogebra.list, upgrade Debian stable geogebra to
# geogebra from geogebra.list at next apt upgrades to a broken state, and
# not install geogebra-classic. This is moved out to aims-install-geogebra
#echo " * Enabling GeoGebra repositories..."
#if [ -f /usr/share/aims/ppalists/geogebra.list ]; then
#    cp /usr/share/aims/ppalists/geogebra.list \
#       /etc/apt/sources.list.d/geogebra.list
#fi

# Enable for google-chrome
echo " * Enabling Google Chrome repositories..."
if [ -f /usr/share/aims/ppalists/google-chrome.list ]; then
    cp /usr/share/aims/ppalists/google-chrome.list \
       /etc/apt/sources.list.d/google-chrome.list
fi

# Enable for google-talkplugin
echo " * Enabling Google Talkplugin repositories..."
if [ -f /usr/share/aims/ppalists/google-talkplugin.list ]; then
    cp /usr/share/aims/ppalists/google-talkplugin.list \
       /etc/apt/sources.list.d/google-talkplugin.list
fi

# enable globalprotect-openconnect repositories
echo " * Enabling ppa:yuezk/globalprotect-openconnect"
if [ -f /usr/share/aims/ppalists/globalprotect-openconnect.list ]; then
    cp /usr/share/aims/ppalists/globalprotect-openconnect.list \
       /etc/apt/sources.list.d/globalprotect-openconnect.list
fi

# enable signal-desktop repositories
echo " * Enabling Signal repositories"
if [ -f /usr/share/aims/ppalists/signal-xenial.list ]; then
    cp /usr/share/aims/ppalists/signal-xenial.list \
       /etc/apt/sources.list.d/signal-xenial.list
fi

# enable skype repositories
echo " * Enabling Skype repositories"
if [ -f /usr/share/aims/ppalists/skype-stable.list ]; then
    cp /usr/share/aims/ppalists/skype-stable.list \
       /etc/apt/sources.list.d/skype-stable.list
fi

# enable virtualbox repositories
echo " * Enabling VirtualBox repositories"
if [ -f /usr/share/aims/ppalists/virtualbox.list ]; then
    cp /usr/share/aims/ppalists/virtualbox.list \
       /etc/apt/sources.list.d/virtualbox.list
fi

# enable non-free
echo " * Enabling contrib and non-free components of debian repositories"
if [ -f /usr/share/aims/ppalists/debian-nonfree.list ]; then
    cp /usr/share/aims/ppalists/debian-nonfree.list \
       /etc/apt/sources.list.d/debian-nonfree.list
fi
if [ -f /usr/share/aims/aptconf/99ignore-multiple-definitions ]; then
    cp /usr/share/aims/aptconf/99ignore-multiple-definitions \
       /etc/apt/apt.conf.d/99ignore-multiple-definitions
fi

# Update package lists
# i386 for skype
dpkg --add-architecture i386
echo " * Updating package indexes..."
apt-get -qq update

# Install software
apt-get -y install google-talkplugin globalprotect-openconnect #nautilus-dropbox signal-desktop skypeforlinux
aims-install-zoom
aims-install-teamviewer

# Post-install configuration
# Get rid of annoying nautilus-dropbox messages
#rm -f /var/lib/update-notifier/user.d/dropbox-*start-required

echo "That's it! All done."

