1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-11 15:28:59 +00:00

Merge pull request #8 from SShrike/master

Make dotdrop.sh pass all of the ShellCheck lints
This commit is contained in:
deadc0de
2017-08-24 13:30:44 +02:00
committed by GitHub

View File

@@ -1,29 +1,31 @@
#!/bin/sh #!/usr/bin/env bash
# author: deadc0de6 (https://github.com/deadc0de6) # author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2017, deadc0de6 # Copyright (c) 2017, deadc0de6
# check for readlink/realpath presence # check for readlink/realpath presence
# https://github.com/deadc0de6/dotdrop/issues/6 # https://github.com/deadc0de6/dotdrop/issues/6
rl="readlink -f" rl="readlink -f"
${rl} ${0} >/dev/null 2>&1
if [ "$?" != "0" ]; then if ! ${rl} "${0}" >/dev/null 2>&1; then
rl="realpath" rl="realpath"
hash ${rl}
[ "$?" != "0" ] && echo "\"${rl}\" not found !" && exit 1 if ! hash ${rl}; then
echo "\"${rl}\" not found !" && exit 1
fi
fi fi
# setup variables # setup variables
args="$@" args=("$@")
cur=`dirname $(${rl} ${0})` cur=$(dirname "$(${rl} "${0}")")
opwd=`pwd` opwd=$(pwd)
bin="${cur}/dotdrop/dotdrop.py" bin="${cur}/dotdrop/dotdrop.py"
cfg="${cur}/config.yaml" cfg="${cur}/config.yaml"
# pivot # pivot
cd ${cur} cd "${cur}" || { echo "Folder \"${cur}\" doesn't exist, aborting." && exit; }
# init the submodule # init the submodule
git submodule update --init --recursive git submodule update --init --recursive
# launch dotdrop # launch dotdrop
python3 ${bin} --cfg=${cfg} $args python3 "${bin}" --cfg="${cfg}" "${args[@]}"
# pivot back # pivot back
cd ${opwd} cd "${opwd}" || { echo "Folder \"${opwd}\" doesn't exist, aborting." && exit; }