#2063 PR merged: to avoid confusing in mkrescue run we do not print using archive #1363

Labels: enhancement

gdha opened issue at 2019-03-01 12:27:

Signed-off-by: Gratien D'haese gratien.dhaese@gmail.com

  • Type: Enhancement

  • Impact: Low

  • Reference to related issue (URL): #1363

  • How was this pull request tested? at the customer side

  • Brief description of the changes in this pull request: when the WORKFLOW=mkrescue we immediately return from script prep/NETFS/default/070_set_backup_archive.sh

jsmeix commented at 2019-03-04 10:15:

As far as I see in prep/NETFS/default/070_set_backup_archive.sh
the following variables are set that are needed in other scripts:

backuparchive
RESTORE_ARCHIVES
BACKUP_PROG_CREATE_NEWER_OPTIONS

According to

# for w in $( ls usr/share/rear/lib/*-workflow* | cut -s -d'/' -f5 | cut -s -d '-' -f1 ) ; do echo -n "$w " ; usr/sbin/rear -s $w | grep '070_set_backup_archive.sh' || echo "no 070_set_backup_archive.sh called" ; done

checklayout no 070_set_backup_archive.sh called
dump no 070_set_backup_archive.sh called
finalizeonly no 070_set_backup_archive.sh called
format no 070_set_backup_archive.sh called
help no 070_set_backup_archive.sh called
layoutonly no 070_set_backup_archive.sh called
mkbackup Source prep/NETFS/default/070_set_backup_archive.sh
mkbackuponly Source prep/NETFS/default/070_set_backup_archive.sh
mkopalpba no 070_set_backup_archive.sh called
mkrescue Source prep/NETFS/default/070_set_backup_archive.sh
opaladmin no 070_set_backup_archive.sh called
recover Source verify/NETFS/default/070_set_backup_archive.sh
restoreonly Source verify/NETFS/default/070_set_backup_archive.sh
savelayout no 070_set_backup_archive.sh called
shell no 070_set_backup_archive.sh called
udev no 070_set_backup_archive.sh called
validate no 070_set_backup_archive.sh called

prep/NETFS/default/070_set_backup_archive.sh
is called in the following workflows

mkbackup
mkbackuponly
mkrescue
recover
restoreonly

Now I ty to find out in which scripts of those workflows those variables
are used:

# for w in mkbackup mkbackuponly mkrescue recover restoreonly ; do for v in RESTORE_ARCHIVES BACKUP_PROG_CREATE_NEWER_OPTIONS backuparchive ; do for s in $( usr/sbin/rear -s $w | grep '^Source ' | cut -s -d ' ' -f2 ) ; do grep -q "$v" usr/share/rear/$s && echo In workflow $w the variable $v is used in $s ; done ; done ; done

In workflow mkbackup the variable RESTORE_ARCHIVES is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackup the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackup the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in backup/NETFS/default/500_make_backup.sh
In workflow mkbackup the variable backuparchive is used in prep/NETFS/default/050_check_NETFS_requirements.sh
In workflow mkbackup the variable backuparchive is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackup the variable backuparchive is used in output/ISO/Linux-i386/810_prepare_multiple_iso.sh
In workflow mkbackup the variable backuparchive is used in backup/NETFS/default/500_make_backup.sh
In workflow mkbackuponly the variable RESTORE_ARCHIVES is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackuponly the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackuponly the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in backup/NETFS/default/500_make_backup.sh
In workflow mkbackuponly the variable backuparchive is used in prep/NETFS/default/050_check_NETFS_requirements.sh
In workflow mkbackuponly the variable backuparchive is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkbackuponly the variable backuparchive is used in backup/NETFS/default/500_make_backup.sh
In workflow mkrescue the variable RESTORE_ARCHIVES is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable backuparchive is used in prep/NETFS/default/050_check_NETFS_requirements.sh
In workflow mkrescue the variable backuparchive is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable backuparchive is used in output/ISO/Linux-i386/810_prepare_multiple_iso.sh
In workflow recover the variable RESTORE_ARCHIVES is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow recover the variable RESTORE_ARCHIVES is used in verify/NETFS/default/550_check_backup_archive.sh
In workflow recover the variable RESTORE_ARCHIVES is used in restore/NETFS/default/400_restore_backup.sh
In workflow recover the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow recover the variable backuparchive is used in verify/NETFS/default/050_check_NETFS_requirements.sh
In workflow recover the variable backuparchive is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow recover the variable backuparchive is used in verify/NETFS/default/550_check_backup_archive.sh
In workflow recover the variable backuparchive is used in restore/NETFS/default/380_prepare_multiple_isos.sh
In workflow recover the variable backuparchive is used in restore/NETFS/default/400_restore_backup.sh
In workflow restoreonly the variable RESTORE_ARCHIVES is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow restoreonly the variable RESTORE_ARCHIVES is used in verify/NETFS/default/550_check_backup_archive.sh
In workflow restoreonly the variable RESTORE_ARCHIVES is used in restore/NETFS/default/400_restore_backup.sh
In workflow restoreonly the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow restoreonly the variable backuparchive is used in verify/NETFS/default/050_check_NETFS_requirements.sh
In workflow restoreonly the variable backuparchive is used in verify/NETFS/default/070_set_backup_archive.sh
In workflow restoreonly the variable backuparchive is used in verify/NETFS/default/550_check_backup_archive.sh
In workflow restoreonly the variable backuparchive is used in restore/NETFS/default/380_prepare_multiple_isos.sh
In workflow restoreonly the variable backuparchive is used in restore/NETFS/default/400_restore_backup.sh

With this change those variables are no longer set in the mkrescue workflow
so that in the above output those lines are of interest:

In workflow mkrescue the variable RESTORE_ARCHIVES is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable BACKUP_PROG_CREATE_NEWER_OPTIONS is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable backuparchive is used in prep/NETFS/default/050_check_NETFS_requirements.sh
In workflow mkrescue the variable backuparchive is used in prep/NETFS/default/070_set_backup_archive.sh
In workflow mkrescue the variable backuparchive is used in output/ISO/Linux-i386/810_prepare_multiple_iso.sh

and from those lines the following need to be checked in detail

In workflow mkrescue the variable backuparchive is used in prep/NETFS/default/050_check_NETFS_requirements.sh
In workflow mkrescue the variable backuparchive is used in output/ISO/Linux-i386/810_prepare_multiple_iso.sh

so that we need to check how the variable backuparchive is used in
prep/NETFS/default/050_check_NETFS_requirements.sh
and
output/ISO/Linux-i386/810_prepare_multiple_iso.sh

The variable backuparchive is used in
prep/NETFS/default/050_check_NETFS_requirements.sh
only in a commet

# some backup progs require a different backuparchive name

The variable backuparchive is used in
output/ISO/Linux-i386/810_prepare_multiple_iso.sh
in the following lines:

local isofs_path=$( dirname $backuparchive )
# outputs nothing if nothing matches the bash globbing pattern '$backuparchive.??'
local number_of_ISOs=$( echo -n $backuparchive.?? | wc -w )
test $number_of_ISOs -ge 1 || LogPrintError "Number of backup archive files '$backuparchive.??' is not at least 1"
test $number_of_ISOs -le 100 || LogPrint "Number of backup archive files '$backuparchive.??' exceeds 100"
backup_filename="$( basename $backuparchive.00 )"
backup_size="$( stat -c '%s' $backuparchive.00 )"
    BACKUP_NAME="$backuparchive.$iso_number"

This needs a more careful analysis whether or not
usr/share/rear/output/ISO/Linux-i386/810_prepare_multiple_iso.sh
still works o.k. when the variable backuparchive is no longer set in
usr/share/rear/prep/NETFS/default/070_set_backup_archive.sh
in case of the 'mkrescue' workflow.

gdha commented at 2019-03-04 10:41:

@jsmeix https://github.com/rear/rear/pull/2063#pullrequestreview-210063023 script usr/share/rear/output/ISO/Linux-i386/810_prepare_multiple_iso.sh should only be useful with multiple ISO backup:

and in

/usr/share/rear/conf/default.conf:ISO_MAX_SIZE=

and further:

/usr/share/rear/output/ISO/Linux-i386/810_prepare_multiple_iso.sh:test "$ISO_MAX_SIZE" || return 0
/usr/share/rear/output/ISO/Linux-i386/810_prepare_multiple_iso.sh:test "mkrescue" = "$WORKFLOW" && Error "The mkrescue workflow is forbidden when ISO_MAX_SIZE is set"

i think it is quite safe.

jsmeix commented at 2019-03-04 11:40:

@gdha
yes I see now the same in output/ISO/Linux-i386/810_prepare_multiple_iso.sh

test "$ISO_MAX_SIZE" || return 0
...
test "mkrescue" = "$WORKFLOW" && Error "The mkrescue workflow is forbidden when ISO_MAX_SIZE is set"
...
local isofs_path=$( dirname $backuparchive )

i.e. without ISO_MAX_SIZE 810_prepare_multiple_iso.sh does nothing
and with ISO_MAX_SIZE the mkrescue workflow is forbidden
so that it cannot happen that 810_prepare_multiple_iso.sh does something
(in particular that backuparchive is needed in 810_prepare_multiple_iso.sh)
when the mkrescue workflow is used.


[Export of Github issue for rear/rear.]