This commit is contained in:
2024-07-12 01:55:58 +03:00
parent 6d285a88d8
commit 9b1bbffbc4
23 changed files with 372 additions and 304 deletions

View File

@@ -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"