Commit a166ab5f authored by Andrew McNab's avatar Andrew McNab
Browse files

Build mjf-torque and (machinefeatures only) mjf-htcondor RPM

parent 339aeee5
......@@ -10,7 +10,14 @@ Vendor: GridPP
Packager: Andrew McNab <Andrew.McNab@cern.ch>
%description
MJF for Torque/PBS
MJF following HSF-TN-2016-02 for Torque/PBS
%package -n mjf-htcondor
Group: System Environment/Daemons
Summary: Machine/Job Features for HTCondor
%description -n mjf-htcondor
MJF following HSF-TN-2016-02 for HTCondor
%prep
......@@ -22,17 +29,32 @@ MJF for Torque/PBS
make install
%post
chkconfig mjf-torque on
service mjf-torque start
chkconfig mjf on
service mjf start
%preun
if [ "$1" = "0" ] ; then
# if uninstallation rather than upgrade then stop
chkconfig mjf-torque off
service mjf-torque stop
chkconfig mjf off
service mjf stop
fi
%files
/var/lib/torque/mom_priv
/etc/rc.d/init.d/*
/etc/profile.d/*
%post -n mjf-htcondor
chkconfig mjf on
service mjf start
%preun -n mjf-htcondor
if [ "$1" = "0" ] ; then
# if uninstallation rather than upgrade then stop
chkconfig mjf off
service mjf stop
fi
%file -n mjf-htcondor
/etc/rc.d/init.d/*
/etc/profile.d/*
......@@ -23,7 +23,7 @@ if [ -f /etc/sysconfig/mjf ] ; then
fi
# Transient configuration goes in run - for example shutdowntime
# Files put in mjf get deleted when the machine boots up
# Files put in mjf get deleted when the machine boots up!
if [ -f /var/run/mjf ] ; then
. /var/run/mjf
fi
......@@ -31,36 +31,34 @@ fi
start() {
[ "$EUID" != "0" ] && exit 1
# Create files
# Create new files in temporary directory
echo -n $"Set up /etc/machinefeatures: "
rm -Rf /etc/machinefeatures
mkdir -p /etc/machinefeatures
/bin/rm -Rf /etc/machinefeatures.tmp
mkdir -p /etc/machinefeatures.tmp
if [ "$total_cpu" == "" ] ; then
# If not explicitly configured then calculate from hardware
total_cpu=`grep '^processor[[:space:]]*:' /proc/cpuinfo | wc --lines`
fi
echo -n "$total_cpu" > /etc/machinefeatures/total_cpu
echo -n "$total_cpu" > /etc/machinefeatures.tmp/total_cpu
if [ "$hs06" == "" ] ; then
rm -f /etc/machinefeatures/hs06
else
echo -n "$hs06" > /etc/machinefeatures/hs06
if [ "$hs06" != "" ] ; then
echo -n "$hs06" > /etc/machinefeatures.tmp/hs06
fi
if [ "$shutdowntime" == "" ] ; then
rm -f /etc/machinefeatures/shutdowntime
else
echo -n "$shutdowntime" > /etc/machinefeatures/shutdowntime
if [ "$shutdowntime" != "" ] ; then
echo -n "$shutdowntime" > /etc/machinefeatures.tmp/shutdowntime
fi
if [ "$grace_secs" == "" ] ; then
rm -f /etc/machinefeatures/grace_secs
else
echo -n "$grace_secs" > /etc/machinefeatures/grace_secs
if [ "$grace_secs" != "" ] ; then
echo -n "$grace_secs" > /etc/machinefeatures.tmp/grace_secs
fi
# Remove any existing directory and move new version into place
/bin/rm -Rf /etc/machinefeatures
/bin/mv -f /etc/machinefeatures.tmp /etc/machinefeatures
echo_success
echo
return 0
......@@ -69,7 +67,7 @@ start() {
stop() {
[ "$EUID" != "0" ] && exit 3
# Remove /etc/machinefeatures in case upgrading
# Remove /etc/machinefeatures in case of future upgrades
echo -n $"Clean up machinefeatures: "
rm -Rf /etc/machinefeatures
echo_success
......
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