refcodes-batch.0.3.0.source-code.configure-folder-over-ssh-client.job Maven / Gradle / Ivy
#!/bin/bash
if [[ $HELP = y ]] ; then
echo "The switch \"-j $JOB\" configures a SSH client side folder " >&2
echo "for use with SSH. The folder's owner is set to the SSH client's filesystem user." >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
fi
. $SCRIPT_DIR/validate-folder-config.job
. $SCRIPT_DIR/validate-ssh-config.job
if [[ $HELP = y ]] ; then
exit $EXIT_SUCCESS
fi
exitOnConfigOff "FOLDER"
exitOnConfigOff "SSH"
if [[ $VERBOSE = y ]] ; then
echo "Assuming the path \"$FOLDER_DIR\" to exist ..." >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
fi
exitOnMissingPropertyPath "FOLDER_DIR"
if [[ $VERBOSE = y ]] ; then
echo "Configuring \"$FOLDER_DIR\" ..." >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
fi
chown $SSH_CLIENT_FS_USER $FOLDER_DIR
exitOnError "Unable to change owner to \"$SSH_CLIENT_FS_USER\" for \"$FOLDER_DIR\" !!!"
chmod u+rw $FOLDER_DIR
exitOnError "Unable to change access rights for \"$FOLDER_DIR\" !!!"
showSuccess "Configured SSH client folder for \"$FOLDER_DIR\" !"