v2.0.0
This commit is contained in:
35
setup.sh
35
setup.sh
@@ -1,32 +1,15 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit on errors
|
||||
set -eo pipefail
|
||||
set -x
|
||||
|
||||
# help
|
||||
if [ $# -eq 0 ] || [ "$1" = "h" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "/?" ]; then
|
||||
echo "usage: setup.sh [ submodule | standalone ]"
|
||||
echo " submodule - add to existing git repo as submodule"
|
||||
echo " standalone - keep independent git repo"
|
||||
if [ -z "$CBUILD_INSTALL_DIR" ]; then
|
||||
CBUILD_INSTALL_DIR="/usr/local/share/cbuild"
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
submodule)
|
||||
echo "mode - $1"
|
||||
git submodule add ./cbuild
|
||||
;;
|
||||
standalone)
|
||||
echo "mode - $1"
|
||||
;;
|
||||
*)
|
||||
echo "invalid argument: $1"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
|
||||
cp cbuild/default.Makefile Makefile
|
||||
cp cbuild/default.config ./
|
||||
|
||||
echo "copy default .gitignore? [y/any]"
|
||||
read answ
|
||||
[[ "$answ"="y" ]] && cp cbuild/.gitignore ./
|
||||
if [ "$CBUILD_INSTALL_DIR" != "." ]; then
|
||||
cp -r ./ "$CBUILD_INSTALL_DIR"
|
||||
rm -rf "$CBUILD_INSTALL_DIR/.git"
|
||||
fi
|
||||
ln -sfv "$(realpath $CBUILD_INSTALL_DIR/cbuild.sh)" -T "/usr/local/bin/cbuild"
|
||||
|
||||
Reference in New Issue
Block a user