diff options
-rwxr-xr-x | setup.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/setup.sh b/setup.sh index 673919d..7068a1a 100755 --- a/setup.sh +++ b/setup.sh @@ -28,7 +28,7 @@ limitations under the License.' } help_screen() { - echo "USAGE: $0: -n [name] -d [/path/to/dscip] -u [https://example.com/example.git] -b [branch_name] -t [/path/to/templates] (-h|-l)" + echo "USAGE: $0: -n [name] -d [/path/to/install/at] -u [https://example.com/example.git] -b [branch_name] -t [/path/to/templates] (-h|-l)" echo "========================================================================" echo "-n | Name of Project. (Required)" echo "-d | Path where you want dscip to install. (Required)" @@ -42,15 +42,16 @@ help_screen() { } check_config() { + ERROR_MSG="not set. Aborting. See -h for help." if [ "$PROJECT_NAME" = "" ]; then - echo "-n not set. Aborting..." && exit 1 + echo "-n $ERROR_MSG" && exit 1 elif [ "$PROJECT_LOCATION" = "" ]; then - echo "-d not set. Aborting..." && exit 1 + echo "-d $ERROR_MSG" && exit 1 elif [ "$PROJECT_URL" = "" ]; then - echo "-u not set. Aborting..." && exit 1 + echo "-u $ERROR_MSG" && exit 1 fi return 0 } @@ -58,7 +59,15 @@ check_config() { install_dscip() { echo "Installing dscip..." set -x - git clone "https://opencode.net/charadon/dscip" "$PROJECT_LOCATION" + if [ -d "/usr/share/charadon/dscip" ]; # See if dscip is packaged/installed on system. + then + cp /usr/share/charadon/dscip/* "$PROJECT_LOCATION" + elif [ -d /usr/local/share/charadon/dscip ]; + then + cp /usr/local/share/charaodn/dscip/* "$PROJECT_LOCATION" + else # If not, clone it from upstream. + git clone "https://opencode.net/charadon/dscip" "$PROJECT_LOCATION" + fi cd "$PROJECT_LOCATION" # Modifying config.sh with variables obtained from setup.sh sed -i "s}DSCIP_GITREPO=.*}DSCIP_GITREPO=\"$PROJECT_URL\"}g" config.sh @@ -69,7 +78,7 @@ install_dscip() { then cp "$TEMPLATE_DIR"/* . fi - # Done. Go back to CWD. + # Done. Go back to CWD, and tell user how to activate DSCIP. set +x printf "\n" printf "\e[32mAll done. Be sure to add:\e[0m\n" |