Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paths to find , gfind and rsync binaries are hard coded in the script, missing -printf option #32

Open
FelixLeo opened this issue Jun 11, 2017 · 1 comment

Comments

@FelixLeo
Copy link

FelixLeo commented Jun 11, 2017

First let me thank you for putting together this script as there are very few tools for devices with embed Linux OS like NAS or Openwrt routers which don't have sufficient resources as normal Linux distros .
I gave a try to sync my NAS with my openwrt router which has external disk connected to it.
Immediately I notice that I bumped in the issue of hard coded binary references in the script.
As on my NAS where the script is running the paths are the following ones:

Linux 2.6.12.6-VENUS mips GNU/Linux

/tmp/usbmounts/sda1/root # which python3
/opt/bin/python3
/tmp/usbmounts/sda1/root # which find
/opt/bin/find
/tmp/usbmounts/sda1/root # which rsync
/opt/bin/rsync

My router with Opewrt Barrier Braker on it:
Linux 3.10.49 mips GNU/Linux

root@DIR:~# which rsync
/usr/bin/rsync

root@DIR:~# which find
/usr/bin/find

Resulting with EM: remote find not found

I think it would be a nice approach to modify the script so that it runs:
which find
which rsync
which gfind
and use the results to assign the full paths for this binaries to the corresponding variables
or if they don't exist to throw the proper EM to ask user to install namely the missing package(s).
I also did notice that the
find provided by the openwrt busybox doesn't recognize the parameter -printf

find: unrecognized: -printf
BusyBox v1.22.1 (2015-03-28 06:57:02 CET) multi-call binary.

Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]

Search for files and perform actions on them.
First failed action stops processing of current file.
Defaults: PATH is current directory, action is '-print'

    -L,-follow      Follow symlinks
    -H              ...on command line only
    -xdev           Don't descend directories on other filesystems
    -maxdepth N     Descend at most N levels. -maxdepth 0 applies
                    actions to command line arguments only
    -mindepth N     Don't act on first N levels
    -depth          Act on directory *after* traversing it

Actions:
( ACTIONS ) Group actions for -o / -a
! ACT Invert ACT's success/failure
ACT1 [-a] ACT2 If ACT1 fails, stop, else do ACT2
ACT1 -o ACT2 If ACT1 succeeds, stop, else do ACT2
Note: -a has higher priority than -o
-name PATTERN Match file name (w/o directory name) to PATTERN
-iname PATTERN Case insensitive -name
-path PATTERN Match path to PATTERN
-ipath PATTERN Case insensitive -path
-regex PATTERN Match path to regex PATTERN
-type X File type is X (one of: f,d,l,b,c,...)
-perm MASK At least one mask bit (+MASK), all bits (-MASK),
or exactly MASK bits are set in file's mode
-mtime DAYS mtime is greater than (+N), less than (-N),
or exactly N days in the past
-user NAME/ID File is owned by given user
-group NAME/ID File is owned by given group
-size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.))
+/-N: file size is bigger/smaller than N
-prune If current file is directory, don't descend into it
If none of the following actions is specified, -print is assumed
-print Print file name
-print0 Print file name, NUL terminated
-exec CMD ARG ; Run CMD with all instances of {} replaced by
file name. Fails if CMD exits with nonzero

But openwrt has separate command

root@DIR:~# printf
ash: usage: printf FORMAT [ARGUMENT...]

Any way to do the same task via it?
Thanks you.

@FelixLeo FelixLeo changed the title at least calls to find and rsync binaries are hard coded in the script at least calls to find , gfind and rsync binaries are hard coded in the script Jun 11, 2017
@FelixLeo FelixLeo changed the title at least calls to find , gfind and rsync binaries are hard coded in the script Paths to find , gfind and rsync binaries are hard coded in the script Jun 11, 2017
@FelixLeo FelixLeo changed the title Paths to find , gfind and rsync binaries are hard coded in the script Paths to find , gfind and rsync binaries are hard coded in the script, missing -printf option Jun 11, 2017
@dooblem
Copy link
Owner

dooblem commented Mar 4, 2019

Hello @FelixLeo

First sorry for the late answer.

What error are you getting? bsync already has some code to detect those binaries and tell you to install them if necessary.

As for openwrt, sorry but GNU find is a hard requirement to run bsync. It should tell you though if you have not the proper find installed.

Looking to that, you may install gnu find in openwrt (at least in the last versions): https://openwrt.org/packages/pkgdata/findutils-find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants