#708 Issue closed: Have '/mnt/local' in a global variable.

Labels: enhancement, cleanup, fixed / solved / done

jsmeix opened issue at 2015-11-23 10:09:

Currently '/mnt/local' is hardcoded at many places in the code.

I think it would be better to have a global variable like

RECOVERY_SYSTEM_ROOT="/mnt/local"

in usr/share/rear/conf/default.conf

Cf. https://github.com/rear/rear/issues/678

gdha commented at 2015-11-23 10:45:

@jsmeix +1

jsmeix commented at 2015-11-23 11:09:

I will implement it carefully step by step.

I cannot simply replace all '/mnt/local' by '$RECOVERY_SYSTEM_ROOT' in an automated way (e.g. via "sed") because I need to carefully check that each $RECOVERY_SYSTEM_ROOT is correctly replaced by its value.

E.g.

echo 'command with /mnt/local in it' >> "$LAYOUT_CODE"

currently works as intended while

echo 'command with $RECOVERY_SYSTEM_ROOT in it' >> "$LAYOUT_CODE"

does no longer work.

jsmeix commented at 2015-11-23 11:17:

FYI:
It appears only with leading '/' but with and without trailing '/':

github/rear $ find * | xargs grep 'mnt/local' | wc -l
245
github/rear $ find * | xargs grep '/mnt/local' | wc -l
245
github/rear $ find * | xargs grep '/mnt/local/' | wc -l
128
github/rear $ find * | xargs grep -l '/mnt/local' | wc -l
62

245 places isn't too hard to change manually - but those are spread over 62 files...

jsmeix commented at 2015-11-23 12:12:

I think the variable name RECOVERY_FS_ROOT is better
than RECOVERY_SYSTEM_ROOT because it means
the root of the filesystem tree of the to-be-recovered-system
and not the root filesystem of the recovery system.

jsmeix commented at 2015-11-24 16:40:

Of course https://github.com/rear/rear/pull/710 is not yet
the final solution - but it should be a first working step
(at least "rear mkbackup" and "rear recover" still works for me).

jsmeix commented at 2015-12-15 13:13:

Via https://github.com/rear/rear/pull/740 I would like to rename RECOVERY_FS_ROOT into TARGET_FS_ROOT.

I felt always unhappy with the name RECOVERY_FS_ROOT
but somehow I had no better idea how to call what it actually is.

During https://github.com/rear/rear/issues/732 I noticed that
the name RECOVERY_FS_ROOT is really misleading.

I would very much appreciate it if the rear upstream authors
would agree to rename it into TARGET_FS_ROOT.

In particular because when the next rear version is released
such a rename would be much more annoying.

gdha commented at 2016-02-10 15:54:

@jsmeix I think this can be closed, no?

jsmeix commented at 2016-02-11 10:41:

What we have is TARGET_FS_ROOT as global readonly variable
that is set to "/mnt/local" (in usr/sbin/rear).
That part is done.

But:
What we do not have is the currently 221 lines fixed in 60 scripts
that still contain hardcoded "/mnt/local..." strings, see my above
https://github.com/rear/rear/issues/708#issuecomment-158906275

But there is no bug with the current situation
of course provided nobody changes the
TARGET_FS_ROOT value in usr/sbin/rear ;-)

Accordingly I changed the milestone from Rear v1.18
to the uspecified "Rear future".

jsmeix commented at 2016-02-15 15:07:

In https://github.com/rear/rear/pull/775 I replaced all hardcoded /mnt/local with $TARGET_FS_ROOT

When this pull request is accepted there is no longer any hardcoded /mnt/local in the scripts (except when it is set in usr/sbin/rear and in a few comments) and this issue here can be finally closed.

jsmeix commented at 2016-02-16 10:16:

With https://github.com/rear/rear/pull/775 this issue should be fixed (provided I did not cause any regressions).


[Export of Github issue for rear/rear.]