mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-21 07:08:12 +00:00
fix(packaging): embed upgrade functions in package scripts
Generate self-contained RPM and Debian upgrade scripts from the shared source. Package transactions no longer load functions from the node-facing postscript payload. Keep the existing command, logging and failure policies. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
This commit is contained in:
@@ -374,6 +374,8 @@ sub buildsources {
|
||||
}
|
||||
|
||||
if ($pkg eq "xCAT") {
|
||||
cp 'xCAT/xcat-upgrade-functions.sh', "$SOURCES/xcat-upgrade-functions.sh"
|
||||
or die "FATAL: unable to stage upgrade functions: $!\n";
|
||||
my @files = ("bmcsetup", "getipmi");
|
||||
for my $f (@files) {
|
||||
cp "xCAT-genesis-scripts/usr/bin/$f", "$pkg/postscripts/$f";
|
||||
|
||||
@@ -35,7 +35,6 @@ case "$1" in
|
||||
if [ -r "/tmp/xcat/mainservice.pid" ]; then
|
||||
mv /tmp/xcat/mainservice.pid /var/run/xcat/mainservice.pid
|
||||
fi
|
||||
. /install/postscripts/xcatupgradeutils.sh
|
||||
xcat_run_upgrade xcatconfig -u -V
|
||||
rm /tmp/xCAT_upgrade.tmp
|
||||
else
|
||||
|
||||
@@ -59,6 +59,12 @@ binary-arch:
|
||||
dh_perl
|
||||
dh_makeshlibs
|
||||
dh_installdeb
|
||||
set -e; scriptfile=debian/xcat/DEBIAN/postinst; \
|
||||
{ head -n 1 "$$scriptfile"; \
|
||||
cat xcat-upgrade-functions.sh; \
|
||||
tail -n +2 "$$scriptfile"; } > "$$scriptfile.tmp"; \
|
||||
chmod 755 "$$scriptfile.tmp"; \
|
||||
mv "$$scriptfile.tmp" "$$scriptfile"
|
||||
dh_shlibdeps
|
||||
dh_gencontrol -- -Vperl:Depends=perl
|
||||
dh_md5sums
|
||||
|
||||
+6
-2
@@ -23,6 +23,7 @@ Source9: xcat-apache-pretrans.lua
|
||||
%endif
|
||||
|
||||
Source7: xcat.conf.apach24
|
||||
Source10: xcat-upgrade-functions.sh
|
||||
|
||||
Provides: xCAT = %{version}
|
||||
Conflicts: xCATsn
|
||||
@@ -246,7 +247,8 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
|
||||
|
||||
%post
|
||||
cat %{SOURCE10} > xcat-post.sh
|
||||
cat >> xcat-post.sh <<'XCAT_POST'
|
||||
%ifos linux
|
||||
# On SUSE apache2, mod_headers is not loaded by default; enable it so the
|
||||
# security response headers in xcat.conf take effect (a no-op where a2enmod
|
||||
@@ -285,7 +287,6 @@ if [ -r "/tmp/xcat/mainservice.pid" ]; then
|
||||
mv /tmp/xcat/mainservice.pid /var/run/xcat/mainservice.pid
|
||||
fi
|
||||
|
||||
. /install/postscripts/xcatupgradeutils.sh
|
||||
xcat_run_upgrade $RPM_INSTALL_PREFIX0/sbin/xcatconfig -u -V
|
||||
|
||||
# rpm has either updated a stock xcat.conf or preserved a modified one and left
|
||||
@@ -308,6 +309,9 @@ if [ -f "/proc/cmdline" ] && [ "x$(stat -c '%i %d' /)" == "x$(stat -c '%i %d' /p
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
XCAT_POST
|
||||
|
||||
%post -f xcat-post.sh
|
||||
|
||||
%clean
|
||||
|
||||
|
||||
Reference in New Issue
Block a user