Implement release native upgrade, re-add makewhatis since is needed by freebsd-update

This commit is contained in:
Jose
2021-02-02 14:35:35 -04:00
parent 2fd87131f1
commit b052ff4cc9
6 changed files with 64 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.0.86......Implement release native upgrade, re-add makewhatis since is needed by freebsd-update.
1.0.85......Add missing system file to properly compare and merge files upon upgrades.
1.0.84......Minor GUI fixes, revert makewhatis file addition.
1.0.83......Improve jail/base update, execute fetch/install commands individually.

View File

@@ -375,7 +375,7 @@ include_files()
{
if [ "$(freebsd-version | cut -d '.' -f1)" -ge 12 ]; then
sysrc -f ${CWDIR}${EXTCONF} VNET_ENABLE="YES" >/dev/null 2>&1
# Include missing files.
# Include missing system files.
if [ ! -f "/usr/local/bin/jib" ]; then
if [ -f "${SYSTEM_INCLUDE}/jib" ]; then
install -m 0544 ${SYSTEM_INCLUDE}/jib /usr/local/bin/jib
@@ -396,6 +396,11 @@ include_files()
install -m 0555 ${SYSTEM_INCLUDE}/diff3 /usr/bin/diff3
fi
fi
if [ ! -f "/usr/bin/makewhatis" ]; then
if [ -f "${SYSTEM_INCLUDE}/makewhatis" ]; then
install -m 0555 ${SYSTEM_INCLUDE}/makewhatis /usr/bin/makewhatis
fi
fi
else
sysrc -f ${CWDIR}${EXTCONF} VNET_ENABLE="NO" >/dev/null 2>&1
fi
@@ -609,7 +614,49 @@ jail_update()
exit 0
}
thinjail_upgrade()
release_upgrade()
{
if [ -d "${bastille_releasesdir}/${TARGET}" ]; then
if [ -f "${bastille_releasesdir}/${TARGET}/COPYRIGHT" ]; then
if [ "${TARGET}" = "${RELEASE}" ]; then
echo "Specified releases name match."
exit 0
fi
# Upgrade a release base.
echo "=> Run the command below several times when asked to finish installing updates."
echo "bastille-init install ${TARGET}"
echo
env PAGER="/bin/cat" ${FREEBSD_UPDATE}/freebsd-update --not-running-from-cron -f ${FREEBSD_UPDATE}/freebsd-update.conf \
-d ${CWDIR}/freebsd-update -b "${bastille_releasesdir}/${TARGET}" --currently-running "${TARGET}" -r ${RELEASE} upgrade
echo
echo "=> Please run: 'bastille-init install ${TARGET}' to finish installing updates."
else
echo "Unknown ${RELEASE}. See bootstrap."; exit 1
fi
else
echo "${TARGET} not found. See bootstrap."; exit 1
fi
exit 0
}
release_install()
{
if [ -d "${bastille_releasesdir}/${TARGET}" ]; then
if [ -f "${bastille_releasesdir}/${TARGET}/COPYRIGHT" ]; then
# Finish installing upgrade on a thick container.
env PAGER="/bin/cat" ${FREEBSD_UPDATE}/freebsd-update --not-running-from-cron -f ${FREEBSD_UPDATE}/freebsd-update.conf \
-d ${CWDIR}/freebsd-update -b "${bastille_releasesdir}/${TARGET}" install
else
echo "${TARGET} state is unknown."
exit 1
fi
else
echo "${TARGET} not found. See bootstrap."; exit 1
fi
exit 0
}
release_change()
{
if [ ! -z "$(freebsd-version | grep -i HBSD)" ]; then
echo "Not supported on HardenedBSD."
@@ -657,7 +704,7 @@ thinjail_upgrade()
echo "${NEWRELEASE} not found, bootstrap starting...."
bastille bootstrap ${NEWRELEASE}
if [ ! $? -ne 0 ]; then
thinjail_upgrade
release_change
fi
fi
else
@@ -717,6 +764,9 @@ thickjail_upgrade()
echo "${TARGET} is not a thick container."
exit 1
fi
elif [ -d "${bastille_releasesdir}/${RELEASE}" ]; then
# Try to upgrade a release instead.
release_upgrade
fi
exit 0
}
@@ -759,6 +809,9 @@ thickjail_install()
echo "${TARGET} is not a thick container."
exit 1
fi
elif [ -d "${bastille_releasesdir}/${RELEASE}" ]; then
# Try to upgrade a release instead.
release_install
fi
exit 0
}
@@ -937,7 +990,7 @@ remove_addon()
fi
done
BIN_FILES="/usr/local/bin/jib /usr/sbin/setfib /usr/bin/sum /usr/bin/diff3"
BIN_FILES="/usr/local/bin/jib /usr/sbin/setfib /usr/bin/sum /usr/bin/diff3 /usr/bin/makewhatis"
for FILE in ${BIN_FILES}; do
if [ -f "${FILE}" ]; then
rm -rf ${FILE}
@@ -1173,7 +1226,7 @@ upgrade|--upgrade)
# Check container type to upgrade
if [ -z "${NEWRELEASE}" ]; then
if [ $# -gt 3 ] || [ $# -lt 3 ]; then
echo "Usage: ${SCRIPTNAME} [upgrade|--upgrade] [container] [release]"
echo "Usage: ${SCRIPTNAME} [upgrade|--upgrade] [container|release] [release]"
exit 1
fi
thickjail_upgrade
@@ -1182,7 +1235,7 @@ upgrade|--upgrade)
echo "Usage: ${SCRIPTNAME} [upgrade|--upgrade] [container] [release] [newrelease]"
exit 1
fi
thinjail_upgrade
release_change
fi
;;
update|--update)
@@ -1219,7 +1272,7 @@ while getopts ":ospruxUvgtZh" option; do
echo "Advanced Usage: ${SCRIPTNAME} [option] [container] [release] | [newrelease]"
echo "Options:"
echo " update|--update Update a container/release to base -pX release."
echo " upgrade|--upgrade Upgrade a container release to X.Y-RELEASE."
echo " upgrade|--upgrade Upgrade a container/release to X.Y-RELEASE."
echo " install|--install Finish installing pending updates on Thick containers."
echo " clean|--clean Cleanup the FreeBSD update/upgrade cached files/folders."
echo ""; exit 0;;

Binary file not shown.

Binary file not shown.

View File

@@ -200,7 +200,7 @@ if($_POST):
$new_release = $pconfig['release'];
if(!$current_release):
$savemsg .= gtext("Base release change disabled for thick containers.");
$savemsg .= gtext("This is a thick container and should be interactively upgraded through the command line.");
else:
$cmd = ("/usr/local/sbin/bastille-init --upgrade {$item} {$current_release} {$new_release}");
unset($output,$retval);mwexec2($cmd,$output,$retval);
@@ -529,7 +529,7 @@ $document->render();
html_text2('auto_boot',gettext('Enable container auto-startup'),htmlspecialchars("This will cause the container to automatically start each time the system restart."));
html_text2('no_autoboot',gettext('Disable container auto-startup'),htmlspecialchars("This will disable the container automatic startup."));
if (!$disable_base_change):
html_combobox2('release',gettext('New base release'),$pconfig['release'],$b_action,gettext("Warning: this will change current base to the selected base on the thin container only, the user is responsible for package updates and/or general incompatibilities issues."),true,false,);
html_combobox2('release',gettext('New base release'),$pconfig['release'],$b_action,gettext("Warning: this will change current base to the selected base on the thin container only, the user is responsible for package updates and/or general incompatibilities issues, or use the command line for native upgrade."),true,false,);
endif;
//html_checkbox2('dateadd',gettext('Date'),!empty($pconfig['dateadd']) ? true : false,gettext('Append the date in the following format: ITEM-XXXX-XX-XX-XXXXXX.'),'',false);
?>

View File

@@ -1 +1 @@
1.0.85
1.0.86