Support --force flag for 'new' PenText repositories
The --force flag allows repositories not containing the PenText repository to 'update' to the latest version of PenText.
This commit is contained in:
parent
1918cdfac5
commit
9e9ab571c8
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# pull_upstream_changes - Updates repo and applies upstream changes
|
# pull_upstream_changes - Updates repo and applies upstream changes
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 Peter Mosmans [Radically Open Security]
|
# Copyright (C) 2016-2017 Peter Mosmans [Radically Open Security]
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -19,15 +19,21 @@ SOURCEROOT="xml"
|
|||||||
|
|
||||||
|
|
||||||
## Don't change anything below this line
|
## Don't change anything below this line
|
||||||
VERSION=0.6
|
VERSION=0.7
|
||||||
|
|
||||||
source=$(dirname $(readlink -f $0))
|
source=$(dirname $(readlink -f $0))
|
||||||
|
|
||||||
|
if [ "$1" == "--force" ]; then
|
||||||
|
force=true
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
target=$1
|
target=$1
|
||||||
|
|
||||||
if [ -z "$target" ]; then
|
if [ -z "$target" ]; then
|
||||||
target=$(readlink -f .)
|
target=$(readlink -f .)
|
||||||
if [ "${target}" == "${source}" ]; then
|
if [ "${target}" == "${source}" ]; then
|
||||||
echo "Usage: pull_upstream_changes [TARGET]"
|
echo "Usage: pull_upstream_changes [--force] [TARGET]"
|
||||||
echo " or run from within target directory"
|
echo " or run from within target directory"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -36,7 +42,11 @@ fi
|
|||||||
# Check if the target actually contains the repository
|
# Check if the target actually contains the repository
|
||||||
if [ ! -z ${FINGERPRINT} ] && [ ! -d $target/dtd ]; then
|
if [ ! -z ${FINGERPRINT} ] && [ ! -d $target/dtd ]; then
|
||||||
echo "[-] ${target} does not contain the correct repository"
|
echo "[-] ${target} does not contain the correct repository"
|
||||||
|
if [ -z $force ]; then
|
||||||
exit
|
exit
|
||||||
|
else
|
||||||
|
echo "[*] --force option: continuing anyway..."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update repository
|
# Update repository
|
||||||
@ -47,7 +57,10 @@ pushd "$source" >/dev/null && git pull && popd >/dev/null
|
|||||||
echo "[*] Applying changes (if any)..."
|
echo "[*] Applying changes (if any)..."
|
||||||
for sourcefile in ${SOURCEFILES}; do
|
for sourcefile in ${SOURCEFILES}; do
|
||||||
if [ -d "${source}/${SOURCEROOT}/${sourcefile}" ]; then
|
if [ -d "${source}/${SOURCEROOT}/${sourcefile}" ]; then
|
||||||
cp -prv ${source}/${SOURCEROOT}/${sourcefile} $target/
|
if [ ! -z $force ]; then
|
||||||
|
mkdir -p ${target}/${sourcefile} 1>/dev/null
|
||||||
|
fi
|
||||||
|
cp -prv ${source}/${SOURCEROOT}/${sourcefile}/* $target/${sourcefile}/
|
||||||
else
|
else
|
||||||
cp -pv ${source}/${SOURCEROOT}/${sourcefile} $target/${sourcefile}
|
cp -pv ${source}/${SOURCEROOT}/${sourcefile} $target/${sourcefile}
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user