aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap
blob: 5905df3f23a500c370283586676b6db753d6b898 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

escalate() {
    if [ -x "$(command -v sudo)" ]; then
        sudo $@
    else
        echo "sudo not found to escalate permissions"
        exit 1
    fi
}

if ! [ -x "$(command -v ansible-playbook)" ]; then
    case "$(uname -s)" in
        Linux)
            source /etc/os-release

            if [ "$ID" != "fedora" ]; then
                echo "[!] Unsupported Linux Distribution"
                exit 1
            fi

            escalate dnf install --assumeyes ansible
            ;;
        *)
            echo "[!] Unsupported OS"
            exit 1
            ;;
    esac
fi