diff options
author | David Walter Seikel | 2016-11-27 23:51:59 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-27 23:51:59 +1000 |
commit | c0ff56729a59dc30589de6af6120d825fbaa8cc3 (patch) | |
tree | 1c7e2f842548a5c9fef566d2045f3ad8aac603cb /scripts/gitAR.sh | |
parent | White space and typo clean ups. (diff) | |
download | opensim-SC-c0ff56729a59dc30589de6af6120d825fbaa8cc3.zip opensim-SC-c0ff56729a59dc30589de6af6120d825fbaa8cc3.tar.gz opensim-SC-c0ff56729a59dc30589de6af6120d825fbaa8cc3.tar.bz2 opensim-SC-c0ff56729a59dc30589de6af6120d825fbaa8cc3.tar.xz |
Break out common script bits into their own file.
Diffstat (limited to '')
-rwxr-xr-x | scripts/gitAR.sh | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/scripts/gitAR.sh b/scripts/gitAR.sh index 2a067be..25cab48 100755 --- a/scripts/gitAR.sh +++ b/scripts/gitAR.sh | |||
@@ -11,31 +11,16 @@ | |||
11 | 11 | ||
12 | # Not really meant to be called by users, so don't bother validating the input and such. | 12 | # Not really meant to be called by users, so don't bother validating the input and such. |
13 | 13 | ||
14 | source common.sh | ||
15 | getPrgDir | ||
16 | |||
14 | type=$1 | 17 | type=$1 |
15 | title=$2 | 18 | title=$2 |
16 | |||
17 | # Figure out where we are, most of this mess is to troll through soft links. | ||
18 | PRG="$0" | ||
19 | while [ -h "${PRG}" ] ; do | ||
20 | ls=$(ls -ld "${PRG}") | ||
21 | link=`expr "${ls}" : '.*-> \(.*\)$'` | ||
22 | if expr "${link}" : '.*/.*' > /dev/null; then | ||
23 | PRG="${link}" | ||
24 | else | ||
25 | PRG=$(dirname "${PRG}")/"${link}" | ||
26 | fi | ||
27 | done | ||
28 | PRGDIR=$(dirname "${PRG}") | ||
29 | pushd ${PRGDIR} >/dev/null | ||
30 | PRGDIR=$(pwd) | ||
31 | popd >/dev/null | ||
32 | |||
33 | date=$(date '+%F_%T') | 19 | date=$(date '+%F_%T') |
34 | 20 | ||
35 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. | ||
36 | name=$(echo "${title}" | sed -e 's/[\\/:\*\?"<>\|@#$%&\0\x01-\x1F\x27\x40\x60\x7F. ]/_/g' -e 's/^$/NONAME/') | ||
37 | # Convert the type to uppercase. | 21 | # Convert the type to uppercase. |
38 | gar="_git$(echo -n ${type} | tr '[:lower:]' '[:upper:]')AR" | 22 | gar="_git$(echo -n ${type} | tr '[:lower:]' '[:upper:]')AR" |
23 | name=$(sanitize "${title}") | ||
39 | 24 | ||
40 | if [ -d ${PRGDIR}/../../backups/temp_backup${type}_${name} ]; then | 25 | if [ -d ${PRGDIR}/../../backups/temp_backup${type}_${name} ]; then |
41 | echo "WARNING - Mess left over from last backup, not gonna run!" | 26 | echo "WARNING - Mess left over from last backup, not gonna run!" |