aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEugene Triguba <eugene@desktop.midcoip.net>2022-05-08 09:34:19 -0500
committerEugene Triguba <eugene@desktop.midcoip.net>2022-05-08 09:34:19 -0500
commit53205809e426d06eee009f4415798c9dd068807c (patch)
treec1a3055c0a0adc23ea0d01cd5fbc7d4307e080ba /install
downloaddotfiles-53205809e426d06eee009f4415798c9dd068807c.zip
Initial Commit
Diffstat (limited to 'install')
-rwxr-xr-xinstall41
1 files changed, 41 insertions, 0 deletions
diff --git a/install b/install
new file mode 100755
index 0000000..3581ffa
--- /dev/null
+++ b/install
@@ -0,0 +1,41 @@
+#!/bin/sh
+#set -e
+
+repo_dir=$(realpath $(dirname "$0"))
+
+escalate() {
+ if [ -x "$(command -v sudo)" ]; then
+ sudo $@
+ elif [ -x "$(command -v doas)" ]; then
+ doas $@
+ else
+ echo "No sudo or doas found to escalate permissions"
+ exit 1
+ fi
+}
+
+if ! [ -x "$(command -v ansible-playbook)" ]; then
+ case "$(uname -s)" in
+ FreeBSD)
+ escalate pkg install --yes sysutils/ansible
+ ;;
+ Linux)
+ source /etc/os-release
+
+ if [ "$ID" != "fedora" ]; then
+ echo "[!] Unsupported Linux Distrobution"
+ exit 1
+ fi
+
+ escalate dnf install --assumeyes ansible
+ ;;
+ *)
+ echo "[!] Unsupported OS"
+ exit 1
+ ;;
+ esac
+fi
+
+export ANSIBLE_LOCALHOST_WARNING=false
+ansible-playbook --ask-become-pass "$repo_dir/ansible/setup.yaml"
+