Permalink
Browse files

Revise installation scripts by creating a common include, changing th…

…e names, and having install.sh create a symlink called tactus-navigator for easier starting.
  • Loading branch information...
1 parent 0798058 commit f68bba9b9966734d234cc129a0cea7214acdf228 @rpavlik committed May 11, 2009
Showing with 135 additions and 0 deletions.
  1. +54 −0 globals.inc
  2. +49 −0 install.sh
  3. +32 −0 prepare_dev_environment.sh
View
@@ -0,0 +1,54 @@
+# Ryan Pavlik <ryan.pavlik@snc.edu> 2009
+
+# Globals for shell scripts
+
+is_installed ()
+{
+ if [ "$APT" != "" ]; then
+ echo $(dpkg -s $1 | grep -o "install ok")
+ else
+ echo
+ fi
+}
+
+package_install ()
+{
+ if [ "$APT" != "" ]; then
+ # OK, we can try to install somehow
+ if [ "$UBUNTU" != "yes" ]; then
+ echo "NOTE: You're not on Ubuntu - make sure the equivalent of these are installed:"
+ echo "$@"
+ echo "Trying to install them..."
+ fi
+ $APT $@
+ else
+ echo "ERROR: You're not using a Debian/Ubuntu derivative - install these yourself:"
+ echo "$@"
+ fi
+}
+
+# Attempt to find package install tool in Ubuntu, Debian, and similar
+APT=""
+if [ "$(which aptitude)" != "" ]; then
+ APT="sudo aptitude -y -q --with-recommends install"
+else
+ if [ "$(which apt-get)" != "" ]; then
+ APT="sudo apt-get -y -qq install"
+ fi
+fi
+
+# For the sake of warnings, find out if we're on ubuntu.
+UBUNTU=""
+if [ "$(lsb_release -i -s)" = "Ubuntu" ]; then
+ UBUNTU=yes
+ UBUNTUVER="$(lsb_release -r -s)"
+ DISTCODENAME="$(lsb_release -c -s)"
+else
+ if [ "$(lsb_release -i -s)" = "Debian" ]; then
+ UBUNTU=Debian
+ DISTCODENAME="$(lsb_release -c -s)"
+ fi
+fi
+
+# Make sure we return a 0 errval if all succeeded.
+echo
View
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+THISSCRIPT="install.sh"
+# Ryan Pavlik <ryan.pavlik@snc.edu> 2009
+
+# Ensures that dependencies are installed, and creates the startup symlink.
+
+source globals.inc
+
+if [ $? -ne 0 ]; then
+ echo "Whoops - you have to run this from within its directory."
+ exit 1
+fi
+
+echo "Attempting to install dependencies for tactus-navigator..."
+package_install python-gnome2-desktop python-gtk2
+
+if [ "$(is_installed pymt)" != "" ]; then
+ echo
+ echo "pymt package detected to be installed - hopefully it is recent enough."
+ echo
+else
+ echo
+ echo "You don't seem to have the pymt package installed systemwide..."
+ echo "If you see 'No module named pymt' below, it's not installed at all"
+ echo "and you need to install it yourself one way or another!"
+ echo "I recommend the rp-mt-scripts to help you install it cleanly!"
+ echo "http://github.com/rpavlik/rp-mt-scripts/"
+ echo
+ python -c "import pymt"
+ echo
+fi
+
+pushd . &> /dev/null
+cd py/
+python -c "import mainpymt"
+RV=$?
+popd &>/dev/null
+
+if [ $RV -ne 0 ]; then
+ echo "Hmm, there was an error above, you're still missing some Python packages."
+ echo "Please report the message in that case, so this script can be updated."
+else
+ echo "Import test succeeded, creating startup symlink..."
+ ln -s py/mainpymt.py tactus-navigator
+ echo
+ echo "You may now run ./tactus-navigator (or cd py/, ./mainpymt.py) to start!"
+fi
+
View
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+THISSCRIPT="prepare_dev_environment.sh"
+# Ryan Pavlik <ryan.pavlik@snc.edu> 2009
+
+# Ensures that dependencies are installed - these are only needed for development.
+source globals.inc
+
+if [ $? -ne 0 ]; then
+ echo "Whoops - you have to run this from within its directory."
+ exit 1
+fi
+
+echo "Installing development dependencies for tactus-navigator..."
+package_install glade-gnome-3 drpython git-core giggle
+
+if [ "$(is_installed pymt)" != "" ]; then
+ echo
+ echo "pymt package detected to be installed - hopefully it is recent enough."
+ echo
+else
+ echo
+ echo "You don't seem to have the pymt package installed systemwide..."
+ echo "If you see 'No module named pymt' below, it's not installed at all"
+ echo "and you need to install it yourself one way or another!"
+ echo "I recommend the rp-mt-scripts to help you install it cleanly!"
+ echo "http://github.com/rpavlik/rp-mt-scripts/"
+ echo
+ python -c "import pymt"
+ echo
+fi
+

0 comments on commit f68bba9

Please sign in to comment.