#!/bin/bash
# Thomas Dreibholz's Install Script for Xenial Xerus
# Copyright (C) 2007-2016 by Thomas Dreibholz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Contact: thomas.dreibholz@gmail.com


# ------ Keys for additional repositories -----------------------------------
if [ "$1" = "initial" ] ; then
   sudo apt-get update
   sudo apt-get install python-software-properties
   
   # Thomas Dreibholz's PPA
   sudo add-apt-repository -s -y ppa:dreibh/ppa         # Launchpad PPA of Thomas Dreibholz
   
   # Debug symbols key for ddebs.ubuntu.com: C8CAB6595FDFF622
   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622

   # KDE Neon key: E6D4736255751E5D
   # -- wget -qO - http://archive.neon.kde.org/public.key | sudo apt-key add -
   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E6D4736255751E5D

   # NOTE: The Kubuntu PPAs are *deprecated*! Need to use KDE Neon instead
   #       (added in sources.list!)
   # Kubuntu Updates: KDE point releases (see https://wiki.kubuntu.org/Kubuntu/KubuntuPPAs)
   # !!! sudo add-apt-repository -s -y ppa:kubuntu-ppa/ppa         # Launchpad PPA for Kubuntu Updates 
   # Kubuntu Backports: KDE major releases (see https://wiki.kubuntu.org/Kubuntu/KubuntuPPAs)
   # !!! sudo add-apt-repository -s -y ppa:kubuntu-ppa/backports   # Launchpad PPA for Kubuntu Backports

   # LibreOffice
   # !!! sudo add-apt-repository -s -y ppa:libreoffice/ppa         # Launchpad PPA for LibreOffice
fi

DESKTOP="kubuntu-desktop"
# kubuntu-desktop
# ubuntu-desktop

# ------ Tools --------------------------------------------------------------
PACKAGES="$PACKAGES acpi agrep apt-file apt-show-versions autofs chrpath cifs-utils cron-apt dict ding ethtool gpm ibritish ispell joe kcalc kgpg manpages-dev marble mathomatic minicom netperfmeter powertop reiserfsprogs sdparm smartmontools snmp snmp-mibs-downloader subnetcalc trans-de-en unrar"

# ------ Networking ---------------------------------------------------------
PACKAGES="$PACKAGES firefox firefox-locale-de httrack lksctp-tools miredo ncftp nmap nttcp openssh-server portmap rsplib-fgp-cfgfiles rsplib-services rsplib-tools sendxmpp spamassassin traceroute w3m whois wireshark konsole"
# akonadiconsole

# ------ Development, LaTeX, Firefox and many other tools -------------------
# Compiler and Tool-Chains
PACKAGES="$PACKAGES alien apt-file autoconf automake binutils-dev bison cdbs cmake colordiff colorgcc config-package-dev cvs doxygen eclipse f2c flex gcc gcc-doc gdb git-core intltool kdbg kdevelop kernel-package libtool mercurial python-ipaddr python-pip quilt rpm subversion unifdef valgrind xmlto"
# ??? wdg-html-validator
# Libraries
PACKAGES="$PACKAGES blt-dev geoip-bin geoip-database-contrib libadns1-dev libc-ares-dev libcpprspserver-dev libcurl4-gnutls-dev libfam0 libfam-dev libgeoip-dev libglib2.0-0-dbg libglib2.0-dev libglib2.0-doc libgtk2.0-dev liblua5.2-dev libmagick-dev libpango1.0-dev libpcap-dev libreadline-dev librsplib-dev libsctp-dev libsdl1.2-dev libsmi2-dev libsqlite0-dev xsltproc"
# Debian
PACKAGES="$PACKAGES debhelper devscripts dput dpatch dupload fakeroot lintian pbuilder ubuntu-dev-tools"
# Linux Kernel
PACKAGES="$PACKAGES linux-crashdump linux-doc linux-headers-generic linux-source"
# Qt/KDE Development
# PACKAGES="$PACKAGES automoc kdelibs5-dev libqt4-dbg libqt4-dev pkg-kde-tools qt4-demos qt4-designer qt4-dev-tools qt4-doc qt4-doc-html qt4-qtconfig"
# KDE Debugging
# PACKAGES="$PACKAGES kdepim-dbg kdepim-runtime-dbg kdepimlibs-dbg kdevplatform-dbg kdebase-runtime-dbg kde-runtime-dbg kdelibs5-dbg kdeplasma-addons-dbg pulseaudio-dbg"

# ------ Graphics Processing ------------------------------------------------
PACKAGES="$PACKAGES dia digikam ffmpeg2theora fractgen giftrans gimp gimp-data-extras gimp-help-de gimp-help-en gnuplot graphviz imagemagick inkscape r-base r-base-core r-base-dev r-base-html r-doc-html r-doc-info r-doc-pdf r-mathlib transfig xfig kdegraphics-thumbnailers"
# slideshow

# ------ LaTeX and Document Processing --------------------------------------
PACKAGES="$PACKAGES a2ps bibtexconv gv kile kile-doc kile-l10n latex-beamer libreoffice-l10n-en-gb libreoffice-lightproof-en myspell-en-gb lyx msttcorefonts pdftk pstoedit scribus texlive-full ttf-bitstream-vera ttf-dejavu"

# ------ Multimedia ---------------------------------------------------------
PACKAGES="$PACKAGES kaffeine kdenlive kubuntu-restricted-extras lame libdvdread4 libk3b6-extracodecs mp3blaster recordmydesktop vlc x264 gstreamer1.0-fluendo-mp3 liboil0.3 ffmpeg"

# ------ Localization -----------------------------------------------------------
# Deutsch:
PACKAGES="$PACKAGES language-pack-de language-pack-kde-de language-pack-gnome-de aspell-de manpages-de manpages-de-dev ingerman libreoffice-l10n-de libreoffice-help-de myspell-de-de myspell-de-at"
# Bokmål:
PACKAGES="$PACKAGES language-pack-nb language-pack-kde-nb language-pack-gnome-nb aspell-no myspell-nb libreoffice-l10n-nb"


# ------ Commercial Stuff ---------------------------------------------------
# PACKAGES="$PACKAGES flashplugin-installer"
# acroread skype libpulse0:i386 googleearth-package libfreeimage3 lsb-core ia32-libs-gtk

# Google Earth:
#  cd /tmp
#  make-googleearth-package
#  sudo dpkg -i ./googleearth_*.deb


# ------ Unwanted Stuff -----------------------------------------------------
# This software opens listening TCP/UDP sockets -> should only be installed if really needed ...
sudo apt-get remove minidlna webfs kdeconnect kdeconnect-plasma


# ---------------------------------------------------------------------------
sudo apt-get -q update && \
sudo apt-get -q dist-upgrade && \
sudo apt-get -q install $DESKTOP && \
sudo apt-get -q install $PACKAGES && \
sudo apt-get -q dist-upgrade && \
sudo apt-get -q autoremove && \
sudo apt-file update
