RcloneBrowser: rclone-browser should not prompt for the config password if RCLONE_PASSWORD_COMMAND is set

rclone-browser should not prompt for the config password if RCLONE_PASSWORD_COMMAND environment variable is set. rclone will use that command to get the configuration password (https://rclone.org/docs/#configuration-encryption)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 30 (14 by maintainers)

Commits related to this issue

Most upvoted comments

BTW, if you want smart quotes processing you can use a trick like this and let bash to deal with all that jazz:

bash -c 'exec "$@"' bash the-rest-of-the-desired-command-line

The second bash is just a $0 for the exec "$@" script. You can put anything there.

For example:

bash -c 'exec "$@"' bash /usr/bin/rclone listremotes --long --password-command="pass rclone/config" or bash -c 'exec "$@"' bash /usr/local/bin/rclone listremotes --long --password-command 'pass "my rclone/config"'

This would also help with setting proper environment for the process using bash rules. Mac OS GUI applications are running in the minimal environment that does not include stuff from ~/.bashrc and/or ${BASH_ENV} so I have to use full paths in the rclone default options for the Mac version of the rclone-browser.

Play with it.

Phew! After some debugging (Linux) I found that this works:

    // --option-1 --option-2="arg1 arg2" --option-3 "arg3 arg4"
    // should generate "--option-1" "--option-2=arg1 arg2" "--option-3" "arg3 arg4"
    for (QString arg : defaultRcloneOptions.split(QRegExp(" (?=[^\"]*(\"[^\"]*\"[^\"]*)*$)"))) {
      if (!arg.isEmpty()) {
        defaultRcloneOptionsList << arg.replace("\"", "");
      }

Normally quotes are processed and removed by the shell. So rclone got the value of the --password-command parameter as "pass rclone/config" obviously, it could not find an executable "pass rclone/config".