Skip to content
Snippets Groups Projects
get-peasoup-packages.sh 3.07 KiB
Newer Older
jdh8d's avatar
jdh8d committed
#!/bin/bash

# Needed to build components
jdh8d's avatar
jdh8d committed
BASE_PKGS="
jdh8d's avatar
jdh8d committed
  scons
jdh8d's avatar
jdh8d committed
  bison
  flex
  g++
  nasm
  sharutils
  gcc-multilib
  g++-multilib
Jason Hiser's avatar
Jason Hiser committed
  apt-libelf-dev
  yum-libelf-devel
  coreutils
Jason Hiser's avatar
Jason Hiser committed
  yum-time
# if realpath not already on system, add it to BASE_PKGS
which realpath >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
	BASE_PKGS="$BASE_PKGS realpath"
fi
Anh Nguyen-Tuong's avatar
Anh Nguyen-Tuong committed

#
# base (ld):
#  openjdk-6-jre
#  apt-libxqilla-dev
#  yum-libxqilla-devel
#  apt-libxerces-c-dev
#  yum-libxerces-c-devel
#  apt-libxml2-dev
#  yum-libxml2-devel
#
jdh8d's avatar
jdh8d committed

# For clients of IRDB
CLIENT_IRDB_PKGS="
  postgresql-client
  yum-postgresql-server 
  yum-postgresql-contrib
Jason Hiser's avatar
Jason Hiser committed
  apt-libpqxx-dev
  yum-libpqxx-devel
jdh8d's avatar
jdh8d committed
  cmake
Anh Nguyen-Tuong's avatar
Anh Nguyen-Tuong committed
  "

# old client_irdb_pkgs
#  pgadmin3
#  automake1.9
#
jdh8d's avatar
jdh8d committed

# For IRDB server
SERVER_IRDB_PKGS="
	postgresql
"
jdh8d's avatar
jdh8d committed

ALL_PKGS="$BASE_PKGS $CLIENT_IRDB_PKGS $SERVER_IRDB_PKGS "
jdh8d's avatar
jdh8d committed

	which yum 1> /dev/null 2> /dev/null 
	if [[ $? == 0  ]]; then
		echo "Installing build tools"
		sudo yum -y groupinstall 'Development Tools'
Anh Nguyen-Tuong's avatar
Anh Nguyen-Tuong committed
	local apters
		which apt-get 1> /dev/null 2> /dev/null 
		if [[ $? == 0  ]]; then
Jason Hiser's avatar
Jason Hiser committed
			if [[ $i =~ apt-* ]]; then
				echo "Will install of $i for platform  $(lsb_release -d -s)"
				apters="$apters $(echo $i|sed "s/^apt-//")"
Jason Hiser's avatar
Jason Hiser committed
			elif [[ $i =~ yum-* ]]; then
				echo "Skipping install of $i for platform  $(lsb_release -d -s)"
			else
				echo "Will install of $i for platform  $(lsb_release -d -s)"
				apters="$apters $i"
Jason Hiser's avatar
Jason Hiser committed
			fi
Jason Hiser's avatar
Jason Hiser committed
			if [[ $i =~ apt-* ]]; then
				echo "Skipping install of $i for platform  $(cat /etc/redhat-release)"
			elif [[ $i =~ yum-* ]]; then
				echo "Skipping install of $i for platform  $(cat /etc/redhat-release)"
				yummers="$yummers $(echo $i|sed "s/^yum-//")"
Jason Hiser's avatar
Jason Hiser committed
			else
				echo "Skipping install of $i for platform  $(cat /etc/redhat-release)"
				yummers="$yummers $i"
Jason Hiser's avatar
Jason Hiser committed
			fi
	which apt-get 1> /dev/null 2> /dev/null 
	if [[ $? == 0  ]]; then
Anh Nguyen-Tuong's avatar
Anh Nguyen-Tuong committed
		cmd="sudo apt-get install -y --ignore-missing $apters"
		(set -x ; sudo apt-get install -y --ignore-missing $apters)
		(set -x ; sudo yum install -y --skip-broken $yummers)
main()
{
	local args="$@"
	if [[ $args = "" ]]; then
		args="all"
	fi
	which apt-get 1> /dev/null 2> /dev/null 
	if [[ $? != 0  ]]; then
		#setup extra repositories on centos
		sudo yum install epel-release -y
	fi

	for arg in $args; do
	    case $arg in
	    all)
		install_packs $ALL_PKGS
		;;
	    build)
		install_packs $BASE_PKGS $CLIENT_IRDB_PKGS
		;;
	    test)
		install_packs $ALL_PKGS
		;;
	    deploy)
		install_packs $CLIENT_IRDB_PKGS $SERVER_IRDB_PKGS
		;;
	    base)
		install_packs $BASE_PKGS
		;;
	    client-irdb)
		install_packs $CLIENT_IRDB_PKGS
		;;
	    server-irdb)
		install_packs $SERVER_IRDB_PKGS
		;;
	    irdb)
		install_packs $CLIENT_IRDB_PKGS $SERVER_IRDB_PKGS
		;;

	    *)
		echo "$arg not recognized. Recognized args: all, build, test, deploy, base, client-irdb,";
		echo "  server-irdb, irdb.";
	    esac
	done

	orig_dir=$(pwd)

	if [ ! -z $DAFFY_HOME ]; then
		cd daffy
		sudo ./get-packages.sh
		cd $orig_dir
	fi

}

main "$@"
Jason Hiser's avatar
Jason Hiser committed

echo Installing peasoup packages complete.