diff options
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!" |