commit b0961c9820a0f2c6d0e15ce01a1f8d047091213f
parent e733074ee452b019a766a65ff7fac7a6b4662388
Author: Cem Keylan <cem@ckyln.com>
Date: Thu, 21 Nov 2019 11:02:35 +0300
add variables to the beginning, making it easier to fork
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/carbs b/carbs
@@ -16,6 +16,11 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <https://www.gnu.org/licenses/>.
+# DEFAULT VARIABLES
+DEFCARBS="git://git.ckyln.com/vcarbs" # Default CARBS Repo Location
+DEFPROGS="https://git.ckyln.com/raw/vcarbs/progs.csv" # Default PROGS.CSV link
+DEFDOTFILES="git://git.ckyln.com/vdotfiles" # Default Dotfiles Repo Location
+
# shellcheck disable=SC2048
# Messages below are taken from Arch scripts
@@ -56,7 +61,7 @@ fi
while getopts ':p::d::r:n:P::k::s:' flag; do
case $flag in
- P) curl -Lo "$OPTARG" https://git.ckyln.com/raw/vcarbs/progs.csv && exit || die 'Could not download progs.csv' ;;
+ P) curl -Lo "$OPTARG" "$DEFPROGS" && exit || die 'Could not download progs.csv' ;;
p) [ -e "$OPTARG" ] && progs="$(realpath "$OPTARG")" || die "Could not find progs.csv file" ;;
r) git ls-remote "$OPTARG" >/dev/null 2>&1 && dotfiles=$OPTARG || die "Could not find repo" ;;
d) [ -d "$OPTARG" ] && targetdir="$(realpath "$OPTARG")" || die "Target location $OPTARG does not exist or is not a directory" ;;
@@ -68,9 +73,9 @@ while getopts ':p::d::r:n:P::k::s:' flag; do
esac
done
-[ -z "$dotfiles" ] && dotfiles="git://git.ckyln.com/vdotfiles"
+[ -z "$dotfiles" ] && dotfiles="$DEFDOTFILES"
[ -z "$targetdir" ] && targetdir="$HOME"
-[ -z "$progs" ] && curl -Lo /tmp/progs.csv https://git.ckyln.com/raw/vcarbs/progs.csv && progs="/tmp/progs.csv"
+[ -z "$progs" ] && curl -Lo /tmp/progs.csv "$DEFPROGS" && progs="/tmp/progs.csv"
[ -z "$interactive" ] && interactive=1
[ "$interactive" = "0" ] && [ -z "$XK" ] && XK="us"
@@ -197,7 +202,7 @@ postinstall() {
cd /tmp || fallback "Could not change directory to /tmp"
DIR="$(mktemp -d)"
PIDIR="${DIR}/post-install"
- git clone git://git.ckyln.com/vcarbs "$DIR" >/dev/null
+ git clone "$DEFCARBS" "$DIR" >/dev/null
out "Cloning CARBS repository for post-installation scripts"
fi
cd "$PIDIR" || fallback "Could not change directory to $PIDIR"