Skip to content

Commit

Permalink
PP-702, PP-754: Installations and upgrades on Cray XC CLE 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mike0042 committed Apr 19, 2017
1 parent 929f4c4 commit ddac9d0
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 192 deletions.
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -335,6 +335,7 @@ AC_CONFIG_FILES([
src/cmds/pbsrun
src/cmds/scripts/Makefile
src/cmds/scripts/au-nodeupdate
src/cmds/scripts/modulefile
src/cmds/scripts/pbs_habitat
src/cmds/scripts/pbs_init.d
src/cmds/scripts/pbs_poerun
Expand Down
132 changes: 59 additions & 73 deletions pbspro.spec
Expand Up @@ -256,97 +256,83 @@ ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}/libexec/pbs_postinstall client \
%{version} ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}

%preun %{pbs_server}
if [ -x /sbin/chkconfig -a -x /sbin/service ]; then
out=`/sbin/chkconfig --list pbs 2>/dev/null`
if [ $? -eq 0 ]; then
if [ -x /etc/init.d/pbs ]; then
/etc/init.d/pbs stop
else
/sbin/service pbs stop
fi
/sbin/chkconfig --del pbs
fi
else
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
[ -x /etc/init.d/pbs ] && /etc/init.d/pbs stop
rm -f /etc/rc.d/rc0.d/K10pbs
rm -f /etc/rc.d/rc1.d/K10pbs
rm -f /etc/rc.d/rc2.d/K10pbs
rm -f /etc/rc.d/rc3.d/S90pbs
rm -f /etc/rc.d/rc4.d/K10pbs
rm -f /etc/rc.d/rc5.d/S90pbs
rm -f /etc/rc.d/rc6.d/K10pbs
fi
rm -f ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}/etc/db_user.new
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
[ -x /sbin/chkconfig ] && /sbin/chkconfig --del pbs >/dev/null 2>&1
rm -f /etc/rc.d/rc?.d/[KS]??pbs
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
fi
fi
rm -f /etc/init.d/pbs
rm -f /opt/modulefiles/pbs/%{version}
%if %{defined have_systemd}
systemctl disable pbs
rm -f /usr/lib/systemd/system-preset/95-pbs.preset
%endif
fi
rm -f /etc/init.d/pbs
%if %{defined have_systemd}
systemctl disable pbs
rm -f /usr/lib/systemd/system-preset/95-pbs.preset
%endif

%preun %{pbs_execution}
if [ -x /sbin/chkconfig -a -x /sbin/service ]; then
out=`/sbin/chkconfig --list pbs 2>/dev/null`
if [ $? -eq 0 ]; then
if [ -x /etc/init.d/pbs ]; then
/etc/init.d/pbs stop
else
/sbin/service pbs stop
fi
/sbin/chkconfig --del pbs
fi
else
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
[ -x /etc/init.d/pbs ] && /etc/init.d/pbs stop
rm -f /etc/rc.d/rc0.d/K10pbs
rm -f /etc/rc.d/rc1.d/K10pbs
rm -f /etc/rc.d/rc2.d/K10pbs
rm -f /etc/rc.d/rc3.d/S90pbs
rm -f /etc/rc.d/rc4.d/K10pbs
rm -f /etc/rc.d/rc5.d/S90pbs
rm -f /etc/rc.d/rc6.d/K10pbs
fi
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
[ -x /sbin/chkconfig ] && /sbin/chkconfig --del pbs >/dev/null 2>&1
rm -f /etc/rc.d/rc?.d/[KS]??pbs
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
fi
fi
rm -f /etc/init.d/pbs
rm -f /opt/modulefiles/pbs/%{version}
%if %{defined have_systemd}
systemctl disable pbs
rm -f /usr/lib/systemd/system-preset/95-pbs.preset
%endif
fi
rm -f /etc/init.d/pbs
%if %{defined have_systemd}
systemctl disable pbs
rm -f /usr/lib/systemd/system-preset/95-pbs.preset
%endif

%preun %{pbs_client}
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
if [ `basename ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}` = %{version} ]; then
top_level=`dirname ${RPM_INSTALL_PREFIX:=%{pbs_prefix}}`
if [ -h $top_level/default ]; then
link_target=`readlink $top_level/default`
[ `basename "$link_target"` = %{version} ] && rm -f $top_level/default
fi
fi
rm -f /opt/modulefiles/pbs/%{version}
fi

%postun %{pbs_server}
echo
echo "NOTE: /etc/pbs.conf and the PBS_HOME directory must be deleted manually"
echo
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
echo
echo "NOTE: /etc/pbs.conf and the PBS_HOME directory must be deleted manually"
echo
fi

%postun %{pbs_execution}
echo
echo "NOTE: /etc/pbs.conf and the PBS_HOME directory must be deleted manually"
echo
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
echo
echo "NOTE: /etc/pbs.conf and the PBS_HOME directory must be deleted manually"
echo
fi

%postun %{pbs_client}
echo
echo "NOTE: /etc/pbs.conf must be deleted manually"
echo
if [ "$1" != "1" ]; then
# This is an uninstall, not an upgrade.
echo
echo "NOTE: /etc/pbs.conf must be deleted manually"
echo
fi

%files %{pbs_server}
%defattr(-,root,root, -)
Expand Down
Expand Up @@ -13,6 +13,6 @@ puts stderr ""
}
set _module_name [module-info name]
set is_module_rm [module-info mode remove]
set package_root [file join /opt ${_module_name}]
set package_root @prefix@
prepend-path MANPATH [file join ${package_root} man]
prepend-path PATH [file join ${package_root} bin]
37 changes: 20 additions & 17 deletions src/cmds/scripts/pbs_habitat.in
Expand Up @@ -34,7 +34,7 @@
# "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
# trademark licensing policies.

if [ $# -eq 1 ] && [ $1 = "--version" ]; then
if [ $# -eq 1 -a "$1" = "--version" ]; then
echo pbs_version = @PBS_VERSION@
exit 0
fi
Expand All @@ -45,13 +45,14 @@ PBS_CURRENT_SCHEMA_VER='1.2.0'
PBS_AES_SWITCH_VER='14.0'

get_db_user() {
[ -f "${dbuser_fl}" ] && dbuser_name=`cat "${dbuser_fl}" | tr -d '[:space:]'`
[ -z "${dbuser_name}" ] && dbuser_name="${PBS_DATA_SERVICE_USER:-@database_user@}"
if [ ! -f "${dbuser_fl}" ]; then
echo "@database_user@"
return 0
else
cat "${dbuser_fl}"
return $?
printf "%s" "$dbuser_name" >"${dbuser_fl}"
chmod 0600 "${dbuser_fl}"
fi
cat "${dbuser_fl}"
return $?
}

chk_dataservice_user() {
Expand Down Expand Up @@ -103,12 +104,6 @@ is_cray_xt() {
return 1
}

createpath() {
while read mode dir ;do
createdir ${PBS_HOME}/${dir} $mode
done
}

set_db_trust_login() {
datastore_dir=$1
err=`cp -p ${datastore_dir}/pg_hba.conf ${datastore_dir}/pg_hba.conf.orig 2>&1`
Expand Down Expand Up @@ -648,13 +643,21 @@ chkenv() {
}

createdir() {
if [ ! -d $1 ]; then
if ! mkdir $1 ;then
if [ -n "$1" -a ! -d "$1" ]; then
if ! mkdir -p "$1"; then
echo "*** Could not create $1"
exit 1
fi
fi
chmod $2 $1
if [ -n "$1" -a -n "$2" ]; then
chmod "$2" "$1"
fi
}

createpath() {
while read mode dir ;do
createdir "${PBS_HOME}/${dir}" $mode
done
}

# Return the name of the PBS server host
Expand Down Expand Up @@ -713,8 +716,8 @@ if [ ! -d "$PBS_HOME" ]; then
elif [ -x "$PBS_EXEC/sbin/pbs_mom" ]; then
component="execution"
else
echo "*** Error Trying to execute pbs_habitat in client installation."
exit 1
echo "*** No need to execute pbs_habitat in client installation."
exit 0
fi
${PBS_EXEC}/libexec/pbs_postinstall $component $PBS_VERSION $PBS_EXEC $PBS_HOME "" "sameconf"
fi
Expand Down

0 comments on commit ddac9d0

Please sign in to comment.