Commit 813b2bb9 authored by claes's avatar claes

New rpm package

parent 0c025564
#!/bin/bash
aroot="/usr/pwrp/adm"
# Get version
if [ -e $pwr_inc/pwr_version.h ]; then
ver=`eval cat $pwr_inc/pwr_version.h | grep "\bpwrv_cWbdbVersionShortStr\b" | awk '{print $3}'`
if [ -z $ver ]; then
echo "Unable to get pwr version"
ver="V00"
fi
ver=${ver:2:2}
fi
pkgroot=$pwre_broot/$pwre_target/bld/pkg/pwr$ver
pkgsrc=$pwre_sroot/tools/pkg/rpm/pwr
echo "-- Building pwr$ver"
# Create directories
mkdir -p $pkgroot/rpm/BUILD
mkdir -p $pkgroot/rpm/RPMS
mkdir -p $pkgroot/rpm/SPECS
mkdir -p $pkgroot/rpm/SOURCES
mkdir -p $pkgroot/rpm/SRPMS
mkdir -p $pkgroot/usr/share/doc/pwr$ver
mkdir -p $pkgroot/usr/pwrp
mkdir -p $pkgroot/etc
find $pkgroot -type d | xargs chmod 755
# copyright
cp $pkgsrc/copyright $pkgroot/usr/share/doc/pwr$ver
# changelog
cp $pkgsrc/changelog $pkgroot/usr/share/doc/pwr$ver
gzip -fq --best $pkgroot/usr/share/doc/pwr$ver/changelog
# Man pages
mkdir -p $pkgroot/usr/share/man/man1
cp $pkgsrc/pwr.1 $pkgroot/usr/share/man/man1/pwr.1
gzip -fq --best $pkgroot/usr/share/man/man1/pwr.1
# Copy proview
mkdir $pkgroot/usr/pwr$ver
currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $pwre_broot
echo "-- copy release to package tree"
tar -cf $tarfile $pwre_target/exp
cd $pkgroot/usr/pwr$ver
tar -xf $tarfile
rm $tarfile
cd $currentdir
# Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
cp $pkgsrc/pwrp_profile $pkgroot/etc
chmod a+x $pkgroot/etc/pwrp_profile
# Copy adm files to cnf
cp $pwre_sroot/tools/pkg/deb/adm/pwr_setup.sh $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
echo "pwrp set base V${ver:0:1}.${ver:1:1}" >> $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh
chmod a+x $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh
cp $pwre_sroot/tools/pkg/deb/adm/pwra_env.sh $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
chmod a+x $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwra_env.sh
cp $pwre_sroot/tools/pkg/deb/adm/pwr_volumelist.dat $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
cp $pwre_sroot/tools/pkg/deb/adm/pwr_user.dat $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
# Copy user to cnf
mkdir $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bashrc $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
echo "source $aroot/db/pwr_setup.sh" >> $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user/.bashrc
cp $pwre_sroot/tools/pkg/deb/user/.bash_profile $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.mwmrc $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.rtt_start $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.xtt_start $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.xsession $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/wtt_init.pwr_com $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/wtt_init1.pwr_com $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
export ver=$ver
# Create package
echo "-- Building package"
rpmbuild -bb --quiet \
--define "_topdir $pkgroot/rpm" \
--define "ver $ver" \
--define "pwre_target $pwre_target" \
--buildroot $pkgroot pwr.spec > /dev/null 2>&1
mv $pkgroot/rpm/RPMS/i586/*.rpm $pwre_broot/$pwre_target/bld/pkg/.
rm -r $pkgroot
Proview V3.4b (3.4.1-1)
\ No newline at end of file
Proview
Copyright: SSAB Oxelsund AB <ssabox.com>
2003-11-21
The home page of Proview is at:
http://www.proview.se
#
# Configuration file for Proview
#
# Default QCOM Bus Id
#
qcomBusId 517
#
# Web directory
#
webDirectory /var/www
PWR(1) Proview Manuals PWR(1)
NAME
pwr - start and stop Proview runtime environment
SYNOPSIS
pwr [start][stop]
DESCRIPTION
Start and stop command for Proview runtime environment.
OPTIONS
start Start Proview runtime environment.
stop Stop Proview runtime environment.
FILES
/etc/pwrp_profile
The system wide configuration file..
AUTHOR
Written by CS.
SEE ALSO
pwr(5)
Proview Last change: Nov 2003
###############################################################
# PACKAGE INFORMATION
#
# Notes:
#
# - rpm documentation
# See www.rpm.org.
#
Name: pwr
Summary: Proview/R development and runtime environment
Version: 4.1.1
Release: 1
Copyright: (c) 2005 SSAB Oxelösund AB, Sweden
#License: GPL
#BuildArch: i586
Packager: robert.karlsson@ssabox.com
Group: Development/Tools/Other
Url: http://www.proview.se
%description
For more information please see www.proview.se.
#%prep
#%setup
#%build
%install
echo "$ver"
# Generate version help file
{
echo "<topic> version"
d=`eval date +\"%F %X\"`
echo ""
echo "<image> pwr_logga.gif"
echo ""
echo ""
echo ""
echo "<b>Proview V%{version}"
echo "Version V%{version}-%{release}"
echo ""
echo "Copyright © 2004-${d:0:4} SSAB Oxelösund AB"
echo ""
echo "This program is free software; you can redistribute it and/or"
echo "modify it under the terms of the GNU General Public License as"
echo "published by the Free Software Foundation, either version 2 of"
echo "the License, or (at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
echo "For more details, see the"
echo "GNU General Public License. <weblink> http://www.proview.se/gpllicense.html"
echo ""
echo "E-mail postmaster@proview.se"
echo "Internet www.proview.se <link> http://www.proview.se/index.html"
echo ""
echo ""
echo "<b>Package"
echo "Package %{name}-%{version}-%{release}.i586.rpm"
echo "Build date $d"
echo "Package description:"
echo ""
echo %{summary}
echo "</topic>"
} > %{buildroot}/usr/pwr$ver/$pwre_target/exp/exe/wtt_version_help.dat
#%clean
%files
/usr
/etc
%post
aroot="/usr/pwrp/adm"
# Create group pwrp
if ! grep -q "\bpwrp:" /etc/group; then
echo "-- Add group pwrp"
groupadd pwrp
fi
if ! grep -q "\bpwrp:" /etc/passwd; then
echo "-- Add user pwrp"
useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -d /home/pwrp pwrp
if [ ! -e /home/pwrp ]; then
mkdir /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.bashrc /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.bash_profile /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.mwmrc /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.rtt_start /home/pwrp
chmod a+x /home/pwrp/.rtt_start
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.xtt_start /home/pwrp
chmod a+x /home/pwrp/.xtt_start
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.xsession /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/wtt_init.pwr_com /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/wtt_init1.pwr_com /home/pwrp
chown -R pwrp /home/pwrp
chgrp -R pwrp /home/pwrp
fi
fi
echo "Change owner of files to pwrp"
chown -R pwrp /usr/pwr$ver
chgrp -R pwrp /usr/pwr$ver
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_ini
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_rtt
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_xtt
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_bck
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/wb_adm
# Copy configuration files
new_cnf=0
if [ ! -e /etc/proview.cnf ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/proview.cnf /etc
new_cnf=1
fi
# Add pwrp_profile to profile
if ! grep -q "/etc/pwrp_profile\b" /etc/profile; then
cat >> /etc/profile <<-EOF
if [ -e /etc/pwrp_profile ]; then
source /etc/pwrp_profile
fi
EOF
fi
# Create and copy adm
if [ ! -e $aroot/db ]; then
mkdir -p $aroot/db
fi
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwra_env.sh $aroot/db
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh $aroot/db
if [ ! -e $aroot/db/pwr_volumelist.dat ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_volumelist.dat $aroot/db
fi
if [ ! -e $aroot/db/pwr_user.dat ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_user.dat $aroot/db
fi
# Insert base in projectlist
if [ ! -e $aroot/db/pwr_projectlist.dat ]; then
echo "%base V${ver:0:1}.${ver:1:1} /usr/pwr$ver" > $aroot/db/pwr_projectlist.dat
else
set +e
ptst=`eval grep "^%base" $aroot/db/pwr_projectlist.dat | grep "\bV${ver:0:1}.${ver:1:1}\b"`
set -e
if [ "$ptst" = "" ]; then
echo "%base V${ver:0:1}.${ver:1:1} /usr/pwr$ver" >> $aroot/db/pwr_projectlist.dat
fi
fi
# Change group to pwrp
chgrp pwrp $aroot
chmod g+w $aroot
chgrp -R pwrp $aroot/*
chmod -R g+w $aroot/*
chmod a+w /usr/pwr$ver/$pwre_target/exp/load/*.dbs
# Create project root
if [ ! -e /usr/local/pwrp ]; then
mkdir /usr/local/pwrp
chgrp pwrp /usr/local/pwrp
chmod g+w /usr/local/pwrp
fi
#%preun
#%postun
%changelog
* Fri Dec 23 2005 Robert Karlsson <robert.karlsson@ssabox.com> 4.1.1-1
- Tested
\ No newline at end of file
bus_id=""
if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
fi
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
fi
export PWR_BUS_ID=$bus_id
export pwrb_root=/usr/pwrrt
export pwrp_root=/pwrp
export pwr_exe=$pwrb_root/exe
export pwr_lib=$pwrb_root/lib
export pwr_obj=$pwrb_root/obj
export pwr_inc=$pwrb_root/inc
export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis
export pwrp_exe=$pwrp_root/x86_linux/exe
export pwrp_lib=$pwrp_root/x86_linux/lib
export pwrp_obj=$pwrp_root/x86_linux/obj
export pwrp_lis=$pwrp_root/x86_linux/lis
export pwrp_inc=$pwrp_root/common/inc
export pwrp_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log
export pwrp_db=$pwrp_root/common/db
export pwrp_web=$web_dir
export pwra_db=/usr/pwrp/adm/db
export jdk_home=/usr/local/jdk1.3/bin
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#Set display to remote computer
export DISPLAY=$REMOTEHOST:0.0
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwr stop'
alias pwr_stop.sh="/etc/init.d/pwr stop"
alias pwr_start="/etc/init.d/pwr start"
alias pwr="/etc/init.d/pwr"
alias boot="/usr/bin/sudo /sbin/reboot"
#!/bin/bash
#
# Startscript fr PWR av Ulf Ljungdahl
#
#test -x /sbin/ipchains || exit 0
#test -x /sbin/ipchains-restore || exit 0
#test -x /sbin/ipchains-save || exit 0
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
. /etc/pwrp_profile
save ()
{
echo -n "Saving IP chains: "
TEMPFILE="`tempfile`"
echo "${SAVEFILEHEADER}" >"${TEMPFILE}" && /sbin/ipchains-save >>"${TEMPFILE}" 2>/dev/null
cat "${TEMPFILE}" >/etc/ipchains.save
rm "${TEMPFILE}"
}
pwr_start()
{
$pwr_exe/rt_ini &
sleep 5
/usr/sbin/setrtprio `ps ax | grep "plc" | grep -v "grep" | awk '{ print $1}'`
}
pwr_stop()
{
kill -9 `ps ax | grep "rt_neth_acp" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_neth" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_qmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_emon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_tmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_\|/pwr/exe/rs" | awk '{ print $1}'`
kill -9 `ps ax | grep "\[rt_" | awk '{ print $1}'`
kill -9 `ps ax | grep "plc_" | awk '{ print $1}'`
kill -9 `ps ax | grep "jpwr.rt" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_nmps" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_remote" | awk '{ print $1}'`
if [ -u $pwr_exe/rt_ini ]; then
user=`ls -al $pwr_exe/rt_ini | awk '{ print $3}'`
else
user=$USER
fi
echo "User $user"
eval `ipcs -s|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm sem %s;", $2
}'`
# remove message queues
eval `ipcs -q|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm msg %s;", $2
}'`
# remove shared memory
eval `ipcs -m|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm shm %s;", $2
}'`
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
rm /tmp/pwr*$PWR_BUS_ID
#rm -f /tmp/pwr*
#id=`ipcs -s | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm sem $id1
#ipcrm sem $id2
#ipcrm sem $id3
#id=`ipcs -q | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm msg $id1
#ipcrm msg $id2
#ipcrm msg $id3
}
case "$1"
in
start)
echo "Startar PWR..."
#if [ 'test -x ps aux | grep plc | grep -v grep' ]
# then
# echo "PWR kr, stoppar det frst.."
# pwr_stop
# fi
pwr_start
echo "Klar."
;;
stop)
echo "Stoppar PWR..."
pwr_stop
# if [ "${SAVEONCE}" != "yes" ]
# then
# save
# echo -n "ipchains-save"
# else
# echo -n "Clearing IP chains:"
# fi
echo "Klar"
;;
restart)
echo "Startar om PWR."
echo "Stoppar det frst."
pwr_stop
sleep 1
echo "Startar igen."
pwr_start
echo "Klar."
;;
*)
echo "Usage:{start|stop|restart}" >&2
#echo "Ingen parameter angiven, startar PWR"
#$0 start
exit 1
;;
esac
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment