mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Handle directories as destination paths. Fixes #294.
This commit is contained in:
parent
fdc48ee6bf
commit
65f1f63c81
1 changed files with 16 additions and 0 deletions
|
@ -1170,6 +1170,14 @@ copyfile() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# If the destination is a directory, let's make it a full path so the logic
|
||||
# below works as expected
|
||||
if [ -d "$dfile" ]; then
|
||||
echodebug "The passed destination($dfile) is a directory"
|
||||
dfile="${dfile}/$(basename $sfile)"
|
||||
echodebug "Full destination path is now: $dfile"
|
||||
fi
|
||||
|
||||
if [ ! -f "$dfile" ]; then
|
||||
# The destination file does not exist, copy
|
||||
echodebug "Copying $sfile to $dfile"
|
||||
|
@ -1218,6 +1226,14 @@ movefile() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# If the destination is a directory, let's make it a full path so the logic
|
||||
# below works as expected
|
||||
if [ -d "$dfile" ]; then
|
||||
echodebug "The passed destination($dfile) is a directory"
|
||||
dfile="${dfile}/$(basename $sfile)"
|
||||
echodebug "Full destination path is now: $dfile"
|
||||
fi
|
||||
|
||||
if [ ! -f "$dfile" ]; then
|
||||
# The destination file does not exist, copy
|
||||
echodebug "Moving $sfile to $dfile"
|
||||
|
|
Loading…
Add table
Reference in a new issue