btrbk: Prefix PATH instead of resetting it.

Some distros (notably NixOS) don't even use /usr/bin, /sbin, etc.
Instead, they use PATH to specify which programs are available to a
given executable.

This patch changes the behavior or `btrbk` so it extends PATH with its
own search paths instead of resetting it. This allows users and distros
to specify their own custom location for `btrfs` via `PATH`.
pull/74/head
Moritz Ulrich 2016-03-18 14:01:22 +01:00
parent c2b11775a0
commit 07a9975dd3
1 changed files with 5 additions and 4 deletions

9
btrbk
View File

@ -2464,10 +2464,11 @@ sub exit_status
MAIN: MAIN:
{ {
# set PATH instead of using absolute "/sbin/btrfs" (for now), as # Prefix PATH with /sbin etc. instead of using absolute
# different distros (and even different versions of btrfs-progs) # "/sbin/btrfs" (for now), as different distros (and even different
# install the "btrfs" executable to different locations. # versions of btrfs-progs) install the "btrfs" executable to
$ENV{PATH} = '/sbin:/bin:/usr/sbin:/usr/bin'; # different locations.
$ENV{PATH} .= '/sbin:/bin:/usr/sbin:/usr/bin';
Getopt::Long::Configure qw(gnu_getopt); Getopt::Long::Configure qw(gnu_getopt);
$Data::Dumper::Sortkeys = 1; $Data::Dumper::Sortkeys = 1;