add iterm2
[webi-installers/.git] / iterm2 / install.sh
diff --git a/iterm2/install.sh b/iterm2/install.sh
new file mode 100644 (file)
index 0000000..31d3794
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+set -u
+
+function _install_iterm2() {
+    # only for macOS
+    if [[ "Darwin" != "$(uname -s)" ]]; then
+        echo ""
+        echo "iTerm2 is only for macOS"
+        echo ""
+        echo "You might want to check out:"
+        echo "    alacritty for Linux"
+        echo "    Windows Terminal for Windows, of course"
+        echo ""
+        exit 1
+    fi
+
+    webi_download
+    webi_extract
+
+    if [[ ! -d "${WEBI_TMP}/iTerm.app" ]]; then
+        echo "error unpacking iTerm2:"
+        ls -lAF "${WEBI_TMP}"
+        exit 1
+    fi
+
+    if [[ -d ~/Applications/iTerm.app ]]; then
+        mv ~/Applications/iTerm.app ${WEBI_TMP}/iTerm.app-webi.bak
+    fi
+    mv "${WEBI_TMP}/iTerm.app" ~/Applications/
+}
+
+_install_iterm2