#!/bin/sh # # Copyright (c) 2012-2013, # 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: Debian_daqmw command # Command: # install - Install all DAQ Middleware package & Depending packages # remove - Remove all DAQ Middleware package & Depending packages server_name="daqmw" 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\/debian\/dists\/wheezy\/main\/binary-amd64\/ .\/' < /etc/apt/sources.list-bak > /tmp/sources.list sudo mv /tmp/sources.list /etc/apt/sources.list fi echo The /etc/apt/sources.list file is ready. #grep $server_name /etc/apt/sources.list ## 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 sudo apt-get -y install libxerces-c2-dev sudo apt-get -y install libxerces-c3.1 sudo apt-get -y install xalan sudo apt-get -y install libxalan110 sudo apt-get -y install libxalan110-dev sudo apt-get -y install libomniorb4-dev sudo apt-get -y install libomnithread3-dev sudo apt-get -y install omniidl sudo apt-get -y install omniorb sudo apt-get -y install omniorb-idl sudo apt-get -y install omniorb-nameserver sudo apt-get -y install libboost-all-dev sudo apt-get -y install make sudo apt-get -y install g++-4.6 sudo apt-get -y install uuid sudo apt-get -y install uuid-dev sudo apt-get -y install libxml2-utils ## 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: Debian_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\/debian\/dists\/wheezy\/main\/binary-i386\/ .\/' < /etc/apt/sources.list-bak > /tmp/sources.list sudo mv /tmp/sources.list /etc/apt/sources.list fi echo The /etc/apt/sources.list file is ready. #grep $server_name /etc/apt/sources.list ## 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 sudo apt-get -y install libxerces-c2-dev sudo apt-get -y install libxerces-c3.1 sudo apt-get -y install xalan sudo apt-get -y install libxalan110 sudo apt-get -y install libxalan110-dev sudo apt-get -y install libomniorb4-dev sudo apt-get -y install libomnithread3-dev sudo apt-get -y install omniidl sudo apt-get -y install omniorb sudo apt-get -y install omniorb-idl sudo apt-get -y install omniorb-nameserver sudo apt-get -y install libboost-all-dev sudo apt-get -y install make sudo apt-get -y install g++-4.6 sudo apt-get -y install uuid sudo apt-get -y install uuid-dev sudo apt-get -y install libxml2-utils ## 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: Debian_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