Hi. The following is a modification into NS files that wil make available the link to download the configuration backup.
Please note that this will require you make modifications into the NS files!!
The file that must be modified are:
/sbin/e-smith/backup-config
/usr/share/nethesis/NethServer/Template/BackupConfig/Backup.php
/usr/share/nethesis/NethServer/Module/BackupConfig/Backup.php
and you must create a php file in /usr/share/nethesis/nethserver-manager/
Let’s begin
File: /sbin/e-smith/backup-config
At the end of the file modify from this
$backup->send_notification();
exit 0;
to look like this
$backup->send_notification();
system("chmod 755 /var/lib/nethserver/backup/backup-config.tar.xz");
system("ln -s /var/lib/nethserver/backup/backup-config.tar.xz /usr/share/nethesis/nethserver-manager/bkp.tar.xz");
exit 0;
then modify the file:
File: /usr/share/nethesis/NethServer/Template/BackupConfig/Backup.php
modify the file above this line:
echo "<div id='bc_module_warning' class='ui-state-highlight'><span class='ui-icon ui-icon-info'></span>".$T('backup_config_label')."</div>";
to look like this:
if ((isset($view['size'])) && ($view['size']!= '-')) {echo '<a href="../download.php?d='.$view['file_time'].'" target="_blank" >Download</a></br>'. "</br>"; };
echo "<div id='bc_module_warning' class='ui-state-highlight'><span class='ui-icon ui-icon-info'></span>".$T('backup_config_label')."</div>";
and the last file to modify:
File: /usr/share/nethesis/NethServer/Module/BackupConfig/Backup.php
under this line:
$view['date'] = date("o-m-d G:i", $this->backup['date']);
add to look like this:
$view['date'] = date("o-m-d G:i", $this->backup['date']);
$view['file_time']= date("o-m-d_H-i", $this->backup['date']);
you must create one file in the folder:
/usr/share/nethesis/nethserver-manager/
Create a new php file “download.php”.
The file should contain:
<?php
$file_name = "bkp.tar.xz";
if(isset($_GET['d'])){$file_date=$_GET['d'];}else {$file_date=date("Y-m-d_H:i", filectime($file_name));};
if (file_exists($file_name)) {
header('Cache-Control: public');
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename=' . $file_name.'_'.$file_date);
readfile($file_name);
ob_flush();
die();
} else {
die('File not found!');
};
?>
After modification when a backup file exists a Download link will apear.
I hope this helps
Best regards
Bogdan