-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmrAddDot.sh
executable file
·41 lines (32 loc) · 1.05 KB
/
mrAddDot.sh
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
#!/bin/bash
_start_dir=$PWD ; cd ${HOME}
if [[ $# -ne 1 ]]; then
echo "BORK; please provide a repo name"
exit 128
elif [[ $# -eq 1 ]]; then
_config_name=$1
else
echo "BORK; too many args"
exit 1
fi
_config_repo="gitosis@gitosis.temporalflux.org:dot/${_config_name}.git" # Replace with the right remote repo
_mr_configuration_dir=".config/mr"
_mr_available_dir="${_mr_configuration_dir}/available.d"
_mr_repo_file="vcsh.${_config_name}"
_mr_repo_config="${_mr_available_dir}/${_mr_repo_file}"
_mr_configured_dir="${_mr_configuration_dir}/config.d"
# Confirm mr is up-to-date
vcsh mr pull
# Add to available.d
cat >${_mr_repo_config}<<_EOF_
[\${HOME}/.config/vcsh/repo.d/${_config_name}.git]
checkout = vcsh clone ${_config_repo} ${_config_name}
_EOF_
vcsh mr add -f ${_mr_repo_config}
# Add to config.d
cd ${_mr_configured_dir} ; ln -s ../available.d/${_mr_repo_file}
cd ${HOME} ; vcsh mr add -f ${_mr_configured_dir}/${_mr_repo_file}
# Commit (and push) changes
vcsh mr commit -m "Added vcsh ${_config_name} and link"
vcsh mr push
cd ${_start_dir}