Skip to content

Instantly share code, notes, and snippets.

@Cifro
Created October 26, 2011 22:25
Show Gist options
  • Save Cifro/1318198 to your computer and use it in GitHub Desktop.
Save Cifro/1318198 to your computer and use it in GitHub Desktop.
Installation script of OpenRTM-aist 1.1.0-RC1 Python version on Ubuntu 11.10
#!/bin/sh
#
# @file pkg_install_ubuntu.sh
# @brief OpenRTM-aist dependent packages install script for Debian-sarge
# @author Noriaki Ando <n-ando@aist.go.jp>
# Shinji Kurihara
# Tetsuo Ando
# Harumi Miyamoto
#
# Cifro Nix // Modified for Ubuntu 11.10, there is no package for 11.10 yet
#
#---------------------------------------
# パッケージリスト
#---------------------------------------
omnipy="python python-omniorb-omg omniidl-python omniorb-nameserver"
openrtm="openrtm-aist-python openrtm-aist-python-example"
packages="$omnipy $openrtm"
u_packages="$omnipy $openrtm "
check_lang()
{
lang="en"
msg1="This distribution may not be debian/ubuntu."
msg2="The code name is : "
msg3="This OS is not supported."
msg4="No repository entry for OpenRTM-aist is configured in your system."
msg5="repository entry for OpenrRTM-aist: "
msg6="Do you want to add new repository entry for OpenrRTM-aist in source.list? (y/n) [y] "
msg7="Abort."
msg8="This script should be run as root."
msg9="Now installing: "
msg10="done."
msg11="Now uninstalling: "
}
#---------------------------------------
# リポジトリサーバ
#---------------------------------------
create_srclist () {
openrtm_repo="deb http://www.openrtm.org/pub/Linux/ubuntu/ natty main"
echo $openrtm_repo >> /etc/apt/sources.list
}
#----------------------------------------
# root かどうかをチェック
#----------------------------------------
check_root () {
if test ! `id -u` = 0 ; then
echo ""
echo $msg8
echo $msg7
echo ""
exit 1
fi
}
#----------------------------------------
# パッケージインストール関数
#----------------------------------------
install_packages () {
for p in $*; do
echo $msg9 $p
apt-get install $p
echo $msg10
echo ""
done
}
#------------------------------------------------------------
# リストを逆順にする
#------------------------------------------------------------
reverse () {
for i in $*; do
echo $i
done | sed '1!G;h;$!d'
}
#----------------------------------------
# パッケージをアンインストールする
#----------------------------------------
uninstall_packages () {
for p in $*; do
echo $msg11 $p
aptitude remove $p
echo $msg10
echo ""
done
}
#---------------------------------------
# メイン
#---------------------------------------
check_lang
check_root
if test "x$1" = "x-u" ; then
uninstall_packages `reverse $u_packages`
else
create_srclist
apt-get update
install_packages $packages
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment