#2397 PR merged: Update 950_check_missing_programs.sh

Labels: bug, fixed / solved / done

jsmeix opened issue at 2020-05-14 08:54:

  • Type: Bug Fix

  • Impact: Normal

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/2206

  • How was this pull request tested?
    Works well for me.

  • Brief description of the changes in this pull request:
    When checking for required programs also test for "basename program"
    because when required programs are specified with absolute path
    those programs appears in the ReaR recovery system in /bin/
    so testing their original path would falsely fail during "rear recover"

jsmeix commented at 2020-05-14 10:11:

I tested it with

# cp /usr/sbin/partprobe /home/johannes/mypartprobe

and

REQUIRED_PROGS+=( /home/johannes/mypartprobe )

During "rear -D mkbackup" I get in the log

+ source /root/rear.github.master/usr/share/rear/init/default/950_check_missing_programs.sh
...
++ for prog in '"${REQUIRED_PROGS[@]}"'
++ has_binary /home/johannes/mypartprobe
++ for bin in '$@'
++ type /home/johannes/mypartprobe
++ return 0
++ contains_visible_char ''
+++ tr -d -c '[:graph:]'
++ test ''
++ return 0
+ source_return_code=0

and during "rear -D recover" I get in the log

+ source /usr/share/rear/init/default/950_check_missing_programs.sh
...
++ for prog in '"${REQUIRED_PROGS[@]}"'
++ has_binary /home/johannes/mypartprobe
++ for bin in '$@'
++ type /home/johannes/mypartprobe
/usr/share/rear/lib/_input-output-functions.sh: line 476: type: /home/johannes/mypartprobe: not found
++ return 1
+++ basename /home/johannes/mypartprobe
++ has_binary mypartprobe
++ for bin in '$@'
++ type mypartprobe
++ return 0
++ contains_visible_char ''
+++ tr -d -c '[:graph:]'
++ test ''
++ return 0
+ source_return_code=0

I like the /home/johannes/mypartprobe: not found notification
because it shows that inside the recovery system
one cannot call /home/johannes/mypartprobe
because inside the recovery system one would have
to call plain mypartprobe or /bin/mypartprobe.


[Export of Github issue for rear/rear.]