Skip to content

Commit

Permalink
Instead of putting into path in smb, cd there and put, to avoid / issues
Browse files Browse the repository at this point in the history
  • Loading branch information
deitch committed Feb 16, 2016
1 parent f4e8a56 commit 12fee0e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ else
UDOM=
fi

smbclient -N //${uri[host]}/${uri[share]} ${UPASS} ${UDOM} -c "put ${TMPDIR}/${TARGET} ${uri[sharepath]}/${TARGET}"
smbclient -N //${uri[host]}/${uri[share]} ${UPASS} ${UDOM} -c "cd ${uri[sharepath]}; put ${TMPDIR}/${TARGET} ${TARGET}"
/bin/rm ${TMPDIR}/${TARGET}
;;
esac
Expand Down
6 changes: 6 additions & 0 deletions test/smb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@
read only = no
valid users = user

[nopath]
path = /share/backups/nopath
create mask = 0755
read only = no
guest ok = yes



12 changes: 12 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ targets=(
"/backups/SEQ/data"
"file:///backups/SEQ/data"
"smb://smb/noauth/SEQ/data"
"smb://smb/nopath"
"smb://user:pass@smb/auth/SEQ/data"
"smb://CONF;user:pass@smb/auth/SEQ/data"
)
Expand Down Expand Up @@ -91,12 +92,20 @@ function runtest() {
mkdir -p /tmp/backups/${seqno}/data
echo "target: ${t2}" >> /tmp/backups/${seqno}/list

# are we working with nopath?
if [[ "$t2" =~ nopath ]]; then
rm -f /tmp/backups/nopath
ln -s ${seqno}/data /tmp/backups/nopath
fi


# if in DEBUG, make sure backup also runs in DEBUG
if [[ "$DEBUG" != "0" ]]; then
DBDEBUG="-e DB_DUMP_DEBUG=2"
else
DBDEBUG=
fi


# change our target
cid=$(docker run -d $DBDEBUG -e DB_USER=$MYSQLUSER -e DB_PASS=$MYSQLPW -e DB_DUMP_FREQ=60 -e DB_DUMP_BEGIN=+0 -e DB_DUMP_TARGET=${t2} -v /tmp/backups:/backups --link ${mysql_cid}:db --link ${smb_cid}:smb backup)
Expand All @@ -112,6 +121,9 @@ function runtest() {
#< -- Host: localhost Database:
#---
#> -- Host: db Database:
#
# so we filter those lines out; they are not relevant to the backup anyways
#
function checktest() {
t=$1
seqno=$2
Expand Down

0 comments on commit 12fee0e

Please sign in to comment.