sspt-bootstrap 1013 Bytes
Newer Older
PoroCYon's avatar
PoroCYon committed
1
2
#!/usr/bin/env bash

3
4
5
6
7
cfgfile="$XDG_CONFIG_HOME"
if [ -z "$cfgfile" ]; then
    cfgfile="$HOME/.config"
fi
cfgfile="$cfgfile/sspt.conf"
PoroCYon's avatar
PoroCYon committed
8

9
edit_the_conf() {
PoroCYon's avatar
PoroCYon committed
10
    local edit_conf=
PoroCYon's avatar
PoroCYon committed
11
    read -r -e -p "Edit the sspt.conf file? (Y/n) " edit_conf
PoroCYon's avatar
PoroCYon committed
12
13
14
15
16
17
18
19
20
21
22
    if [ "$edit_conf" != "n" ] && [ "$edit_conf" != "N" ]; then
        command -v "$EDITOR" >/dev/null 2>&1 && "$EDITOR" "$cfgfile" && return
        command -v "nano" >/dev/null 2>&1 && "nano" "$cfgfile" && return
        command -v "nvim" >/dev/null 2>&1 && "nvim" "$cfgfile" && return
        command -v "vim" >/dev/null 2>&1 && "vim" "$cfgfile" && return
        command -v "vi" >/dev/null 2>&1 && "vi" "$cfgfile" && return
    fi
}

local/bin/sspt --mk-default-config
edit_the_conf
23
. "$cfgfile"
PoroCYon's avatar
PoroCYon committed
24
export SSPT_BOOTSTRAP_BASE="$(dirname "$0")"
25
local/bin/sspt -c config/sspt.bootstrap.conf pull "https://gitlab.com/PoroCYon/sspt"
26
. "$cfgfile"
PoroCYon's avatar
PoroCYon committed
27
export SSPT_BOOTSTRAP_BASE="$(dirname "$0")"
28
local/bin/sspt -c config/sspt.bootstrap.conf install "sspt"
PoroCYon's avatar
PoroCYon committed
29
unset SSPT_BOOTSTRAP_BASE
PoroCYon's avatar
PoroCYon committed
30