Skip to content

Commit 6e21057

Browse files
committed
plugins: add apt, sudo, and snap for packages
1 parent 164a243 commit 6e21057

File tree

7 files changed

+65
-3
lines changed

7 files changed

+65
-3
lines changed

.dotbot-plugins/aptget

Submodule aptget added at 749fa12

.dotbot-plugins/snap

Submodule snap added at 70116f1

.dotbot-plugins/sudo

Submodule sudo added at 7e454ab

.gitmodules

+9
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
[submodule "demos/_rain"]
2020
path = demos/_rain
2121
url = https://github.com/lbgists/rain.sh.git
22+
[submodule ".dotbot-plugins/snap"]
23+
path = .dotbot-plugins/snap
24+
url = https://github.com/DrDynamic/dotbot-snap.git
25+
[submodule ".dotbot-plugins/aptget"]
26+
path = .dotbot-plugins/aptget
27+
url = https://github.com/johnlettman/dotbot-aptget.git
28+
[submodule ".dotbot-plugins/sudo"]
29+
path = .dotbot-plugins/sudo
30+
url = https://github.com/johnlettman/dotbot-sudo.git

.install.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
link:
33
create: true
44
relink: true
5+
aptget:
6+
upgrade: true
57

68
- link:
79
~/.gitignore: git/ignore
@@ -13,4 +15,20 @@
1315
~/.config/nano/nanorc: nano/nanorc
1416
~/.config/nano/syntax-highlighting: nano/syntax-highlighting
1517

16-
~/.config/htop/htoprc: htop/htoprc
18+
~/.config/htop/htoprc: htop/htoprc
19+
20+
- sudo:
21+
- snap:
22+
23+
jq:
24+
yq:
25+
26+
# instant messaging applications
27+
discord:
28+
caprine:
29+
mattermost-desktop:
30+
telegram-desktop:
31+
32+
- aptget:
33+
python-is-python3:
34+
emacs:

install

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@ source "$(dirname "${BASH_SOURCE[0]}")/scripts/_utils.sh";
44

55
config="${repo_dir}/.install.yaml";
66
dotbot_dir="${repo_dir}/.dotbot";
7+
dotbot_plugins_dir="${repo_dir}/.dotbot-plugins";
78
dotbot_bin="${dotbot_dir}/bin/dotbot";
89

10+
dotbot_plugins=(
11+
"sudo/sudo.py"
12+
"aptget/aptget.py"
13+
"snap/snap.py"
14+
);
15+
916
git -C "${dotbot_dir}" submodule sync --quiet --recursive;
1017
git submodule update --init --recursive "${dotbot_dir}";
1118

12-
"${dotbot_bin}" -d "${repo_dir}" -c "${config}" "${@}";
19+
# shellcheck disable=SC2068,SC2046
20+
"${dotbot_bin}" \
21+
$(join "-p ${dotbot_plugins_dir}/" ${dotbot_plugins[@]}) \
22+
-d "${repo_dir}" \
23+
-c "${config}" \
24+
"${@}";

scripts/_utils.sh

+21-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ while [ -h "${repo_dir}" ]; do
2525
repo_dir="$(readlink -f -- "${repo_dir}")";
2626
done;
2727

28+
cd "${repo_dir}" || {
29+
log error "Unable to change directories; something is wrong!";
30+
exit 1;
31+
};
32+
33+
repo_dir="$(pwd)";
34+
2835
# return to the previous directory prior to these operations
2936
popd >'/dev/null' || cd "${prev_dir}" || {
3037
log error \
@@ -33,4 +40,17 @@ popd >'/dev/null' || cd "${prev_dir}" || {
3340
};
3441

3542
unset prev_dir;
36-
export repo_dir;
43+
export repo_dir;
44+
45+
46+
join() {
47+
local prefix="$1";
48+
shift;
49+
local arr=("$@");
50+
51+
for i in "${!arr[@]}"; do
52+
arr[i]="${prefix}${arr[i]}";
53+
done;
54+
55+
echo "${arr[*]}";
56+
}

0 commit comments

Comments
 (0)