mirror of https://github.com/octoleo/lsyncd.git
use relative paths for direct mode
This commit is contained in:
parent
5b0d266669
commit
deb425a075
|
@ -1,7 +1,7 @@
|
||||||
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
-- default-direct.lua
|
-- default-direct.lua
|
||||||
--
|
--
|
||||||
-- Keeps two directories with /bin/cp, /bin/rm and /bin/mv in sync.
|
-- Keeps two directories with cp, rm and mv in sync.
|
||||||
-- Startup still uses rsync tough.
|
-- Startup still uses rsync tough.
|
||||||
--
|
--
|
||||||
-- A (Layer 1) configuration.
|
-- A (Layer 1) configuration.
|
||||||
|
@ -61,7 +61,7 @@ direct.action = function(inlet)
|
||||||
if event.isdir then
|
if event.isdir then
|
||||||
spawn(
|
spawn(
|
||||||
event,
|
event,
|
||||||
'/bin/mkdir',
|
'mkdir',
|
||||||
'--',
|
'--',
|
||||||
event.targetPath
|
event.targetPath
|
||||||
)
|
)
|
||||||
|
@ -69,7 +69,7 @@ direct.action = function(inlet)
|
||||||
-- 'cp -t', not supported on OSX
|
-- 'cp -t', not supported on OSX
|
||||||
spawn(
|
spawn(
|
||||||
event,
|
event,
|
||||||
'/bin/cp',
|
'cp',
|
||||||
'-p',
|
'-p',
|
||||||
'--',
|
'--',
|
||||||
event.sourcePath,
|
event.sourcePath,
|
||||||
|
@ -81,7 +81,7 @@ direct.action = function(inlet)
|
||||||
error("Do not know how to handle 'Modify' on dirs")
|
error("Do not know how to handle 'Modify' on dirs")
|
||||||
end
|
end
|
||||||
spawn(event,
|
spawn(event,
|
||||||
'/bin/cp',
|
'cp',
|
||||||
'-p',
|
'-p',
|
||||||
'--',
|
'--',
|
||||||
event.sourcePath,
|
event.sourcePath,
|
||||||
|
@ -104,7 +104,7 @@ direct.action = function(inlet)
|
||||||
error('Refusing to erase your harddisk!')
|
error('Refusing to erase your harddisk!')
|
||||||
end
|
end
|
||||||
|
|
||||||
spawn(event, '/bin/rm', '-rf', '--', tp)
|
spawn(event, 'rm', '-rf', '--', tp)
|
||||||
|
|
||||||
elseif event.etype == 'Move' then
|
elseif event.etype == 'Move' then
|
||||||
local tp = event.targetPath
|
local tp = event.targetPath
|
||||||
|
@ -114,13 +114,13 @@ direct.action = function(inlet)
|
||||||
error('Refusing to erase your harddisk!')
|
error('Refusing to erase your harddisk!')
|
||||||
end
|
end
|
||||||
|
|
||||||
local command = '/bin/mv -- "$1" "$2" || /bin/rm -rf -- "$1"'
|
local command = 'mv -- "$1" "$2" || rm -rf -- "$1"'
|
||||||
|
|
||||||
if
|
if
|
||||||
config.delete ~= true and
|
config.delete ~= true and
|
||||||
config.delete ~= 'running'
|
config.delete ~= 'running'
|
||||||
then
|
then
|
||||||
command = '/bin/mv -- "$1" "$2"'
|
command = 'mv -- "$1" "$2"'
|
||||||
end
|
end
|
||||||
|
|
||||||
spawnShell(
|
spawnShell(
|
||||||
|
|
Loading…
Reference in New Issue