#!/usr/bin/env bash # klevstul :: 26.04 this_file_name=`basename "$0"` echo "$this_file_name" # source config file src_file=/home/${USER}/syncDir/secrets/rclone/rclone.conf if ! [[ -f ${src_file} ]]; then echo "error: non-existing file '${src_file}'" >&2; exit 1 fi # target directory trg_dir=/home/${USER}/.config/rclone if ! [[ -d "$trg_dir" ]]; then echo "creating non-existing target dir '${trg_dir}'." mkdir -p ${trg_dir} fi # copy from source to target if source does not exist files=$(shopt -s nullglob dotglob; echo ${trg_dir}/*.conf) if (( ${#files} )) then echo "*.conf file(s) already exist in ${trg_dir}" else echo "deploy .conf file(s)" cp ${src_file} ${trg_ssh_dir} fi ls -al ${trg_dir}