-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotdrop.sh
executable file
·37 lines (32 loc) · 933 Bytes
/
dotdrop.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2017, deadc0de6
# check for readlink/realpath presence
# https://github.com/deadc0de6/dotdrop/issues/6
rl="readlink -f"
if ! ${rl} "${0}" >/dev/null 2>&1; then
rl="realpath"
if ! hash ${rl}; then
echo "\"${rl}\" not found!" && exit 1
fi
fi
# setup variables
args=("$@")
cur=$(dirname "$(${rl} "${0}")")
opwd=$(pwd)
cfg="${cur}/config.yaml"
sub="dotdrop"
# pivot
cd "${cur}" || { echo "Directory \"${cur}\" doesn't exist, aborting." && exit 1; }
# init/update the submodule
if [ "${DOTDROP_AUTOUPDATE-yes}" = yes ] ; then
git submodule update --init --recursive
git submodule update --remote dotdrop
fi
# launch dotdrop
PYTHONPATH=dotdrop python3 -m dotdrop.dotdrop "${args[@]}"
ret="$?"
# pivot back
cd "${opwd}" || { echo "Directory \"${opwd}\" doesn't exist, aborting." && exit 1; }
# exit with dotdrop exit code
exit ${ret}