-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·84 lines (67 loc) · 2.44 KB
/
install
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
set -e
# === VARIABLES DECLARATION === #
DEFAULT_CONFIG_PREFIX="dotfiles"
CONFIG_SUFFIX=".conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
declare -A DOTBOT_PLUGINS
DOTBOT_PLUGINS=(["packages"]="dotbot-yay" ["sudo"]="dotbot-sudo")
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
# === FUNCTION DECLARATION === #
function installDotfiles {
if [ -f "$(dirname pwd)/dotfiles.conf.yaml" ]; then
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "dotfiles${CONFIG_SUFFIX}"
else
echo "dotfiles.conf.yaml does not exist. Please make sure it's in your dotfiles' root repository and try again."
fi
}
function installSudoDotfiles {
if [ -f "$(dirname pwd)/sudodotfiles.conf.yaml" ]; then
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "sudodotfiles${CONFIG_SUFFIX}" \
--plugin-dir "dotbot-sudo"
else
echo "sudodotfiles.conf.yaml does not exist. Please make sure it's in your dotfiles' root repository and try again."
fi
}
function installPackages {
if [ -f "$(dirname pwd)/packages.conf.yaml" ]; then
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "packages${CONFIG_SUFFIX}" \
--plugin-dir "dotbot-yay"
else
echo "packages.conf.yaml does not exist. Please make sure it's in your dotfiles' root repository and try again."
fi
}
# === MAIN === #
main() {
tput setaf 3; echo -e "Welcome to Freshgiammi's custom dotbot installer. \n"
tput sgr0;
while true; do
read -p "Do you wish to install dotfiles (Y/N)? " yn
case $yn in
[Yy]* ) installDotfiles; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Do you wish to install dotfiles (with sudo) (Y/N)? " yn
case $yn in
[Yy]* ) installSudoDotfiles; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Do you wish to install programs with yay (Y/N)? " yn
case $yn in
[Yy]* ) installPackages; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
}
main