1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 14:31:46 +00:00
Files
dotdrop/dotdrop.sh
2017-12-23 22:02:17 +01:00

32 lines
800 B
Bash
Executable File

#!/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 "Folder \"${cur}\" doesn't exist, aborting." && exit; }
# init/update the submodule
git submodule foreach git pull origin master
# launch dotdrop
PYTHONPATH=dotdrop python3 -m dotdrop.dotdrop --cfg="${cfg}" "${args[@]}"
# pivot back
cd "${opwd}" || { echo "Folder \"${opwd}\" doesn't exist, aborting." && exit; }