#!/bin/sh # # Copyright (c) 2012-2014, # Inter-University Research Institute Corporation, # High Energy Accelerator Research Organization. # All rights reserved. # # Author: Eiji Inoue # Email: eiji.inoue@kek.jp # # This is the installation script program for DAQ-Middleware. It is simply # a command-line interface for installing, and removing binary packages # about the DAQ-Middleware archived on the KEK server machine. # # Usage: Ubuntu_daqmw command # Command: # install - Install all DAQ Middleware package & Depending packages # remove - Remove all DAQ Middleware package & Depending packages DISTRIB_CODENAME=`lsb_release -c | cut -f2` COMMON_PACK_LIST="libxerces-c3.1 xalan libomniorb4-dev omniidl omniorb omniorb-idl omniorb-nameserver libboost-all-dev make uuid uuid-dev libxml2-utils" PRECISE_PACK_LIST="libxerces-c2-dev libxalan110 libxalan110-dev libomnithread3-dev g++-4.6" TRUSTY_PACK_LIST="libxerces-c-dev libxerces-c28 libxalan-c111 libxalan-c-dev g++" CPUARCH_X86_64="x86_64" CPUARCH_I686="i686" DEF_ARC_SERVER_NAME="daqmw" ARCH_TYPE=`arch` DAQMW_F="" DAQMW_L_F="/usr/lib/daqmw" `sed '/^#/d' /etc/apt/sources.list > /tmp/server_row` arc_server_name=`grep daqmw /tmp/server_row | cut -c12-16` > /tmp/server_row2 if [ "$ARCH_TYPE" = "$CPUARCH_X86_64" ]; then case $1 in "install") echo arch_type="$ARCH_TYPE", command="$1". if [ "$arc_server_name" != "$DEF_ARC_SERVER_NAME" ]; then arc_server_name="$DEF_ARC_SERVER_NAME" echo It has added few information about server machine "$arc_server_name" to the sources.list file. sudo mv /etc/apt/sources.list /etc/apt/sources.list-bak sudo sed -e '$a \ \ ## Add DAQ middleware archive server site.\ deb http:\/\/daqmw.kek.jp\/ubuntu\/dists\/precise\/main\/binary-amd64\/ .\/' < /etc/apt/sources.list-bak > /tmp/sources.list1 sudo sed -e "/daqmw/s/precise/$DISTRIB_CODENAME/" < /tmp/sources.list1 > /tmp/sources.list sudo mv /tmp/sources.list /etc/apt/sources.list fi echo The /etc/apt/sources.list file is ready. ## execute a "sudo apt-get update" comannd echo 'execute a "sudo apt-get update" comannd.' sudo apt-get update ## execute a "sudo apt-get install daqmiddleware" comannd echo 'execute a "sudo apt-get install daqmiddleware" comannd.' sudo apt-get -y --force-yes install daqmiddleware if [ "precise" = $DISTRIB_CODENAME ]; then for i in $COMMON_PACK_LIST $PRECISE_PACK_LIST do sudo apt-get -y install $i done elif [ "trusty" = $DISTRIB_CODENAME ]; then for i in $COMMON_PACK_LIST $TRUSTY_PACK_LIST do sudo apt-get -y install $i done fi ## configure dynamic linker echo '## configure dynamic linker.' #echo '## examine the /etc/ld.so.conf file' echo '$ ls -l /etc/ld.so.conf';ls -l /etc/ld.so.conf #echo '## Print out the /etc/ld.so.conf file.' echo '$ cat /etc/ld.so.conf';cat /etc/ld.so.conf echo '$ cat /etc/ld.so.conf.d/libc.conf';cat /etc/ld.so.conf.d/libc.conf DAQMW_F=`grep daqmw /etc/ld.so.conf.d/daqmw.conf` if [ "$DAQMW_L_F" != "$DAQMW_F" ]; then echo 'relevant "daqmw" variable is unset.' echo '$ sudo echo "/usr/lib/daqmw" > /etc/ld.so.conf.d/daqmw.conf';sudo echo "/usr/lib/daqmw" > /tmp/daqmw.conf sudo mv /tmp/daqmw.conf /etc/ld.so.conf.d/daqmw.conf sudo chmod 0644 /etc/ld.so.conf.d/daqmw.conf sudo chown root:root /etc/ld.so.conf.d/daqmw.conf echo '$ sudo /sbin/ldconfig';sudo /sbin/ldconfig else echo 'relevant "/usr/lib/daqmw" variable is already set.' # echo QMW_L_F == DAQMW_F, DAQMW_F=$DAQMW_F, $DAQMW_L_F=$DAQMW_L_F fi ## remove System-V style init script links. echo '## remove init script links.' if [ "$(ls /etc/rc* | grep omniorb4-nameserver)" != '' ]; then echo '$ sudo service omniorb4-nameserver stop';sudo service omniorb4-nameserver stop echo '$ sudo update-rc.d -f omniorb4-nameserver remove';sudo update-rc.d -f omniorb4-nameserver remove else echo 'init script links already have removed.' fi ## DAQ-Middleware binary package installation Completed. echo '';echo '## DAQ-Middleware binary package installation Completed.' break ;; "remove") echo arch_type="$ARCH_TYPE", command="$1". ## execute a "sudo apt-get remove daqmiddleware" comannd echo 'execute a "sudo apt-get -y remove daqmiddleware" comannd.' sudo apt-get -y remove daqmiddleware ## execute a "sudo apt-get autoremove daqmiddleware" comannd echo 'execute a "sudo apt-get -y autoremove daqmiddleware" comannd.' sudo apt-get -y autoremove daqmiddleware ## DAQ-Middleware binary package removing. echo '';echo '## DAQ-Middleware binary package has been deleted.' break ;; *) echo wrong argument: '"'sh "$0" "$1"'"'. echo echo Usage: Ubuntu_daqmw command echo Command: echo " install - Install all DAQ Middleware package & Depending packages" echo " remove - Remove all DAQ Middleware package & Depending packages" break ;; esac fi if [ "$ARCH_TYPE" = "$CPUARCH_I686" ]; then case $1 in "install") echo arch_type="$ARCH_TYPE", command="$1". if [ "$arc_server_name" != "$DEF_ARC_SERVER_NAME" ]; then arc_server_name="$DEF_ARC_SERVER_NAME" echo It has added few information about server machine "$arc_server_name" to the sources.list file. sudo mv /etc/apt/sources.list /etc/apt/sources.list-bak sudo sed -e '$a \ \ ## Add DAQ middleware archive server site.\ deb http:\/\/daqmw.kek.jp\/ubuntu\/dists\/precise\/main\/binary-i386\/ .\/' < /etc/apt/sources.list-bak > /tmp/sources.list1 sudo sed -e "/daqmw/s/precise/$DISTRIB_CODENAME/" < /tmp/sources.list1 > /tmp/sources.list sudo mv /tmp/sources.list /etc/apt/sources.list fi echo The /etc/apt/sources.list file is ready. ## execute a "sudo apt-get update" comannd echo 'execute a "sudo apt-get update" comannd.' sudo apt-get update ## execute a "sudo apt-get install daqmiddleware" comannd echo 'execute a "sudo apt-get install daqmiddleware" comannd.' sudo apt-get -y --force-yes install daqmiddleware if [ "precise" = $DISTRIB_CODENAME ]; then for i in $COMMON_PACK_LIST $PRECISE_PACK_LIST do sudo apt-get -y install $i done elif [ "trusty" = $DISTRIB_CODENAME ]; then for i in $COMMON_PACK_LIST $TRUSTY_PACK_LIST do sudo apt-get -y install $i done fi ## configure dynamic linker echo '## configure dynamic linker.' #echo '## examine the /etc/ld.so.conf file' echo '$ ls -l /etc/ld.so.conf';ls -l /etc/ld.so.conf #echo '## Print out the /etc/ld.so.conf file.' echo '$ cat /etc/ld.so.conf';cat /etc/ld.so.conf echo '$ cat /etc/ld.so.conf.d/libc.conf';cat /etc/ld.so.conf.d/libc.conf DAQMW_F=`grep daqmw /etc/ld.so.conf.d/daqmw.conf` if [ "$DAQMW_L_F" != "$DAQMW_F" ]; then echo 'relevant "daqmw" variable is unset.' echo '$ sudo echo "/usr/lib/daqmw" > /etc/ld.so.conf.d/daqmw.conf';sudo echo "/usr/lib/daqmw" > /tmp/daqmw.conf sudo mv /tmp/daqmw.conf /etc/ld.so.conf.d/daqmw.conf sudo chmod 0644 /etc/ld.so.conf.d/daqmw.conf sudo chown root:root /etc/ld.so.conf.d/daqmw.conf echo '$ sudo /sbin/ldconfig';sudo /sbin/ldconfig else echo 'relevant "/usr/lib/daqmw" variable is already set.' # echo QMW_L_F == DAQMW_F, DAQMW_F=$DAQMW_F, $DAQMW_L_F=$DAQMW_L_F fi ## remove System-V style init script links. echo '## remove init script links.' if [ "$(ls /etc/rc* | grep omniorb4-nameserver)" != '' ]; then echo '$ sudo service omniorb4-nameserver stop';sudo service omniorb4-nameserver stop echo '$ sudo update-rc.d -f omniorb4-nameserver remove';sudo update-rc.d -f omniorb4-nameserver remove else echo 'init script links already have removed.' fi ## DAQ-Middleware binary package installation Completed. echo '';echo '## DAQ-Middleware binary package installation Completed.' break ;; "remove") echo arch_type="$ARCH_TYPE", command="$1". ## execute a "apt-get remove daqmiddleware" comannd echo 'execute a "apt-get -y remove daqmiddleware" comannd.' sudo apt-get -y remove daqmiddleware ## execute a "apt-get autoremove daqmiddleware" comannd echo 'execute a "apt-get -y autoremove daqmiddleware" comannd.' sudo apt-get -y autoremove daqmiddleware ## DAQ-Middleware binary package installation Completed. echo '';echo '## DAQ-Middleware binary package installation Completed.' break ;; *) echo wrong argument: '"'sh "$0" "$1"'"'. echo echo Usage: Ubuntu_daqmw command echo Command: echo " install - Install all DAQ Middleware package & Depending packages" echo " remove - Remove all DAQ Middleware package & Depending packages" break ;; esac fi