make our dest dir if it does not exist already

This commit is contained in:
Aaron Bieber 2019-10-10 07:50:39 -06:00
parent c5144faf96
commit 22ed04f2b7
Signed by: qbit
GPG Key ID: 279160AB1BE1236B

View File

@ -170,14 +170,17 @@ V=$(expand_v)
if [ -f ./files ]; then
msg 0 "installing $(wc -l files | awk '{print $1 " " $2}')"
for file in $(cat files); do
local _src _dest _mode _owner _group
local _src _dest _mode _owner _group _dir
read _src _owner _group _mode _dest <<EOF
$(echo $file | sed 's/:/ /g')
EOF
_dir=$(dirname $_dest)
msg 1 "\t${_src} -> ${_dest}"
msg 2 "\t\tmkdir -p ${_dir}"
msg 2 "\t\tchown ${_owner}:${_group} $_dest"
msg 2 "\t\tchmod ${_mode} $_dest"
_ssh ${RUN_USER}@${SERVER} "mkdir -p ${_dir}"
_scp $_src "${RUN_USER}@${SERVER}:$_dest"
_ssh ${RUN_USER}@${SERVER} "/sbin/chown ${_owner}:${_group} \
$_dest; /bin/chmod ${_mode} $_dest"