[openrtm-commit:02636] r3002 - trunk/OpenRTM-aist/build
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 6月 13日 (火) 15:45:31 JST
Author: kawauchi
Date: 2017-06-13 15:45:30 +0900 (Tue, 13 Jun 2017)
New Revision: 3002
Modified:
trunk/OpenRTM-aist/build/pkg_install_debian.sh
trunk/OpenRTM-aist/build/pkg_install_fedora.sh
trunk/OpenRTM-aist/build/pkg_install_ubuntu.sh
Log:
[compat,->RELENG_1_2] With OpenRTM-aist version 1.2.0 or later, you can install OpenRTM-aist, OpenRTM-aist-Python, OpenRTM-aist-Java, OpenRTP, RTShell with this script. refs #3829
Modified: trunk/OpenRTM-aist/build/pkg_install_debian.sh
===================================================================
--- trunk/OpenRTM-aist/build/pkg_install_debian.sh 2017-06-12 08:27:23 UTC (rev 3001)
+++ trunk/OpenRTM-aist/build/pkg_install_debian.sh 2017-06-13 06:45:30 UTC (rev 3002)
@@ -1,32 +1,192 @@
#!/bin/sh
#
# @file pkg_install_debian.sh
-# @brief OpenRTM-aist dependent packages install script for Debian-sarge
+# @brief OpenRTM-aist dependent packages install script for Debian
# @author Noriaki Ando <n-ando at aist.go.jp>
# Shinji Kurihara
# Tetsuo Ando
# Harumi Miyamoto
-# Nobu Kawauchi
+# Nobu Kawauchi
#
#---------------------------------------
+# usage
+#---------------------------------------
+usage()
+{
+ cat <<EOF
+ Usage:
+
+ $(basename ${0}) [-l all/c++] [-r/-d/-s/-c] [-u]
+ $(basename ${0}) [-l python/java] [-d/-c] [-u]
+ $(basename ${0}) [-l openrtp/rtshell] [-d] [-u]
+
+ Example:
+ $(basename ${0}) [= $(basename ${0}) -l c++ -d]
+ $(basename ${0}) -l all -d [= -l c++ -l python -l java -l openrtp -l rtshell -d]
+ $(basename ${0}) -l c++ -l python -c --yes
+
+ Options:
+ -l <argument> language or tool [c++/python/java/openrtp/rtshell]
+ -r install robot component runtime
+ -d install robot component developer [default]
+ -s install tool_packages for build source packages
+ -c install tool_packages for core developer
+ -u uninstall
+ --yes force yes
+ --help, -h print this
+EOF
+}
+
+#---------------------------------------
# パッケージリスト
#---------------------------------------
-set_package_list()
-{
-omni="libomniorb4-dev omniidl"
ace="libace libace-dev"
-openrtm="openrtm-aist openrtm-aist-doc openrtm-aist-dev openrtm-aist-example"
-openrtm04="openrtm-aist=0.4.2-1 openrtm-aist-doc=0.4.2-1 openrtm-aist-dev=0.4.2-1 openrtm-aist-example=0.4.2-1"
-pyyaml="python-support python-yaml"
-devel="gcc g++ make uuid-dev"
-packages="$devel $omni $pyyaml $openrtm"
-u_packages="$omni $ace $openrtm "
+openrtm04="openrtm-aist=0.4.2-1 openrtm-aist-doc=0.4.2-1 openrtm-aist-dev=0.4.2-1 openrtm-aist-example=0.4.2-1 python-yaml"
-reposervers="www.openrtm.org www.openrtm.de"
+default_reposerver="openrtm.org"
+reposervers="openrtm.org"
reposerver=""
+
+#--------------------------------------- C++
+autotools="autoconf libtool libtool-bin"
+base_tools="bc iputils-ping net-tools"
+cxx_devel="gcc g++ make python-yaml"
+cmake_tools="cmake doxygen"
+build_tools="subversion"
+deb_pkg="uuid-dev libboost-filesystem-dev"
+pkg_tools="build-essential debhelper devscripts"
+omni_devel="libomniorb4-dev omniidl"
+omni_runtime="omniorb-nameserver"
+openrtm_devel="openrtm-aist-doc openrtm-aist-dev"
+openrtm_runtime="openrtm-aist openrtm-aist-example"
+
+runtime_pkgs="$omni_runtime $openrtm_runtime"
+u_runtime_pkgs=$runtime_pkgs
+
+src_pkgs="$cxx_devel $cmake_tools $deb_pkg $omni_runtime $omni_devel"
+u_src_pkgs="$omni_runtime $omni_devel"
+
+dev_pkgs="$runtime_pkgs $src_pkgs $openrtm_devel"
+u_dev_pkgs="$u_runtime_pkgs $omni_devel $openrtm_devel"
+
+core_pkgs="$src_pkgs $autotools $base_tools $build_tools $pkg_tools"
+u_core_pkgs="$u_src_pkgs"
+
+#--------------------------------------- Python
+omnipy="omniidl-python"
+python_devel="python python-pip python-pyorbit-omg"
+openrtm_py_devel="openrtm-aist-python-doc"
+openrtm_py_runtime="openrtm-aist-python openrtm-aist-python-example"
+
+python_base="$python_devel $cmake_tools"
+python_omni="$omni_runtime $omnipy"
+
+python_dev_pkgs="$python_base $python_omni $openrtm_py_runtime $openrtm_py_devel"
+u_python_dev_pkgs="$python_omni $openrtm_py_runtime $openrtm_py_devel"
+
+python_core_pkgs="$python_base $python_omni $build_tools"
+u_python_core_pkgs="$python_omni"
+
+#--------------------------------------- Java
+java_devel="default-jdk"
+openrtm_java_devel="openrtm-aist-java-doc"
+openrtm_java_runtime="openrtm-aist-java openrtm-aist-java-example"
+
+java_dev_pkgs="$java_devel $omni_runtime $cmake_tools $openrtm_java_runtime $openrtm_java_devel"
+u_java_dev_pkgs="$omni_runtime $openrtm_java_runtime $openrtm_java_devel"
+
+java_core_pkgs="$java_devel $omni_runtime $cmake_tools $build_tools"
+u_java_core_pkgs="$omni_runtime"
+
+#--------------------------------------- OpenRTP
+openrtp_pkgs="openrtp"
+
+#---------------------------------------
+# Script options, argument analysis
+#---------------------------------------
+init_param()
+{
+OPT_RT=false
+OPT_DEV=false
+OPT_SRC=false
+OPT_CORE=false
+OPT_FLG=true
+install_pkgs=""
+uninstall_pkgs=""
}
+check_arg()
+{
+ local arg=$1
+ arg_err=0
+
+ case "$arg" in
+ all ) arg_all=true ;;
+ c++ ) arg_cxx=true ;;
+ python ) arg_python=true ;;
+ java ) arg_java=true ;;
+ openrtp ) arg_openrtp=true ;;
+ rtshell ) arg_rtshell=true ;;
+ *) arg_err=-1 ;;
+ esac
+}
+
+get_opt()
+{
+ # オプション指定が無い場合のデフォルト設定
+ if [ $# -eq 0 ] ; then
+ arg_cxx=true
+ OPT_DEV=true
+ fi
+ arg_num=$#
+
+ OPT=`getopt -o l:rcsdhu -l help,yes -- $@` > /dev/null 2>&1
+ # return code check
+ if [ $? -ne 0 ] ; then
+ echo "[ERROR] Invalid option '$1'"
+ usage
+ exit
+ fi
+ eval set -- $OPT
+
+ while true
+ do
+ case "$1" in
+ -h|--help ) usage ; exit ;;
+ --yes ) FORCE_YES=true ;;
+ -l ) if [ -z "$2" ] ; then
+ echo "$1 option requires an argument." 1>&2
+ exit
+ fi
+ check_arg $2
+ if [ "$arg_err" = "-1" ]; then
+ echo "[ERROR] Invalid argument '$2'"
+ usage
+ exit
+ fi
+ shift ;;
+ -r ) OPT_RT=true ;;
+ -d ) OPT_DEV=true ;;
+ -s ) OPT_SRC=true ;;
+ -c ) OPT_CORE=true ;;
+ -u ) OPT_FLG=false ;;
+ -- ) shift ; break ;;
+ * )
+ echo "Internal Error" 1>&2
+ exit ;;
+ esac
+ shift
+ done
+
+ # オプション指定が -u のみの場合
+ if [ $arg_num -eq 1 ] ; then
+ if test "x$OPT_FLG" = "xfalse" ; then
+ arg_cxx=true
+ fi
+ fi
+}
+
#---------------------------------------
# ロケールの言語確認
#---------------------------------------
@@ -37,30 +197,29 @@
locale | grep ja_JP > /dev/null && lang="jp"
if test "$lang" = "jp" ;then
- msg1="ディストリビューションを確認してください。\nDebian以外のOSの可能性があります。"
- msg2="コードネーム : "
- msg3="このOSはサポートされておりません。"
- msg4=" OpenRTM-aistのリポジトリが登録されていません。"
- msg5="Source.listにOpenrRTM-aistのリポジトリ:"
+ msg1="ディストリビューションを確認してください。\nDebianかUbuntu以外のOSの可能性があります。"
+ msg2="コードネーム :"
+ msg3="このOSはサポートしておりません。"
+ msg4="OpenRTM-aist のリポジトリが登録されていません。"
+ msg5="Source.list に OpenRTM-aist のリポジトリ: "
msg6="を追加します。よろしいですか?(y/n)[y] "
msg7="中断します。"
msg8="ルートユーザーで実行してください。"
msg9="インストール中です..."
msg10="完了"
- msg11="アンインストール中です"
+ msg11="アンインストール中です."
else
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 the repository entry for OpenrRTM-aist in source.list?(y/n)[y] "
+ msg5="repository entry for OpenRTM-aist: "
+ msg6="Do you want to add new repository entry for OpenRTM-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: "
-
fi
}
@@ -69,24 +228,24 @@
# コードネーム取得
#---------------------------------------
check_codename () {
- cnames="sarge etch lenny squeeze wheezy jessie"
- for c in $cnames; do
- if test -f "/etc/apt/sources.list"; then
- res=`grep $c /etc/apt/sources.list`
- else
- echo $msg1
- exit
- fi
- if test ! "x$res" = "x" ; then
- code_name=$c
- fi
- done
- if test ! "x$code_name" = "x"; then
- echo $msg2 $code_name
+ cnames="sarge etch lenny squeeze wheezy jessie"
+ for c in $cnames; do
+ if test -f "/etc/apt/sources.list"; then
+ res=`grep $c /etc/apt/sources.list`
else
- echo $msg3
- exit
+ echo $msg1
+ exit
fi
+ if test ! "x$res" = "x" ; then
+ code_name=$c
+ fi
+ done
+ if test ! "x$code_name" = "x"; then
+ echo $msg2 $code_name
+ else
+ echo $msg3
+ exit
+ fi
}
#----------------------------------------
@@ -94,31 +253,31 @@
#----------------------------------------
check_reposerver()
{
- minrtt=65535
- nearhost=''
- for host in $reposervers; do
- rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
- if test "x$rtt" = "x"; then
- rtt=65535
- fi
- if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
- minrtt=$rtt
- nearhost=$host
- fi
- done
- if test "x$nearhost" = "x"; then
- echo "Repository servers unreachable.", $hosts
- exit 1
+ minrtt=65535
+ nearhost=''
+ for host in $reposervers; do
+ rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
+ if test "x$rtt" = "x"; then
+ rtt=65535
fi
- reposerver=$nearhost
+ if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
+ minrtt=$rtt
+ nearhost=$host
+ fi
+ done
+ if test "x$nearhost" = "x"; then
+ echo "Repository servers unreachable.", $hosts
+ echo "Check your internet connection. (or are you using proxy?)"
+ nearhost=$default_reposerver
+ fi
+ reposerver=$nearhost
}
-
#---------------------------------------
# リポジトリサーバ
#---------------------------------------
create_srclist () {
- openrtm_repo="deb http://$reposerver/pub/Linux/debian/ $code_name main"
+ openrtm_repo="deb http://$reposerver/pub/Linux/debian/ $code_name main"
}
#---------------------------------------
@@ -125,20 +284,22 @@
# ソースリスト更新関数の定義
#---------------------------------------
update_source_list () {
- rtmsite=`grep $reposerver /etc/apt/sources.list`
- if test "x$rtmsite" = "x" ; then
- echo $msg4
- echo $msg5
- echo " " $openrtm_repo
- read -p "$msg6" kick_shell
+ rtmsite=`grep "$openrtm_repo" /etc/apt/sources.list`
+ if test "x$rtmsite" = "x" ; then
+ echo $msg4
+ echo $msg5
+ echo " " $openrtm_repo
+ read -p "$msg6" kick_shell
- if test "x$kick_shell" = "xn" ; then
- echo $msg7
- exit 0
- else
- echo $openrtm_repo >> /etc/apt/sources.list
- fi
+ if test "x$kick_shell" = "xn" ; then
+ echo $msg7
+ exit 0
+ else
+ echo $openrtm_repo >> /etc/apt/sources.list
+ # 公開鍵登録
+ #apt-key adv --keyserver keys.gnupg.net --recv-keys 4BCE106E087AFAC0
fi
+ fi
}
#----------------------------------------
@@ -145,13 +306,13 @@
# root かどうかをチェック
#----------------------------------------
check_root () {
- if test ! `id -u` = 0 ; then
- echo ""
- echo $msg8
- echo $msg7
- echo ""
- exit 1
- fi
+ if test ! `id -u` = 0 ; then
+ echo ""
+ echo $msg8
+ echo $msg7
+ echo ""
+ exit 1
+ fi
}
#----------------------------------------
@@ -158,12 +319,26 @@
# パッケージインストール関数
#----------------------------------------
install_packages () {
- for p in $*; do
- echo $msg9 $p
- apt-get install $p
- echo $msg10
- echo ""
- done
+ for p in $*; do
+ echo $msg9 $p
+ dpkg -l | grep $p > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ tmp_pkg="$install_pkgs $p"
+ install_pkgs=$tmp_pkg
+ fi
+
+ if test "x$FORCE_YES" = "xtrue" ; then
+ apt-get install --assume-yes --allow-unauthenticated $p
+ else
+ apt-get install $p
+ fi
+ if [ $? -ne 0 ]; then
+ echo $msg7
+ exit
+ fi
+ echo $msg10
+ echo ""
+ done
}
#------------------------------------------------------------
@@ -170,9 +345,9 @@
# リストを逆順にする
#------------------------------------------------------------
reverse () {
- for i in $*; do
- echo $i
- done | sed '1!G;h;$!d'
+ for i in $*; do
+ echo $i
+ done | sed '1!G;h;$!d'
}
#----------------------------------------
@@ -179,38 +354,243 @@
# パッケージをアンインストールする
#----------------------------------------
uninstall_packages () {
- for p in $*; do
- echo $msg11 $p
- aptitude remove $p
- if test "$?" != 0; then
- apt-get purge $p
- fi
- echo $msg10
- echo ""
- done
+ for p in $*; do
+ echo $msg11 $p
+ tmp_pkg="$uninstall_pkgs $p"
+ uninstall_pkgs=$tmp_pkg
+
+ apt-get --purge remove $p
+ if test "$?" != 0; then
+ apt-get purge $p
+ fi
+ echo $msg10
+ echo ""
+ done
}
#---------------------------------------
+# install_branch
+#---------------------------------------
+install_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for core developer"
+ install_packages $core_pkgs
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for source packages"
+ install_packages $src_pkgs
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] install robot component runtime"
+ install_packages $runtime_pkgs
+ else
+ select_opt_c="[c++] install robot component developer"
+ install_packages $dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] install tool_packages for core developer"
+ install_packages $python_core_pkgs
+ else
+ select_opt_p="[python] install robot component developer"
+ install_packages $python_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] install tool_packages for core developer"
+ install_packages $java_core_pkgs
+ else
+ select_opt_j="[java] install robot component developer"
+ install_packages $java_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] install"
+ install_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] install"
+ install_packages $python_devel
+ rtshell_ret=`pip install rtshell`
+ fi
+}
+
+#---------------------------------------
+# uninstall_branch
+#---------------------------------------
+uninstall_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_core_pkgs`
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for source packages"
+ uninstall_packages `reverse $u_src_pkgs`
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] uninstall robot component runtime"
+ uninstall_packages `reverse $u_runtime_pkgs`
+ else
+ select_opt_c="[c++] uninstall robot component developer"
+ uninstall_packages `reverse $u_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_python_core_pkgs`
+ else
+ select_opt_p="[python] uninstall robot component developer"
+ uninstall_packages `reverse $u_python_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_java_core_pkgs`
+ else
+ select_opt_j="[java] uninstall robot component developer"
+ uninstall_packages `reverse $u_java_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] uninstall"
+ uninstall_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] uninstall"
+ rtshell_ret=`pip uninstall -y rtshell`
+ fi
+}
+
+#---------------------------------------
+# print_option
+#---------------------------------------
+print_option()
+{
+ cat <<EOF
+
+=============================================
+ Selected options is ...
+=============================================
+EOF
+
+ if test ! "x$select_opt_c" = "x" ; then
+ echo $select_opt_c
+ fi
+ if test ! "x$select_opt_p" = "x" ; then
+ echo $select_opt_p
+ fi
+ if test ! "x$select_opt_j" = "x" ; then
+ echo $select_opt_j
+ fi
+ if test ! "x$select_opt_rtp" = "x" ; then
+ echo $select_opt_rtp
+ fi
+ if test ! "x$select_opt_shl" = "x" ; then
+ echo $select_opt_shl
+ fi
+}
+
+#---------------------------------------
+# install_result
+#---------------------------------------
+install_result()
+{
+ print_option
+ cat <<EOF
+
+=============================================
+ Install package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xfalse"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xtrue"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
+}
+
+#---------------------------------------
+# uninstall_result
+#---------------------------------------
+uninstall_result()
+{
+ cat <<EOF
+
+=============================================
+ Uninstall package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xtrue"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xfalse"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
+}
+
+#---------------------------------------
# メイン
#---------------------------------------
+init_param
+get_opt $@
+
check_lang
check_root
+check_reposerver
check_codename
-set_package_list
+create_srclist
+update_source_list
+apt-get autoclean
+apt-get update
-if test "x$1" = "x0.4.2" || test "x$1" = "x0.4" ; then
- openrtm=$openrtm04
- packages="$devel $omni $ace $pyyaml $openrtm"
+if test "x$arg_all" = "xtrue" ; then
+ arg_cxx=true
+ arg_python=true
+ arg_java=true
+ arg_openrtp=true
+ arg_rtshell=true
+
+ if test "x$OPT_RT" != "xtrue" &&
+ test "x$OPT_DEV" != "xtrue" &&
+ test "x$OPT_SRC" != "xtrue" &&
+ test "x$OPT_CORE" != "xtrue" ; then
+ # set default option
+ OPT_DEV=true
+ fi
fi
-if test "x$1" = "x-u" ; then
- uninstall_packages `reverse $u_packages`
+if test "x$OPT_FLG" = "xtrue" ; then
+ install_branch
else
- check_reposerver
- create_srclist
- update_source_list
- apt-get autoclean
- apt-get update
- uninstall_packages `reverse $openrtm`
- install_packages $packages
+ uninstall_branch
fi
+
+install_result $install_pkgs
+uninstall_result $uninstall_pkgs
Modified: trunk/OpenRTM-aist/build/pkg_install_fedora.sh
===================================================================
--- trunk/OpenRTM-aist/build/pkg_install_fedora.sh 2017-06-12 08:27:23 UTC (rev 3001)
+++ trunk/OpenRTM-aist/build/pkg_install_fedora.sh 2017-06-13 06:45:30 UTC (rev 3002)
@@ -5,28 +5,102 @@
# @author Noriaki Ando <n-ando at aist.go.jp>
# Shinji Kurihara
# Tetsuo Ando
-# Nobu Kawauchi
+# Nobu Kawauchi
#
-# このシェルスクリプトは、aceおよびomniORBのパッケージをインストールし、
-# fedoraの開発環境を構築します。
-#
-# $Id$
-#
+
#---------------------------------------
+# usage
+#---------------------------------------
+usage()
+{
+ cat <<EOF
+ Usage:
+
+ $(basename ${0}) [-l all/c++] [-r/-d/-s/-c] [-u]
+ $(basename ${0}) [-l python/java] [-d/-c] [-u]
+ $(basename ${0}) [-l openrtp] [-d] [-u]
+
+ Example:
+ $(basename ${0}) [= $(basename ${0}) -l c++ -d]
+ $(basename ${0}) -l all -d [= -l c++ -l python -l java -l openrtp -d]
+ $(basename ${0}) -l c++ -l python -c --yes
+
+ Options:
+ -l <argument> language or tool [c++/python/java/openrtp]
+ -r install robot component runtime
+ -d install robot component developer [default]
+ -s install tool_packages for build source packages
+ -c install tool_packages for core developer
+ -u uninstall
+ --yes force yes
+ --help, -h print this
+EOF
+}
+
+#---------------------------------------
# パッケージリスト
#---------------------------------------
version_num=`cat /etc/fedora-release | awk '/Fedora/{print $3}' -`
-omni="omniORB omniORB-devel omniORB-doc omniORB-servers omniORB-utils"
ace="ace ace-devel"
-openrtm="OpenRTM-aist OpenRTM-aist-devel OpenRTM-aist-doc OpenRTM-aist-example PyYAML"
openrtm04="OpenRTM-aist-0.4.2 OpenRTM-aist-devel-0.4.2 OpenRTM-aist-doc-0.4.2 OpenRTM-aist-example-0.4.2 PyYAML"
-devel="gcc-c++ uuid-devel libuuid-devel"
-packages="$devel $omni $openrtm"
default_reposerver="openrtm.org"
reposervers="openrtm.org"
reposerver=""
+#--------------------------------------- C++
+autotools="autoconf automake libtool"
+cxx_devel="gcc-c++ make PyYAML"
+cmake_tools="cmake doxygen"
+build_tools="subversion"
+rpm_pkg="uuid-devel libuuid-devel boost boost-devel"
+rpm_tools="createrepo rpm-build"
+omni_devel="omniORB-devel omniORB-doc omniORB-utils"
+omni_runtime="omniORB omniORB-servers"
+openrtm_devel="OpenRTM-aist-doc OpenRTM-aist-devel"
+openrtm_runtime="OpenRTM-aist OpenRTM-aist-example"
+
+runtime_pkgs="$omni_runtime $openrtm_runtime"
+u_runtime_pkgs=$runtime_pkgs
+
+src_pkgs="$cxx_devel $cmake_tools $rpm_pkg $omni_runtime $omni_devel"
+u_src_pkgs="$omni_runtime $omni_devel"
+
+dev_pkgs="$runtime_pkgs $src_pkgs $openrtm_devel"
+u_dev_pkgs="$u_runtime_pkgs $omni_devel $openrtm_devel"
+
+core_pkgs="$src_pkgs $autotools $build_tools $rpm_tools"
+u_core_pkgs="$u_src_pkgs"
+
+#--------------------------------------- Python
+omnipy="omniORBpy-devel"
+python_devel="python python-omniORB"
+openrtm_py_devel="OpenRTM-aist-Python-doc"
+openrtm_py_runtime="OpenRTM-aist-Python OpenRTM-aist-Python-example"
+
+python_base="$python_devel $cmake_tools"
+python_omni="$omni_runtime $omnipy"
+
+python_dev_pkgs="$python_base $python_omni $openrtm_py_runtime $openrtm_py_devel"
+u_python_dev_pkgs="$python_omni $openrtm_py_runtime $openrtm_py_devel"
+
+python_core_pkgs="$python_base $python_omni $build_tools"
+u_python_core_pkgs="$python_omni"
+
+#--------------------------------------- Java
+java_devel="java-1.8.0-openjdk-devel"
+openrtm_java_devel="OpenRTM-aist-Java-doc"
+openrtm_java_runtime="OpenRTM-aist-Java OpenRTM-aist-Java-example"
+
+java_dev_pkgs="$java_devel $omni_runtime $cmake_tools $openrtm_java_runtime $openrtm_java_devel"
+u_java_dev_pkgs="$omni_runtime $openrtm_java_runtime $openrtm_java_devel"
+
+java_core_pkgs="$java_devel $omni_runtime $cmake_tools $build_tools"
+u_java_core_pkgs="$omni_runtime"
+
+#--------------------------------------- OpenRTP
+openrtp_pkgs="OpenRTP"
+
#---------------------------------------
# yum / dnf コマンド切替え
#---------------------------------------
@@ -36,29 +110,128 @@
COMMAND="yum"
fi
-#----------------------------------------
-# root かどうかをチェック
-#----------------------------------------
-check_root () {
- if test ! `id -u` = 0 ; then
- echo ""
- echo "This script should be run by root user."
- echo "Abort."
- echo ""
- exit 1
+#---------------------------------------
+# Script options, argument analysis
+#---------------------------------------
+init_param()
+{
+OPT_RT=false
+OPT_DEV=false
+OPT_SRC=false
+OPT_CORE=false
+OPT_FLG=true
+install_pkgs=""
+uninstall_pkgs=""
+arg_rtshell=false
+}
+
+check_arg()
+{
+ local arg=$1
+ arg_err=0
+
+ case "$arg" in
+ all ) arg_all=true ;;
+ c++ ) arg_cxx=true ;;
+ python ) arg_python=true ;;
+ java ) arg_java=true ;;
+ openrtp ) arg_openrtp=true ;;
+# rtshell ) arg_rtshell=true ;;
+ *) arg_err=-1 ;;
+ esac
+}
+
+get_opt()
+{
+ # オプション指定が無い場合のデフォルト設定
+ if [ $# -eq 0 ] ; then
+ arg_cxx=true
+ OPT_DEV=true
+ fi
+ arg_num=$#
+
+ OPT=`getopt -o l:rcsdhu -l help,yes -- $@` > /dev/null 2>&1
+ # return code check
+ if [ $? -ne 0 ] ; then
+ echo "[ERROR] Invalid option '$1'"
+ usage
+ exit
+ fi
+ eval set -- $OPT
+
+ while true
+ do
+ case "$1" in
+ -h|--help ) usage ; exit ;;
+ --yes ) FORCE_YES=true ;;
+ -l ) if [ -z "$2" ] ; then
+ echo "$1 option requires an argument." 1>&2
+ exit
+ fi
+ check_arg $2
+ if [ "$arg_err" = "-1" ]; then
+ echo "[ERROR] Invalid argument '$2'"
+ usage
+ exit
+ fi
+ shift ;;
+ -r ) OPT_RT=true ;;
+ -d ) OPT_DEV=true ;;
+ -s ) OPT_SRC=true ;;
+ -c ) OPT_CORE=true ;;
+ -u ) OPT_FLG=false ;;
+ -- ) shift ; break ;;
+ * )
+ echo "Internal Error" 1>&2
+ exit ;;
+ esac
+ shift
+ done
+
+ # オプション指定が -u のみの場合
+ if [ $arg_num -eq 1 ] ; then
+ if test "x$OPT_FLG" = "xfalse" ; then
+ arg_cxx=true
fi
+ fi
}
#---------------------------------------
-# インストール済パッケージリスト
+# ロケールの言語確認
#---------------------------------------
-rpm_qa="/tmp/yum_list.txt"
-get_pkg_list () {
- rpm -qa > $rpm_qa
+check_lang()
+{
+lang="en"
+
+locale | grep ja_JP > /dev/null && lang="jp"
+
+if test "$lang" = "jp" ;then
+ msg1="ディストリビューションを確認してください。\nDebianかUbuntu以外のOSの可能性があります。"
+ msg2="コードネーム :"
+ msg3="このOSはサポートしておりません。"
+ msg4="OpenRTM-aist のリポジトリが登録されていません。"
+ msg5="Source.list に OpenRTM-aist のリポジトリ: "
+ msg6="を追加します。よろしいですか?(y/n)[y] "
+ msg7="中断します。"
+ msg8="ルートユーザーで実行してください。"
+ msg9="インストール中です..."
+ msg10="完了"
+ msg11="アンインストール中です."
+else
+ 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 OpenRTM-aist: "
+ msg6="Do you want to add new repository entry for OpenRTM-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: "
+fi
+
}
-clean_pkg_list () {
- rm -f $rpm_qa
-}
#----------------------------------------
# 近いリポジトリサーバを探す
@@ -65,24 +238,24 @@
#----------------------------------------
check_reposerver()
{
- minrtt=65535
- nearhost=''
- for host in $reposervers; do
- rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
- if test "x$rtt" = "x"; then
- rtt=65535
- fi
- if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
- minrtt=$rtt
- nearhost=$host
- fi
- done
- if test "x$nearhost" = "x"; then
- echo "Repository servers unreachable.", $hosts
+ minrtt=65535
+ nearhost=''
+ for host in $reposervers; do
+ rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
+ if test "x$rtt" = "x"; then
+ rtt=65535
+ fi
+ if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
+ minrtt=$rtt
+ nearhost=$host
+ fi
+ done
+ if test "x$nearhost" = "x"; then
+ echo "Repository servers unreachable.", $hosts
echo "Check your internet connection. (or are you using proxy?)"
nearhost=$default_reposerver
- fi
- reposerver=$nearhost
+ fi
+ reposerver=$nearhost
}
@@ -102,38 +275,59 @@
}
create_repo() {
- repo="/etc/yum.repos.d/openrtm.repo"
- if test ! -f $repo ; then
- echo "OpenRTM-aist のリポジトリが登録されていません。"
- echo "OpenRTM-aist のリポジトリ: "
- echo " http://www.openrtm.org/pub/Linux/Fedora/"
- read -p "を追加します。よろしいですか? (y/n) [y] " kick_shell
+ repo="/etc/yum.repos.d/openrtm.repo"
+ if test ! -f $repo ; then
+ echo $msg4
+ echo "OpenRTM-aist のリポジトリ: "
+ echo " http://$reposerver/pub/Linux/Fedora/"
+ read -p "$msg6" kick_shell
- if test "x$kick_shell" = "xn" ; then
- echo "中断します。"
- exit 0
- else
- openrtm_repo > /etc/yum.repos.d/openrtm.repo
- fi
+ if test "x$kick_shell" = "xn" ; then
+ echo $msg7
+ exit 0
+ else
+ openrtm_repo > /etc/yum.repos.d/openrtm.repo
fi
+ fi
}
#----------------------------------------
+# root かどうかをチェック
+#----------------------------------------
+check_root () {
+ if test ! `id -u` = 0 ; then
+ echo ""
+ echo $msg8
+ echo $msg7
+ echo ""
+ exit 1
+ fi
+}
+
+#----------------------------------------
# パッケージインストール関数
#----------------------------------------
install_packages () {
- for p in $*; do
- ins=`rpm -qa $p`
- if test "x$ins" = "x"; then
- echo "Now installing: " $p
- $COMMAND install $p
- echo "done."
- echo ""
- else
- echo $p "is already installed."
- echo ""
- fi
- done
+ for p in $*; do
+ echo $msg9 $p
+ ins=`rpm -qa $p`
+ if test "x$ins" = "x"; then
+ tmp_pkg="$install_pkgs $p"
+ install_pkgs=$tmp_pkg
+ fi
+
+ if test "x$FORCE_YES" = "xtrue" ; then
+ $COMMAND -y install $p
+ else
+ $COMMAND install $p
+ fi
+ if [ $? -ne 0 ]; then
+ echo $msg7
+ exit
+ fi
+# echo $msg10
+ echo ""
+ done
}
#------------------------------------------------------------
@@ -140,9 +334,9 @@
# リストを逆順にする
#------------------------------------------------------------
reverse () {
- for i in $*; do
- echo $i
- done | sed '1!G;h;$!d'
+ for i in $*; do
+ echo $i
+ done | sed '1!G;h;$!d'
}
#----------------------------------------
@@ -149,28 +343,236 @@
# パッケージをアンインストールする
#----------------------------------------
uninstall_packages () {
- for p in $*; do
- echo "Now uninstalling: " $p
- $COMMAND erase $p
- echo "done."
- echo ""
- done
+ for p in $*; do
+ echo $msg11 $p
+ tmp_pkg="$uninstall_pkgs $p"
+ uninstall_pkgs=$tmp_pkg
+
+ $COMMAND erase $p
+ echo $msg10
+ echo ""
+ done
}
#---------------------------------------
+# install_branch
+#---------------------------------------
+install_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for core developer"
+ install_packages $core_pkgs
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for source packages"
+ install_packages $src_pkgs
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] install robot component runtime"
+ install_packages $runtime_pkgs
+ else
+ select_opt_c="[c++] install robot component developer"
+ install_packages $dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] install tool_packages for core developer"
+ install_packages $python_core_pkgs
+ else
+ select_opt_p="[python] install robot component developer"
+ install_packages $python_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] install tool_packages for core developer"
+ install_packages $java_core_pkgs
+ else
+ select_opt_j="[java] install robot component developer"
+ install_packages $java_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] install"
+ install_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] install"
+ install_packages $python_devel
+ rtshell_ret=`pip install rtshell`
+ fi
+}
+
+#---------------------------------------
+# uninstall_branch
+#---------------------------------------
+uninstall_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_core_pkgs`
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for source packages"
+ uninstall_packages `reverse $u_src_pkgs`
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] uninstall robot component runtime"
+ uninstall_packages `reverse $u_runtime_pkgs`
+ else
+ select_opt_c="[c++] uninstall robot component developer"
+ uninstall_packages `reverse $u_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_python_core_pkgs`
+ else
+ select_opt_p="[python] uninstall robot component developer"
+ uninstall_packages `reverse $u_python_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_java_core_pkgs`
+ else
+ select_opt_j="[java] uninstall robot component developer"
+ uninstall_packages `reverse $u_java_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] uninstall"
+ uninstall_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] uninstall"
+ rtshell_ret=`pip uninstall -y rtshell`
+ fi
+}
+
+#---------------------------------------
+# print_option
+#---------------------------------------
+print_option()
+{
+ cat <<EOF
+
+=============================================
+ Selected options is ...
+=============================================
+EOF
+
+ if test ! "x$select_opt_c" = "x" ; then
+ echo $select_opt_c
+ fi
+ if test ! "x$select_opt_p" = "x" ; then
+ echo $select_opt_p
+ fi
+ if test ! "x$select_opt_j" = "x" ; then
+ echo $select_opt_j
+ fi
+ if test ! "x$select_opt_rtp" = "x" ; then
+ echo $select_opt_rtp
+ fi
+ if test ! "x$select_opt_shl" = "x" ; then
+ echo $select_opt_shl
+ fi
+}
+
+#---------------------------------------
+# install_result
+#---------------------------------------
+install_result()
+{
+ print_option
+ cat <<EOF
+
+=============================================
+ Install package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xfalse"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xtrue"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
+}
+
+#---------------------------------------
+# uninstall_result
+#---------------------------------------
+uninstall_result()
+{
+ cat <<EOF
+
+=============================================
+ Uninstall package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xtrue"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xfalse"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
+}
+
+#---------------------------------------
# メイン
#---------------------------------------
+init_param
+get_opt $@
+
+check_lang
check_root
+check_reposerver
+create_repo
-if test "x$1" = "x0.4.2" || test "x$1" = "x0.4" ; then
- openrtm=$openrtm04
- packages="$devel $omni $ace $openrtm"
+if test "x$arg_all" = "xtrue" ; then
+ arg_cxx=true
+ arg_python=true
+ arg_java=true
+ arg_openrtp=true
+# arg_rtshell=true
+
+ if test "x$OPT_RT" != "xtrue" &&
+ test "x$OPT_DEV" != "xtrue" &&
+ test "x$OPT_SRC" != "xtrue" &&
+ test "x$OPT_CORE" != "xtrue" ; then
+ # set default option
+ OPT_DEV=true
+ fi
fi
-if test "x$1" = "x-u" ; then
- uninstall_packages `reverse $packages`
+if test "x$OPT_FLG" = "xtrue" ; then
+ install_branch
else
- check_reposerver
- create_repo
- install_packages $packages
+ uninstall_branch
fi
+
+install_result $install_pkgs
+uninstall_result $uninstall_pkgs
Modified: trunk/OpenRTM-aist/build/pkg_install_ubuntu.sh
===================================================================
--- trunk/OpenRTM-aist/build/pkg_install_ubuntu.sh 2017-06-12 08:27:23 UTC (rev 3001)
+++ trunk/OpenRTM-aist/build/pkg_install_ubuntu.sh 2017-06-13 06:45:30 UTC (rev 3002)
@@ -1,68 +1,194 @@
#!/bin/sh
#
# @file pkg_install_ubuntu.sh
-# @brief OpenRTM-aist dependent packages install script for Debian-sarge
+# @brief OpenRTM-aist dependent packages install script for Ubuntu
# @author Noriaki Ando <n-ando at aist.go.jp>
# Shinji Kurihara
# Tetsuo Ando
# Harumi Miyamoto
# Seisho Irie
+# Nobu Kawauchi
#
-#
-# sudo sh pkg_install_ubuntu.sh [-s/-us/-d/-ud/-c/-uc/-r/-ur]
-# option -s : install tool_packages for build Source packages
-# option -us : Uninstall tool_packages for build Source packages
-# option -d : install tool_packages for build Distribution
-# option -ud : Uninstall tool_packages for build Distribution
-# option -c : install robot Component developer tool_packages
-# option -uc : Uninstall robot Component developer tool_packages
-# option -r : install robot component Runtime tool_packages
-# option -ur : Uninstall robot component Runtime tool_packages
-#
-# chmod 775
-#
+#---------------------------------------
+# usage
+#---------------------------------------
+usage()
+{
+ cat <<EOF
+ Usage:
+ $(basename ${0}) [-l all/c++] [-r/-d/-s/-c] [-u]
+ $(basename ${0}) [-l python/java] [-d/-c] [-u]
+ $(basename ${0}) [-l openrtp/rtshell] [-d] [-u]
+
+ Example:
+ $(basename ${0}) [= $(basename ${0}) -l c++ -d]
+ $(basename ${0}) -l all -d [= -l c++ -l python -l java -l openrtp -l rtshell -d]
+ $(basename ${0}) -l c++ -l python -c --yes
+
+ Options:
+ -l <argument> language or tool [c++/python/java/openrtp/rtshell]
+ -r install robot component runtime
+ -d install robot component developer [default]
+ -s install tool_packages for build source packages
+ -c install tool_packages for core developer
+ -u uninstall
+ --yes force yes
+ --help, -h print this
+EOF
+}
+
#---------------------------------------
# パッケージリスト
#---------------------------------------
-omni="libomniorb4-dev omniidl"
ace="libace libace-dev"
-openrtm="openrtm-aist openrtm-aist-doc openrtm-aist-dev openrtm-aist-example python-yaml"
openrtm04="openrtm-aist=0.4.2-1 openrtm-aist-doc=0.4.2-1 openrtm-aist-dev=0.4.2-1 openrtm-aist-example=0.4.2-1 python-yaml"
-devel="gcc g++ make uuid-dev libboost-filesystem-dev"
-packages="$devel $omni $openrtm"
-u_packages="$omni $ace $openrtm "
default_reposerver="openrtm.org"
reposervers="openrtm.org"
reposerver=""
-#---------------------------------------
+#--------------------------------------- C++
autotools="autoconf libtool libtool-bin"
-build_tools="gcc g++ make"
-dep_pkg="uuid-dev doxygen"
-deb_tools="build-essential debhelper devscripts"
-omni_devel="libomniorb4-dev omniidl omniorb-nameserver"
+base_tools="bc iputils-ping net-tools"
+cxx_devel="gcc g++ make python-yaml"
+cmake_tools="cmake doxygen"
+build_tools="subversion"
+deb_pkg="uuid-dev libboost-filesystem-dev"
+pkg_tools="build-essential debhelper devscripts"
+omni_devel="libomniorb4-dev omniidl"
omni_runtime="omniorb-nameserver"
-openrtm_devel="openrtm-aist-doc openrtm-aist-dev python-yaml"
+openrtm_devel="openrtm-aist-doc openrtm-aist-dev"
openrtm_runtime="openrtm-aist openrtm-aist-example"
-source_tools="subversion texlive texlive-lang-cjk xdvik-ja python-yaml"
+runtime_pkgs="$omni_runtime $openrtm_runtime"
+u_runtime_pkgs=$runtime_pkgs
-source_pkgs="$autotools $build_tools $dep_pkg $source_tools $omni_devel"
-u_source_pkgs="$autotools $build_tools $dep_pkg $source_tools $omni_devel"
+src_pkgs="$cxx_devel $cmake_tools $deb_pkg $omni_runtime $omni_devel"
+u_src_pkgs="$omni_runtime $omni_devel"
-distribution_pkgs="$build_tools $dep_pkg $deb_tools $omni_devel"
-u_distribution_pkgs="$build_tools $dep_pkg $deb_tools $omni_devel"
+dev_pkgs="$runtime_pkgs $src_pkgs $openrtm_devel"
+u_dev_pkgs="$u_runtime_pkgs $omni_devel $openrtm_devel"
-component_pkgs="$build_tools $dep_pkg $omni_devel $openrtm_devel $openrtm_runtime"
-u_component_pkgs="$build_tools $dep_pkg $omni_devel $openrtm_devel $openrtm_runtime"
+core_pkgs="$src_pkgs $autotools $base_tools $build_tools $pkg_tools"
+u_core_pkgs="$u_src_pkgs"
-runtime_pkgs="$omni_runtime $openrtm_runtime"
-u_runtime_pkgs="$omni_runtime $openrtm_runtime"
+#--------------------------------------- Python
+omnipy="omniidl-python"
+python_devel="python python-pip python-pyorbit-omg"
+openrtm_py_devel="openrtm-aist-python-doc"
+openrtm_py_runtime="openrtm-aist-python openrtm-aist-python-example"
+python_base="$python_devel $cmake_tools"
+python_omni="$omni_runtime $omnipy"
+
+python_dev_pkgs="$python_base $python_omni $openrtm_py_runtime $openrtm_py_devel"
+u_python_dev_pkgs="$python_omni $openrtm_py_runtime $openrtm_py_devel"
+
+python_core_pkgs="$python_base $python_omni $build_tools"
+u_python_core_pkgs="$python_omni"
+
+#--------------------------------------- Java
+java_devel="default-jdk"
+openrtm_java_devel="openrtm-aist-java-doc"
+openrtm_java_runtime="openrtm-aist-java openrtm-aist-java-example"
+
+java_dev_pkgs="$java_devel $omni_runtime $cmake_tools $openrtm_java_runtime $openrtm_java_devel"
+u_java_dev_pkgs="$omni_runtime $openrtm_java_runtime $openrtm_java_devel"
+
+java_core_pkgs="$java_devel $omni_runtime $cmake_tools $build_tools"
+u_java_core_pkgs="$omni_runtime"
+
+#--------------------------------------- OpenRTP
+openrtp_pkgs="openrtp"
+
#---------------------------------------
+# Script options, argument analysis
+#---------------------------------------
+init_param()
+{
+OPT_RT=false
+OPT_DEV=false
+OPT_SRC=false
+OPT_CORE=false
+OPT_FLG=true
+install_pkgs=""
+uninstall_pkgs=""
+}
+
+check_arg()
+{
+ local arg=$1
+ arg_err=0
+
+ case "$arg" in
+ all ) arg_all=true ;;
+ c++ ) arg_cxx=true ;;
+ python ) arg_python=true ;;
+ java ) arg_java=true ;;
+ openrtp ) arg_openrtp=true ;;
+ rtshell ) arg_rtshell=true ;;
+ *) arg_err=-1 ;;
+ esac
+}
+
+get_opt()
+{
+ # オプション指定が無い場合のデフォルト設定
+ if [ $# -eq 0 ] ; then
+ arg_cxx=true
+ OPT_DEV=true
+ fi
+ arg_num=$#
+
+ OPT=`getopt -o l:rcsdhu -l help,yes -- $@` > /dev/null 2>&1
+ # return code check
+ if [ $? -ne 0 ] ; then
+ echo "[ERROR] Invalid option '$1'"
+ usage
+ exit
+ fi
+ eval set -- $OPT
+
+ while true
+ do
+ case "$1" in
+ -h|--help ) usage ; exit ;;
+ --yes ) FORCE_YES=true ;;
+ -l ) if [ -z "$2" ] ; then
+ echo "$1 option requires an argument." 1>&2
+ exit
+ fi
+ check_arg $2
+ if [ "$arg_err" = "-1" ]; then
+ echo "[ERROR] Invalid argument '$2'"
+ usage
+ exit
+ fi
+ shift ;;
+ -r ) OPT_RT=true ;;
+ -d ) OPT_DEV=true ;;
+ -s ) OPT_SRC=true ;;
+ -c ) OPT_CORE=true ;;
+ -u ) OPT_FLG=false ;;
+ -- ) shift ; break ;;
+ * )
+ echo "Internal Error" 1>&2
+ exit ;;
+ esac
+ shift
+ done
+
+ # オプション指定が -u のみの場合
+ if [ $arg_num -eq 1 ] ; then
+ if test "x$OPT_FLG" = "xfalse" ; then
+ arg_cxx=true
+ fi
+ fi
+}
+
+#---------------------------------------
# ロケールの言語確認
#---------------------------------------
check_lang()
@@ -104,52 +230,50 @@
#----------------------------------------
check_reposerver()
{
- minrtt=65535
- nearhost=''
- for host in $reposervers; do
- rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
- if test "x$rtt" = "x"; then
- rtt=65535
- fi
- if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
- minrtt=$rtt
- nearhost=$host
- fi
- done
- if test "x$nearhost" = "x"; then
- echo "Repository servers unreachable.", $hosts
- echo "Check your internet connection. (or are you using proxy?)"
- nearhost=$default_reposerver
+ minrtt=65535
+ nearhost=''
+ for host in $reposervers; do
+ rtt=`ping -c 1 $host | grep 'time=' | sed -e 's/^.*time=\([0-9\.]*\) ms.*/\1/' 2> /dev/null`
+ if test "x$rtt" = "x"; then
+ rtt=65535
fi
- reposerver=$nearhost
+ if test `echo "scale=2 ; $rtt < $minrtt" | bc` -gt 0; then
+ minrtt=$rtt
+ nearhost=$host
+ fi
+ done
+ if test "x$nearhost" = "x"; then
+ echo "Repository servers unreachable.", $hosts
+ echo "Check your internet connection. (or are you using proxy?)"
+ nearhost=$default_reposerver
+ fi
+ reposerver=$nearhost
}
-
#---------------------------------------
# リポジトリサーバ
#---------------------------------------
create_srclist () {
- codename=`sed -n /DISTRIB_CODENAME=/p /etc/lsb-release`
- cnames=`echo "$codename" | sed 's/DISTRIB_CODENAME=//'`
- #cnames="sarge edgy feisty gutsy hardy intrepid"
- for c in $cnames; do
- if test -f "/etc/apt/sources.list"; then
- res=`grep $c /etc/apt/sources.list`
- else
- echo $msg1
- exit
- fi
- if test ! "x$res" = "x" ; then
- code_name=$c
- fi
- done
- if test ! "x$code_name" = "x"; then
- echo $msg2 $code_name
+ codename=`sed -n /DISTRIB_CODENAME=/p /etc/lsb-release`
+ cnames=`echo "$codename" | sed 's/DISTRIB_CODENAME=//'`
+ for c in $cnames; do
+ if test -f "/etc/apt/sources.list"; then
+ res=`grep $c /etc/apt/sources.list`
else
- echo $msg3
- exit
+ echo $msg1
+ exit
fi
- openrtm_repo="deb http://$reposerver/pub/Linux/ubuntu/ $code_name main"
+ if test ! "x$res" = "x" ; then
+ code_name=$c
+ fi
+ done
+ if test ! "x$code_name" = "x"; then
+ echo $msg2 $code_name
+ else
+ echo $msg3
+ exit
+ fi
+ openrtm_repo="deb http://$reposerver/pub/Linux/ubuntu/ $code_name main"
}
#---------------------------------------
@@ -156,20 +280,22 @@
# ソースリスト更新関数の定義
#---------------------------------------
update_source_list () {
- rtmsite=`grep "$openrtm_repo" /etc/apt/sources.list`
- if test "x$rtmsite" = "x" ; then
- echo $msg4
- echo $msg5
- echo " " $openrtm_repo
- read -p "$msg6" kick_shell
+ rtmsite=`grep "$openrtm_repo" /etc/apt/sources.list`
+ if test "x$rtmsite" = "x" ; then
+ echo $msg4
+ echo $msg5
+ echo " " $openrtm_repo
+ read -p "$msg6" kick_shell
- if test "x$kick_shell" = "xn" ; then
- echo $msg7
- exit 0
- else
- echo $openrtm_repo >> /etc/apt/sources.list
- fi
+ if test "x$kick_shell" = "xn" ; then
+ echo $msg7
+ exit 0
+ else
+ echo $openrtm_repo >> /etc/apt/sources.list
+ # 公開鍵登録
+ apt-key adv --keyserver keys.gnupg.net --recv-keys 4BCE106E087AFAC0
fi
+ fi
}
#----------------------------------------
@@ -176,13 +302,13 @@
# root かどうかをチェック
#----------------------------------------
check_root () {
- if test ! `id -u` = 0 ; then
- echo ""
- echo $msg8
- echo $msg7
- echo ""
- exit 1
- fi
+ if test ! `id -u` = 0 ; then
+ echo ""
+ echo $msg8
+ echo $msg7
+ echo ""
+ exit 1
+ fi
}
#----------------------------------------
@@ -189,12 +315,26 @@
# パッケージインストール関数
#----------------------------------------
install_packages () {
- for p in $*; do
- echo $msg9 $p
- apt-get install --force-yes -y $p
- echo $msg10
- echo ""
- done
+ for p in $*; do
+ echo $msg9 $p
+ dpkg -l | grep $p > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ tmp_pkg="$install_pkgs $p"
+ install_pkgs=$tmp_pkg
+ fi
+
+ if test "x$FORCE_YES" = "xtrue" ; then
+ apt-get install --assume-yes --allow-unauthenticated $p
+ else
+ apt-get install $p
+ fi
+ if [ $? -ne 0 ]; then
+ echo $msg7
+ exit
+ fi
+ echo $msg10
+ echo ""
+ done
}
#------------------------------------------------------------
@@ -201,9 +341,9 @@
# リストを逆順にする
#------------------------------------------------------------
reverse () {
- for i in $*; do
- echo $i
- done | sed '1!G;h;$!d'
+ for i in $*; do
+ echo $i
+ done | sed '1!G;h;$!d'
}
#----------------------------------------
@@ -210,91 +350,213 @@
# パッケージをアンインストールする
#----------------------------------------
uninstall_packages () {
- for p in $*; do
- echo $msg11 $p
- aptitude remove $p
- if test "$?" != 0; then
- apt-get purge $p
- fi
- echo $msg10
- echo ""
- done
+ for p in $*; do
+ echo $msg11 $p
+ tmp_pkg="$uninstall_pkgs $p"
+ uninstall_pkgs=$tmp_pkg
+
+ apt-get --purge remove $p
+ if test "$?" != 0; then
+ apt-get purge $p
+ fi
+ echo $msg10
+ echo ""
+ done
}
#---------------------------------------
-# install tool_packages for build Source packages
+# install_branch
#---------------------------------------
-install_source_packages(){
- echo "--------install $source_pkgs"
- install_packages $source_pkgs
+install_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for core developer"
+ install_packages $core_pkgs
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] install tool_packages for source packages"
+ install_packages $src_pkgs
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] install robot component runtime"
+ install_packages $runtime_pkgs
+ else
+ select_opt_c="[c++] install robot component developer"
+ install_packages $dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] install tool_packages for core developer"
+ install_packages $python_core_pkgs
+ else
+ select_opt_p="[python] install robot component developer"
+ install_packages $python_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] install tool_packages for core developer"
+ install_packages $java_core_pkgs
+ else
+ select_opt_j="[java] install robot component developer"
+ install_packages $java_dev_pkgs
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] install"
+ install_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] install"
+ install_packages $python_devel
+ rtshell_ret=`pip install rtshell`
+ fi
}
+
#---------------------------------------
-# Uninstall tool_packages for build Source packages
+# uninstall_branch
#---------------------------------------
-uninstall_source_packages(){
- echo "--------uninstall $u_source_pkgs"
- uninstall_packages `reverse $u_source_pkgs`
+uninstall_branch()
+{
+ if test "x$arg_cxx" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_core_pkgs`
+ elif test "x$OPT_SRC" = "xtrue" ; then
+ select_opt_c="[c++] uninstall tool_packages for source packages"
+ uninstall_packages `reverse $u_src_pkgs`
+ elif test "x$OPT_RT" = "xtrue" ; then
+ select_opt_c="[c++] uninstall robot component runtime"
+ uninstall_packages `reverse $u_runtime_pkgs`
+ else
+ select_opt_c="[c++] uninstall robot component developer"
+ uninstall_packages `reverse $u_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_python" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_p="[python] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_python_core_pkgs`
+ else
+ select_opt_p="[python] uninstall robot component developer"
+ uninstall_packages `reverse $u_python_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_java" = "xtrue" ; then
+ if test "x$OPT_CORE" = "xtrue" ; then
+ select_opt_j="[java] uninstall tool_packages for core developer"
+ uninstall_packages `reverse $u_java_core_pkgs`
+ else
+ select_opt_j="[java] uninstall robot component developer"
+ uninstall_packages `reverse $u_java_dev_pkgs`
+ fi
+ fi
+
+ if test "x$arg_openrtp" = "xtrue" ; then
+ select_opt_rtp="[openrtp] uninstall"
+ uninstall_packages $openrtp_pkgs
+ fi
+
+ if test "x$arg_rtshell" = "xtrue" ; then
+ select_opt_shl="[rtshell] uninstall"
+ rtshell_ret=`pip uninstall -y rtshell`
+ fi
}
+
#---------------------------------------
-# install tool_packages for build Distribution
+# print_option
#---------------------------------------
-install_distribution(){
- echo "--------install $distribution_pkgs"
- install_packages $distribution_pkgs
+print_option()
+{
+ cat <<EOF
+
+=============================================
+ Selected options is ...
+=============================================
+EOF
+
+ if test ! "x$select_opt_c" = "x" ; then
+ echo $select_opt_c
+ fi
+ if test ! "x$select_opt_p" = "x" ; then
+ echo $select_opt_p
+ fi
+ if test ! "x$select_opt_j" = "x" ; then
+ echo $select_opt_j
+ fi
+ if test ! "x$select_opt_rtp" = "x" ; then
+ echo $select_opt_rtp
+ fi
+ if test ! "x$select_opt_shl" = "x" ; then
+ echo $select_opt_shl
+ fi
}
+
#---------------------------------------
-# Uninstall tool_packages for build Distribution
+# install_result
#---------------------------------------
-uninstall_distribution(){
- echo "--------uninstall $u_distribution_pkgs"
- uninstall_packages `reverse $u_distribution_pkgs`
+install_result()
+{
+ print_option
+ cat <<EOF
+
+=============================================
+ Install package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xfalse"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xtrue"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
}
+
#---------------------------------------
-# install robot Component developer tool_packages
+# uninstall_result
#---------------------------------------
-install_componet_developer(){
- echo "--------install $component_pkgs()"
- install_packages $component_pkgs
+uninstall_result()
+{
+ cat <<EOF
+
+=============================================
+ Uninstall package is ...
+=============================================
+EOF
+ if [ $# -eq 0 ] && test "x$OPT_FLG" = "xtrue"; then
+ echo "There is no installation package."
+ return
+ fi
+
+ for p in $*; do
+ echo $p
+ done
+ if test "x$arg_rtshell" = "xtrue" && test "x$OPT_FLG" = "xfalse"; then
+ if test "x$rtshell_ret" != "x"; then
+ echo "rtshell"
+ fi
+ fi
}
-#---------------------------------------
-# Uninstall robot Component developer tool_packages
-#---------------------------------------
-uninstall_componet_developer(){
- echo "--------uninstall $u_component_pkgs"
- uninstall_packages `reverse $u_component_pkgs`
-}
-#---------------------------------------
-# install robot component Runtime tool_packages
-#---------------------------------------
-install_runtime(){
- echo "--------install $runtime_pkgs"
- install_packages $runtime_pkgs
-}
-#---------------------------------------
-# Uninstall robot component Runtime tool_packages
-#---------------------------------------
-uninstall_runtime(){
- echo "--------uninstall $u_runtime_pkgs"
- uninstall_packages `reverse $u_runtime_pkgs`
-}
-#---------------------------------------
-#
-#---------------------------------------
-howto_usage(){
- echo "Usage: sudo sh pkg_install_ubuntu.sh [-s/-us/-d/-ud/-c/-uc/-r/-ur]"
- echo " option -s : install tool_packages for build Source packages"
- echo " option -us : Uninstall tool_packages for build Source packages"
- echo " option -d : install tool_packages for build Distribution"
- echo " option -ud : Uninstall tool_packages for build Distribution"
- echo " option -c : install robot Component developer tool_packages"
- echo " option -uc : Uninstall robot Component developer tool_packages"
- echo " option -r : install robot component Runtime tool_packages"
- echo " option -ur : Uninstall robot component Runtime tool_packages"
-}
#---------------------------------------
# メイン
#---------------------------------------
+init_param
+get_opt $@
+
check_lang
check_root
check_reposerver
@@ -303,37 +565,27 @@
apt-get autoclean
apt-get update
-if test "x$1" = "x-s" ; then
- install_source_packages
- exit 0
+if test "x$arg_all" = "xtrue" ; then
+ arg_cxx=true
+ arg_python=true
+ arg_java=true
+ arg_openrtp=true
+ arg_rtshell=true
+
+ if test "x$OPT_RT" != "xtrue" &&
+ test "x$OPT_DEV" != "xtrue" &&
+ test "x$OPT_SRC" != "xtrue" &&
+ test "x$OPT_CORE" != "xtrue" ; then
+ # set default option
+ OPT_DEV=true
+ fi
fi
-if test "x$1" = "x-us" ; then
- uninstall_source_packages
- exit 0
+
+if test "x$OPT_FLG" = "xtrue" ; then
+ install_branch
+else
+ uninstall_branch
fi
-if test "x$1" = "x-d" ; then
- install_distribution
- exit 0
-fi
-if test "x$1" = "x-ud" ; then
- uninstall_distribution
- exit 0
-fi
-if test "x$1" = "x-c" ; then
- install_componet_developer
- exit 0
-fi
-if test "x$1" = "x-uc" ; then
- uninstall_componet_developer
- exit 0
-fi
-if test "x$1" = "x-r" ; then
- install_runtime
- exit 0
-fi
-if test "x$1" = "x-ur" ; then
- uninstall_runtime
- exit 0
-fi
-howto_usage
+install_result $install_pkgs
+uninstall_result $uninstall_pkgs
More information about the openrtm-commit
mailing list