backup.pl: Fix Bug13799 - addon restore not working

Message ID 20241220100405.73336-1-adolf.belka@ipfire.org
State New
Headers
Series backup.pl: Fix Bug13799 - addon restore not working |

Commit Message

Adolf Belka Dec. 20, 2024, 10:04 a.m. UTC
  - This fixes the existence check for the addon .ipf file from a check of existence
   of a directory to a check of existence of a file.

Suggested-by: Bernhard Bitsch <bbitsch@ipfire.org>
Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
Fixes: Bug13799
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/backup/backup.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bernhard Bitsch Dec. 20, 2024, 10:55 a.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>

On 20.12.24 11:04, Adolf Belka <adolf.belka@ipfire.org> wrote:
> - This fixes the existence check for the addon .ipf file from a check of existence
>     of a directory to a check of existence of a file.
> 
> Suggested-by: Bernhard Bitsch <bbitsch@ipfire.org>
> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
> Fixes: Bug13799
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
>   config/backup/backup.pl | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/config/backup/backup.pl b/config/backup/backup.pl
> index 3b10b8707..b618576e1 100644
> --- a/config/backup/backup.pl
> +++ b/config/backup/backup.pl
> @@ -285,7 +285,7 @@ make_addon_backup() {
>   restore_addon_backup() {
>   	local name="${1}"
>   
> -	if [ -d "/tmp/${name}.ipf" ]; then
> +	if [ -e "/tmp/${name}.ipf" ]; then
>   		mv "/tmp/${name}.ipf" "/var/ipfire/backup/addons/backup/${name}.ipf"
>   	fi
>   
>
  

Patch

diff --git a/config/backup/backup.pl b/config/backup/backup.pl
index 3b10b8707..b618576e1 100644
--- a/config/backup/backup.pl
+++ b/config/backup/backup.pl
@@ -285,7 +285,7 @@  make_addon_backup() {
 restore_addon_backup() {
 	local name="${1}"
 
-	if [ -d "/tmp/${name}.ipf" ]; then
+	if [ -e "/tmp/${name}.ipf" ]; then
 		mv "/tmp/${name}.ipf" "/var/ipfire/backup/addons/backup/${name}.ipf"
 	fi