diff options
Diffstat (limited to 'dscip')
-rwxr-xr-x | dscip | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/dscip b/dscip index d27c9cc..99915ee 100755 --- a/dscip +++ b/dscip @@ -15,11 +15,30 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ - set -eu + +# Grab checksum of DSCIP for use with updating. +DSCIP_CKSUM="$(cksum "$0")" + cd "$(dirname "$0")" . "$(pwd -P)/config.sh" +# Checking updates +if [ "$DSCIP_AUTO_UPDATE" = "true" ]; then + . "$WORKING_DIRECTORY/update.sh" + DSCIP_NEW_CKSUM="$(cksum "$0")" + # Rerun dscip if update was found. + if [ ! "$DSCIP_CKSUM" = "$DSCIP_NEW_CKSUM" ]; then + echo "Update found. Rerunning DSCIP..." + "$SHELL" "$0" "$@" + exit 0 + else + echo "No updates found. Continuing..." + fi +else + echo "Auto updates turned off. Continuing..." +fi + ################################################################################ # Move script to background if DSCIP_DAEMON_FORK is set to true # |