refcodes-batch.1.0.2.source-code.configure-folder-over-ssh-server.job Maven / Gradle / Ivy
#!/bin/bash
if [[ $HELP = y ]] ; then
echo "The switch \"-j $JOB\" configures a SSH server side folder " >&2
echo "for use with SSH. The folder's owner is set to the SSH server'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_SERVER_FS_USER $FOLDER_DIR
exitOnError "Unable to change owner to \"$SSH_SERVER_FS_USER\" for \"$FOLDER_DIR\" !!!"
chmod u+rw $FOLDER_DIR
exitOnError "Unable to change access rights for \"$FOLDER_DIR\" !!!"
showSuccess "Configured SSH server folder for \"$FOLDER_DIR\" !"