Merge "Do not install N+1 release unless upgrade in progress"
This commit is contained in:
commit
5635352596
|
@ -34,47 +34,49 @@ echo "Done" >/dev/console
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
# Check whether a second release is installed
|
if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/$(hostname)/upgrade_in_progress 2>/dev/null)" = "true" ]; then
|
||||||
. /etc/build.info
|
# Check whether a second release is installed
|
||||||
CURRENT_REL_DIR=rel-${SW_VERSION}
|
. /etc/build.info
|
||||||
OTHER_REL_DIR=
|
CURRENT_REL_DIR=rel-${SW_VERSION}
|
||||||
for REL_DIR in /var/www/pages/feed/*; do
|
OTHER_REL_DIR=
|
||||||
if [[ ! $REL_DIR =~ "${SW_VERSION}" ]]; then
|
for REL_DIR in /var/www/pages/feed/*; do
|
||||||
OTHER_REL_DIR=`basename $REL_DIR`
|
if [[ ! $REL_DIR =~ "${SW_VERSION}" ]]; then
|
||||||
OTHER_REL_VERSION=${OTHER_REL_DIR:4}
|
OTHER_REL_DIR=`basename $REL_DIR`
|
||||||
break
|
OTHER_REL_VERSION=${OTHER_REL_DIR:4}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# If second release is installed, find the latest version of the installer
|
||||||
|
# RPM and install the pxeboot files we require to boot hosts with that release.
|
||||||
|
if [ ! -z "$OTHER_REL_DIR" ]; then
|
||||||
|
PATCH_RPM=`find /var/www/pages/updates/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
||||||
|
BASE_RPM=`find /var/www/pages/feed/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
||||||
|
|
||||||
|
if [ ! -z "$PATCH_RPM" ]; then
|
||||||
|
INSTALL_RPM=$PATCH_RPM
|
||||||
|
elif [ ! -z "$BASE_RPM" ]; then
|
||||||
|
INSTALL_RPM=$BASE_RPM
|
||||||
|
else
|
||||||
|
report_post_failure_with_msg "ERROR: Unable to find pxe-network-installer RPM for $OTHER_REL_DIR. Aborting installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing pxeboot files for release $OTHER_REL_DIR from $INSTALL_RPM" >/dev/console
|
||||||
|
TMP_RPM=/tmp/pxe-network-installer
|
||||||
|
mkdir $TMP_RPM
|
||||||
|
pushd $TMP_RPM
|
||||||
|
/usr/bin/rpm2cpio $INSTALL_RPM | cpio -idm \
|
||||||
|
|| report_post_failure_with_msg "Failed to extract pxe-network-installer"
|
||||||
|
|
||||||
|
cp -r $TMP_RPM/usr / \
|
||||||
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /usr"
|
||||||
|
cp -r $TMP_RPM/pxeboot/$OTHER_REL_DIR /var/pxeboot/ \
|
||||||
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /var/pxeboot/$OTHER_REL_DIR"
|
||||||
|
cp $TMP_RPM/pxeboot/pxelinux.cfg.files/*-$OTHER_REL_VERSION /var/pxeboot/pxelinux.cfg.files/ \
|
||||||
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer pxelinux.cfg files"
|
||||||
|
|
||||||
|
rm -rf $TMP_RPM
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# If second release is installed, find the latest version of the installer
|
|
||||||
# RPM and install the pxeboot files we require to boot hosts with that release.
|
|
||||||
if [ ! -z "$OTHER_REL_DIR" ]; then
|
|
||||||
PATCH_RPM=`find /var/www/pages/updates/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
|
||||||
BASE_RPM=`find /var/www/pages/feed/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
|
||||||
|
|
||||||
if [ ! -z "$PATCH_RPM" ]; then
|
|
||||||
INSTALL_RPM=$PATCH_RPM
|
|
||||||
elif [ ! -z "$BASE_RPM" ]; then
|
|
||||||
INSTALL_RPM=$BASE_RPM
|
|
||||||
else
|
|
||||||
report_post_failure_with_msg "ERROR: Unable to find pxe-network-installer RPM for $OTHER_REL_DIR. Aborting installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing pxeboot files for release $OTHER_REL_DIR from $INSTALL_RPM" >/dev/console
|
|
||||||
TMP_RPM=/tmp/pxe-network-installer
|
|
||||||
mkdir $TMP_RPM
|
|
||||||
pushd $TMP_RPM
|
|
||||||
/usr/bin/rpm2cpio $INSTALL_RPM | cpio -idm \
|
|
||||||
|| report_post_failure_with_msg "Failed to extract pxe-network-installer"
|
|
||||||
|
|
||||||
cp -r $TMP_RPM/usr / \
|
|
||||||
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /usr"
|
|
||||||
cp -r $TMP_RPM/pxeboot/$OTHER_REL_DIR /var/pxeboot/ \
|
|
||||||
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /var/pxeboot/$OTHER_REL_DIR"
|
|
||||||
cp $TMP_RPM/pxeboot/pxelinux.cfg.files/*-$OTHER_REL_VERSION /var/pxeboot/pxelinux.cfg.files/ \
|
|
||||||
|| report_post_failure_with_msg "Failed to copy pxe-network-installer pxelinux.cfg files"
|
|
||||||
|
|
||||||
rm -rf $TMP_RPM
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%end
|
%end
|
||||||
|
|
Loading…
Reference in New Issue