summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-09 21:24:26 -0500
committerzachir <zachir@librem.one>2022-10-09 21:24:26 -0500
commit927073a4e8d9e50877a5336b68801725acb4e454 (patch)
tree572cb357ff7fd00486b608fd13c2b1ae53ad363a
parent2338eafffee168b409cd3e46d24467bc47cc1f43 (diff)
add instal script to add my other script paths
-rwxr-xr-xinstall.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..41c2c1a
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# adds my other script paths (except volsv)
+
+SSH_BASE_URL="git@git.zachir.xyz:zachir/"
+HTTP_BASE_URL="https://git.zachir.xyz/"
+
+SCRIPT_DIRS="blocks
+generics
+scripts
+shortcmds"
+
+case "$1" in
+ "-s"|"-S"|"-y"|"-Y")
+ ___USE_SSH=y
+ ;;
+ "-h")
+ printf "install.sh\n\nUsed to add my other script repos as submodules. Feel free to modfy it to clone yours as well.\n"
+ printf "-s, -S, -y, and -Y will clone using SSH. -h will show this help menu. Everything else will clone using https.\n"
+ ;;
+ *)
+ unset ___USE_SSH
+ ;;
+esac
+
+clone_dir () {
+ if [ -d "$1" ]; then
+ printf "%s already exists as dir; not adding.\n" "$1"
+ elif [ -f "$1" ]; then
+ printf "%s already exists, but not as a dir; not adding.\n" "$1"
+ else
+ if [ -n "$2" ]; then
+ printf "Cloning %s %s using ssh; will be read-write\nNote: only my ssh key will clone it\n" "$1"
+ git clone "$SSH_BASE_URL$1.git" "$1"
+ else
+ printf "Cloning %s using http; will be read-only\n" "$1"
+ git clone "$HTTP_BASE_URL$1.git" "$1"
+ fi
+ fi
+}
+
+echo "$SCRIPT_DIRS" | while read i; do
+ clone_dir "$i" "$___USE_SSH"
+done