diff --git a/make/scripts/update_copyright_year.sh b/make/scripts/update_copyright_year.sh index bb61d48c91c..578ab4cbc99 100644 --- a/make/scripts/update_copyright_year.sh +++ b/make/scripts/update_copyright_year.sh @@ -1,7 +1,7 @@ #!/bin/bash -f # -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -41,10 +41,6 @@ set -e # To allow total changes counting shopt -s lastpipe -# Get an absolute path to this script, since that determines the top-level directory. -this_script_dir=`dirname $0` -this_script_dir=`cd $this_script_dir > /dev/null && pwd` - # Temp area tmp=/tmp/`basename $0`.${USER}.$$ rm -f -r ${tmp} @@ -98,10 +94,16 @@ while getopts "c:fhy:" option; do done # VCS check +git_installed=false +which git > /dev/null && git_installed=true +if [ "$git_installed" != "true" ]; then + echo "Error: This script requires git. Please install it." + exit 1 +fi git_found=false -[ -d "${this_script_dir}/../../.git" ] && git_found=true +git status &> /dev/null && git_found=true if [ "$git_found" != "true" ]; then - echo "Error: Please execute script from within make/scripts." + echo "Error: Please execute script from within a JDK git repository." exit 1 else echo "Using Git version control system"