Add ability to manually update bastille core files

This commit is contained in:
JRGTH
2021-12-22 04:51:05 -04:00
parent 0c708358e6
commit 11fe00059b
4 changed files with 50 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.1.06......Add ability to manually update bastille core files.
1.1.05......Fix a bug to display correct VNET interface.
1.1.04......Fix a bug that prevents VNET jail creation.
1.1.03......Add patch to improve ZFS activation, contributed by disaster.

View File

@@ -224,6 +224,32 @@ bastille_upgrade()
fi
}
bastille_core_update()
{
# Check if bastille already exist.
if [ -f "${CWDIR}/${FULLAPPNAME}${BASTILLEPATH}/${APPNAME}" ]; then
# Fetch latest bastille package.
echo "Fetching ${APPNAME} files..."
fetch -ao ${CWDIR}/${BRANCH}.zip --no-verify-peer --timeout=30 ${BATSILLE_URL} || \
error_notify "Error: A problem has occurred while fetching ${APPNAME}."
bastille_pkg_extract
fi
if [ -f "${CWDIR}/${BRANCH}.zip" ] && [ -f "${CWDIR}/${FULLAPPNAME}${BASTILLEPATH}/${APPNAME}" ]; then
echo "Extracting ${APPNAME}..."
tar -xf ${CWDIR}/${BRANCH}.zip --exclude='.git*' --exclude='docs' --exclude='bastille.conf' --strip-components 1 -C ${CWDIR}/${FULLAPPNAME} || \
error_notify "Error: A problem has occurred while extractig ${APPNAME} files."
chmod 555 ${CWDIR}/${FULLAPPNAME}${BASTILLEPATH}/${APPNAME}
chmod 555 ${CWDIR}/${FULLAPPNAME}${BASTILLERCD}
rm -f ${CWDIR}/${BRANCH}.zip
echo "Done!"
fi
echo "${PRDNAME} core package update completed!"
exit 0
}
ext_initial_download()
{
# Always ensure the version file is present, otherwise update the extension files on startup.
@@ -1314,6 +1340,9 @@ clean|--clean)
linux_compat)
linux_compat
;;
bastillebsd_update)
bastille_core_update
;;
esac
while getopts ":ospruxUvgtZh" option; do

View File

@@ -90,6 +90,24 @@ if ($_POST) {
endif;
endif;
if(isset($_POST['update']) && $_POST['update']):
$cmd = sprintf('%1$s/bastille-init bastillebsd_update > %2$s',$rootfolder,$logevent);
$return_val = 0;
$output = [];
exec($cmd,$output,$return_val);
if($return_val == 0):
ob_start();
include("{$logevent}");
$ausgabe = ob_get_contents();
ob_end_clean();
$savemsg .= str_replace("\n", "<br />", $ausgabe)."<br />";
else:
$input_errors[] = gtext('An error has occurred during core update process.');
$cmd = sprintf('echo %s: %s An error has occurred during core update process. >> %s',$date,$application,$logfile);
exec($cmd);
endif;
endif;
// Remove only extension related files during cleanup.
if (isset($_POST['uninstall']) && $_POST['uninstall']) {
if(isset($_POST['delete_confirm']) && $_POST['delete_confirm']):
@@ -335,6 +353,7 @@ $(document).ready(function(){
<div id="submit">
<input id="save" name="save" type="submit" class="formbtn" title="<?=gtext("Save settings");?>" value="<?=gtext("Save");?>"/>
<input name="upgrade" type="submit" class="formbtn" title="<?=gtext("Upgrade Extension and Bastille Packages");?>" value="<?=gtext("Upgrade");?>" />
<input name="update" type="submit" class="formbtn" title="<?=gtext("Always Update Bastille Core Package Only");?>" value="<?=gtext("Update");?>" />
<input name="restore" type="submit" class="formbtn" title="<?=gtext("Restore a container");?>" value="<?=gtext("Restore");?>" />
</div>
<div id="remarks">

View File

@@ -1 +1 @@
1.1.05
1.1.06