<commit_before>#!/bin/sh
# Copyright (c) 2009-2012 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL.
# 
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version.  This library 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 Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".

# About:
# =====
# This script will take a raw Xubuntu system and update it ready to run
# GISVM install scripts.

# Running:
# =======
# sudo ./setup.sh

echo "==============================================================="
echo "setup.sh"
echo "==============================================================="

if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"


if [ "`uname -m`" != "i686" ] ; then
   echo "WARNING: Current system is not i686; any binaries built may be tied to current system (`uname -m`)"
fi
# look for ./configure --build=BUILD, --host=HOST, --target=TARGET  to try and force build for i686.
# For .deb package building something like: 'debuild binary-arch i686' ???????

# don't install the kitchen sink
if [ ! -e /etc/apt/apt.conf.d/depends_only ] ; then
   cat << EOF > /etc/apt/apt.conf.d/depends_only
APT::Install-Recommends "false";
APT::Install-Suggests "false";
EOF
fi


# Install latest greatest security packages etc.
apt-get -q update && apt-get --yes upgrade

# Add UbuntuGIS repository
cp ../sources.list.d/ubuntugis.list /etc/apt/sources.list.d/

#Add signed key for repositorys LTS and non-LTS
#qgis repo 68436DDF unused? :
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68436DDF  
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160  
apt-get -q update


# Install some useful stuff
apt-get install --yes wget less zip unzip bzip2 p7zip \
  cvs cvsutils subversion subversion-tools mercurial git \
  openssh-client lftp sl usbutils wireless-tools \
  locate diff patch fuseiso menu \
  vim medit nedit nano screen iotop xfonts-jmk \
  okular ghostscript a2ps netpbm qiv \
  lynx mutt mc xchat rxvt units scrot \
  gdebi fslint filelight arandr sgt-puzzles xkb-data

# some xfce desktop widgets for i18n and laptops
apt-get install --yes xfce4-xkb-plugin xfce4-power-manager \
   xfce4-wavelan-plugin xfce4-battery-plugin


# Install build stuff (temporarily?)
apt-get install --yes gcc build-essential devscripts pbuilder fakeroot \
  svn-buildpackage lintian debhelper pkg-config dpkg-dev cmake


# add /usr/local/lib to /etc/ld.so.conf if needed, then run ldconfig
# FIXME: similar thing needed for man pages?
if [ -d /etc/ld.so.conf.d ] ; then
   echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf
else
   if [ `grep -c '/usr/local/lib' /etc/ld.so.conf` -eq 0 ] ; then
      echo "/usr/local/lib" >> /etc/ld.so.conf
   fi
fi
ldconfig


# so we can see why things fail to start..
sed -i -e 's/^VERBOSE=no/VERBOSE=yes/' /etc/default/rcS


# for list of packages taking up the most space install the debian-goodies
#    package to get `dpigs`. or try `wajig size`

# Uninstall large applications installed by default
apt-get remove --yes gnome-games-common \
   gimp gimp-data gimp-help-common gimp-help-en libgimp2.0 \
   libgegl-0.0.0 libbabl-0.0.0 libotr2 \
   thunderbird pidgin-data hplip hplip-data \
   gnome-user-guide xfwm4-themes libsane \
   libsane-common libsane-hpaio libieee1284-3 \
   libwebkitgtk-1.0-0 libwebkitgtk-1.0-common libjavascriptcoregtk-1.0.0

# sadly, uninstall samba as we need the disc space. priority for
#  re-adding if we can find the room  (~85mb uncompressed)
#apt-get --assume-yes remove smbclient samba-common-bin


# since GIMP is removed we have to replace an xUbuntu default icon
# software store and related bloat removed, use synaptic instead
sed -i -e 's+gimp\.desktop+xfce4-dict\.desktop+' \
       -e 's+ubuntu-software-center\.desktop+synaptic\.desktop+' \
   /etc/xdg/xdg-xubuntu/xfce4/panel/default.xml
sed -i -e 's+ubuntu-software-center\.desktop+synaptic\.desktop+' \
   /etc/xdg/xdg-xubuntu/menus/xfce-applications.menu

# remove xscreensaver as it tends to saturate VM bandwidth
apt-get --assume-yes remove xscreensaver

# pls add "why" here
apt-get remove --yes indicator-messages

#buggy in 12.04:
# but does it want to take the rest of the xubuntu desktop with it?
apt-get remove --yes blueman

# this will clear out 96mb (uncompressed), but users who want the
# nvidia proprietary driver will need to reinstall it. ah well.
#Version must be kept up to date (removes 3 packages)
apt-get --assume-yes remove linux-headers-generic
apt-get --assume-yes remove linux-headers-3.2.0-29
apt-get --assume-yes remove linux-headers-3.2.0-27
apt-get --assume-yes remove linux-headers-3.2.0-26
apt-get --assume-yes remove linux-headers-3.2.0-25
apt-get --assume-yes remove linux-headers-3.2.0-24
apt-get --assume-yes remove linux-headers-3.2.0-23
# removing -23 unblocks -29 and automatically installs it, so we do it again.. argh
apt-get --assume-yes remove linux-headers-3.2.0-29

# regen initrd<commit_msg>rm no longer needed commands<commit_after>#!/bin/sh
# Copyright (c) 2009-2012 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL.
# 
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version.  This library 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 Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".

# About:
# =====
# This script will take a raw Xubuntu system and update it ready to run
# GISVM install scripts.

# Running:
# =======
# sudo ./setup.sh

echo "==============================================================="
echo "setup.sh"
echo "==============================================================="

if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"


if [ "`uname -m`" != "i686" ] ; then
   echo "WARNING: Current system is not i686; any binaries built may be tied to current system (`uname -m`)"
fi
# look for ./configure --build=BUILD, --host=HOST, --target=TARGET  to try and force build for i686.
# For .deb package building something like: 'debuild binary-arch i686' ???????

# don't install the kitchen sink
if [ ! -e /etc/apt/apt.conf.d/depends_only ] ; then
   cat << EOF > /etc/apt/apt.conf.d/depends_only
APT::Install-Recommends "false";
APT::Install-Suggests "false";
EOF
fi


# Install latest greatest security packages etc.
apt-get -q update && apt-get --yes upgrade

# Add UbuntuGIS repository
cp ../sources.list.d/ubuntugis.list /etc/apt/sources.list.d/

#Add signed key for repositorys LTS and non-LTS
#qgis repo 68436DDF unused? :
#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68436DDF  
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160  
apt-get -q update


# Install some useful stuff
apt-get install --yes wget less zip unzip bzip2 p7zip \
  cvs cvsutils subversion subversion-tools mercurial git \
  openssh-client lftp sl usbutils wireless-tools \
  locate diff patch fuseiso menu \
  vim medit nedit nano screen iotop xfonts-jmk \
  okular ghostscript a2ps netpbm qiv \
  lynx mutt mc xchat rxvt units scrot \
  gdebi fslint filelight arandr sgt-puzzles xkb-data

# some xfce desktop widgets for i18n and laptops
apt-get install --yes xfce4-xkb-plugin xfce4-power-manager \
   xfce4-wavelan-plugin xfce4-battery-plugin


# Install build stuff (temporarily?)
apt-get install --yes gcc build-essential devscripts pbuilder fakeroot \
  svn-buildpackage lintian debhelper pkg-config dpkg-dev cmake


# add /usr/local/lib to /etc/ld.so.conf if needed, then run ldconfig
# FIXME: similar thing needed for man pages?
if [ -d /etc/ld.so.conf.d ] ; then
   echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local.conf
else
   if [ `grep -c '/usr/local/lib' /etc/ld.so.conf` -eq 0 ] ; then
      echo "/usr/local/lib" >> /etc/ld.so.conf
   fi
fi
ldconfig


# so we can see why things fail to start..
sed -i -e 's/^VERBOSE=no/VERBOSE=yes/' /etc/default/rcS


# for list of packages taking up the most space install the debian-goodies
#    package to get `dpigs`. or try `wajig size`

# Uninstall large applications installed by default
apt-get remove --yes gnome-games-common \
   gimp gimp-data gimp-help-common gimp-help-en libgimp2.0 \
   libgegl-0.0.0 libbabl-0.0.0 libotr2 \
   thunderbird pidgin-data hplip hplip-data \
   gnome-user-guide xfwm4-themes libsane \
   libsane-common libsane-hpaio libieee1284-3 \
   libwebkitgtk-1.0-0 libwebkitgtk-1.0-common libjavascriptcoregtk-1.0.0

# sadly, uninstall samba as we need the disc space. priority for
#  re-adding if we can find the room  (~85mb uncompressed)
#apt-get --assume-yes remove smbclient samba-common-bin


# since GIMP is removed we have to replace an xUbuntu default icon
# software store and related bloat removed, use synaptic instead
sed -i -e 's+gimp\.desktop+xfce4-dict\.desktop+' \
       -e 's+ubuntu-software-center\.desktop+synaptic\.desktop+' \
   /etc/xdg/xdg-xubuntu/xfce4/panel/default.xml
sed -i -e 's+ubuntu-software-center\.desktop+synaptic\.desktop+' \
   /etc/xdg/xdg-xubuntu/menus/xfce-applications.menu

# remove xscreensaver as it tends to saturate VM bandwidth
apt-get --assume-yes remove xscreensaver

# pls add "why" here
apt-get remove --yes indicator-messages

#buggy in 12.04:
# but does it want to take the rest of the xubuntu desktop with it?
apt-get remove --yes blueman

# this will clear out 96mb (uncompressed), but users who want the
# nvidia proprietary driver will need to reinstall it. ah well.
#Version must be kept up to date (removes 3 packages)
apt-get --assume-yes remove linux-headers-generic
apt-get --assume-yes remove linux-headers-3.2.0-29
# ...
apt-get --assume-yes remove linux-headers-3.2.0-23


# regen initrd
{'fraction_non_alphanumeric': 0.12933091533836022, 'fraction_numerical': 0.02033024720817028, 'mean_word_length': 3.589575120455541, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1140933', 'n_tokens_mistral': 3743, 'n_tokens_neox': 3453, 'n_words': 1201}