mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 06:20:08 +01:00
auto update of scripts/bootstrapit_update.sh
This commit is contained in:
parent
1129de0beb
commit
578f8bb6ee
1 changed files with 22 additions and 17 deletions
|
|
@ -3,8 +3,16 @@
|
||||||
set -Ee -o pipefail;
|
set -Ee -o pipefail;
|
||||||
shopt -s extglob nocasematch;
|
shopt -s extglob nocasematch;
|
||||||
|
|
||||||
md5sum=$(which md5sum || which md5)
|
if [[ -f ${PROJECT_DIR}/.git/config ]]; then
|
||||||
|
OLD_PWD=${PWD}
|
||||||
|
cd ${PROJECT_DIR};
|
||||||
|
if [[ $( git diff -s --exit-code || echo $? ) -gt 0 ]]; then
|
||||||
|
echo "ABORTING!: Your repo has local changes which are not comitted."
|
||||||
|
echo "To avoid overwriting these changes, please commit your changes."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
cd $OLD_PWD;
|
||||||
|
fi
|
||||||
|
|
||||||
BOOTSTRAPIT_GIT_URL="https://gitlab.com/mbarkhau/bootstrapit.git/"
|
BOOTSTRAPIT_GIT_URL="https://gitlab.com/mbarkhau/bootstrapit.git/"
|
||||||
|
|
||||||
|
|
@ -21,6 +29,8 @@ else
|
||||||
cd $OLD_PWD;
|
cd $OLD_PWD;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
md5sum=$(which md5sum || which md5)
|
||||||
|
|
||||||
old_md5=$( cat $PROJECT_DIR/scripts/bootstrapit_update.sh | $md5sum );
|
old_md5=$( cat $PROJECT_DIR/scripts/bootstrapit_update.sh | $md5sum );
|
||||||
new_md5=$( cat $BOOTSTRAPIT_GIT_PATH/scripts/bootstrapit_update.sh | $md5sum );
|
new_md5=$( cat $BOOTSTRAPIT_GIT_PATH/scripts/bootstrapit_update.sh | $md5sum );
|
||||||
|
|
||||||
|
|
@ -28,6 +38,8 @@ if [[ $old_md5 != $new_md5 ]]; then
|
||||||
# Copy the updated file, run it and exit the current execution.
|
# Copy the updated file, run it and exit the current execution.
|
||||||
cp "${BOOTSTRAPIT_GIT_PATH}/scripts/bootstrapit_update.sh" \
|
cp "${BOOTSTRAPIT_GIT_PATH}/scripts/bootstrapit_update.sh" \
|
||||||
"${PROJECT_DIR}/scripts/";
|
"${PROJECT_DIR}/scripts/";
|
||||||
|
git add "${PROJECT_DIR}/scripts/bootstrapit_update.sh";
|
||||||
|
git commit --no-verify -m "auto update of scripts/bootstrapit_update.sh"
|
||||||
source "${PROJECT_DIR}/scripts/bootstrapit_update.sh";
|
source "${PROJECT_DIR}/scripts/bootstrapit_update.sh";
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
|
@ -140,7 +152,7 @@ if [[ -z $COPYRIGHT_STRING ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $IS_PUBLIC ]]; then
|
if [[ -z $IS_PUBLIC ]]; then
|
||||||
IS_PUBLIC=$( echo $GIT_REPO_DOMAIN | grep -c -E '(gitlab\.com|github\.com|bitbucket\.org)' );
|
IS_PUBLIC=$( echo $GIT_REPO_DOMAIN | grep -c -E '(gitlab\.com|github\.com|bitbucket\.org)' || true );
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $PAGES_DOMAIN ]]; then
|
if [[ -z $PAGES_DOMAIN ]]; then
|
||||||
|
|
@ -185,22 +197,15 @@ fi
|
||||||
GIT_REPO_PATH=$( echo "${GIT_REPO_URL}" | sed -E -e 's;https?://[^/]+/;;g' | sed -E 's;(/|.git)$;;g' )
|
GIT_REPO_PATH=$( echo "${GIT_REPO_URL}" | sed -E -e 's;https?://[^/]+/;;g' | sed -E 's;(/|.git)$;;g' )
|
||||||
GIT_REPO_NAME=$( echo "${GIT_REPO_PATH}" | sed -E -e 's;^[A-Za-z_-]+/;;g' )
|
GIT_REPO_NAME=$( echo "${GIT_REPO_PATH}" | sed -E -e 's;^[A-Za-z_-]+/;;g' )
|
||||||
|
|
||||||
if [[ -f ${PROJECT_DIR}/.git/config ]]; then
|
if [[ $LICENSE_ID =~ "none" ]]; then
|
||||||
OLD_PWD=${PWD}
|
echo $COPYRIGHT_STRING > $PROJECT_DIR/LICENSE;
|
||||||
cd ${PROJECT_DIR};
|
else
|
||||||
if [[ $( git diff -s --exit-code || echo $? ) -gt 0 ]]; then
|
cat $LICENSE_TXT_FILE \
|
||||||
echo "ABORTING!: Your repo has local changes which are not comitted."
|
| sed "s/Copyright (c) <year> <owner>[[:space:]]*/Copyright (c) $YEAR $AUTHOR_NAME ($AUTHOR_CONTACT)/g" \
|
||||||
echo "To avoid overwriting these changes, please commit your changes."
|
| sed "s/Copyright (c) <year> <copyright holders>[[:space:]]*/Copyright (c) $YEAR $AUTHOR_NAME ($AUTHOR_CONTACT)/g" \
|
||||||
exit 1;
|
> $PROJECT_DIR/LICENSE;
|
||||||
fi
|
|
||||||
cd $OLD_PWD;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $LICENSE_TXT_FILE \
|
|
||||||
| sed "s/Copyright (c) <year> <owner>[[:space:]]*/Copyright (c) $YEAR $AUTHOR_NAME ($AUTHOR_CONTACT)/g" \
|
|
||||||
| sed "s/Copyright (c) <year> <copyright holders>[[:space:]]*/Copyright (c) $YEAR $AUTHOR_NAME ($AUTHOR_CONTACT)/g" \
|
|
||||||
> $PROJECT_DIR/LICENSE;
|
|
||||||
|
|
||||||
function format_template()
|
function format_template()
|
||||||
{
|
{
|
||||||
cat $1 \
|
cat $1 \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue