about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-09-29 09:01:34 -0400
committerCharadon <dev@iotib.net>2022-09-29 09:01:34 -0400
commit3946e9d6c2c55df1abec44435471baf75a55a73c (patch)
treea7b9799009b4df78281927cae9e2039e4523484a
parent3d0da01cb4be4f6b4ab1d213c7d65e1f1997818e (diff)
downloaddscip-3946e9d6c2c55df1abec44435471baf75a55a73c.tar.gz
setup.sh: Made more friendly for packaging, and fixed up some things.
-rwxr-xr-xsetup.sh21
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" 
ef='#n207'>207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286