kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
900 stars 79 forks source link

Call /bin/bash instead of /bin/sh #49

Closed jph76 closed 6 years ago

jph76 commented 6 years ago

btrfs-balance etc. call /bin/sh, therefore, [ "$FS" == "btrfs" ] in btrfsmaintenance-functions line 76 will not work.

Fix: call /bin/bash

eku commented 6 years ago

[ "$FS" = "btrfs" ] works with standard shell.

jph76 commented 6 years ago

On Debian, standard shell /bin/sh is dash where [ "$FS" = "btrfs" ] won’t work.

eku commented 6 years ago

@jph76 AFAIK dash is POSIX compliant and the above mentioned way to compare strings is the POSIX way. See also https://wiki.ubuntu.com/DashAsBinSh

kdave commented 6 years ago

The = is already used in several places so if you haven't observed any problems, I assume it works under dash too. There are no advanced shell tricks used so sh should be sufficient.

jph76 commented 6 years ago

Now it works like a charm. Thanks!