From a1a826801d2b4cfdb573eb6aa624d463b6c50736 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 2 Nov 2024 20:56:54 +0100 Subject: [PATCH] Allow preparing backups --- scripts/lib/software.fish | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/lib/software.fish b/scripts/lib/software.fish index 4f75eb7b..95fc2b29 100755 --- a/scripts/lib/software.fish +++ b/scripts/lib/software.fish @@ -3,8 +3,8 @@ begin set -l dir (status dirname) set -l backupActions \ - backup backupSW backupArgs getBackupArgs restore restoreSW \ - userBackup userBackup userBackupArgs getUserBackupArgs userRestore userRestore + backup backupSW prepareBackup prepareBackup backupArgs getBackupArgs restore restoreSW \ + userBackup userBackup prepareUserBackup prepareUserBackup userBackupArgs getUserBackupArgs userRestore userRestore set -l actions \ install installSW \ @@ -17,13 +17,14 @@ begin functions -e "$actions[$i]" end - for i in (seq 1 6 (count $backupActions)) + for i in (seq 1 8 (count $backupActions)) + set -l preRun $backupActions[(math $i + 3)] set -l function $backupActions[(math $i + 1)] - set -l getArgs $backupActions[(math $i + 3)] - set -l restore $backupActions[(math $i + 5)] + set -l getArgs $backupActions[(math $i + 5)] + set -l restore $backupActions[(math $i + 7)] for functionName in $function $restore - function $functionName -V dir -V getArgs -V functionName -V restore + function $functionName -V dir -V preRun -V getArgs -V functionName -V restore set -l args if functions -q $getArgs @@ -49,6 +50,12 @@ begin source "$dir/restoration.fish" if [ "$functionName" != "$restore" ] + argparse -i "action=" -- $argv + + if functions -q "$preRun" + "$preRun" $argv + end + backupFiles $args else restoreFiles $args