]>
us-delaporte.pagekite.me Git - dotfiles.git/blob - bin/dot
2 # dot - a (mostly) one script dotfiles manager
4 # Copyright 2026 Edward Delaporte V
5 # Licensed under AGPLv3 and later.
8 # symlinks - any file in $HOME/dotfiles/files may be symlinked
11 # install the necessary tools to $HOME/envs/dot
14 # list available roles
17 # check setup vs expected
20 # add ROLE to localhost
23 # apply all added ROLES
28 ANSIBLE
="$ENVS/ansible/bin/ansible-playbook"
29 TASKFILE
="$HOME/dot.$HOSTNAME.yaml"
31 read -d '' EMPTY_TASKFILE
<< EOF
33 - name: Set up dotfiles on $HOSTNAME
40 ansible.builtin.shell: echo "Nothing to do."
44 if [ "$1" == "setup" ]; then
45 if [[ ! -f "$ANSIBLE" ]]; then
47 echo "Setting up Ansible in ~/envs/ansible"
48 cd $HOME/envs
; python3
-m venv ansible
49 $HOME/envs
/ansible
/bin
/pip
install ansible jinja2
51 if [[ -f "$ANSIBLE" ]]; then
52 echo "[ ok ]: Ansible setup at $ANSIBLE"
54 if [[ ! -f "$TASKFILE" ]]; then
55 echo "Creating $TASKFILE"
56 echo "$EMPTY_TASKFILE" >> $TASKFILE
58 if [[ -f "$TASKFILE" ]]; then
59 echo "[ ok ]: dot config at $TASKFILE"
63 if [ "$1" == "check" ]; then
64 $ANSIBLE $TASKFILE --check --diff
67 if [ "$1" == "list" ]; then
69 cd $HOME/dotfiles
/files
75 if [ "$1" == "link" ]; then
80 - name: Create a symbolic link
83 dest: /path/to/symlink
92 if [ "$1" == "reset" ]; then
93 read -n1 -p "Reset $TASKFILE? [y,N]" input
94 if [[ ! $input == "Y" && ! $input == "y" ]]; then
95 echo "Aborted by user"
98 echo "$EMPTY_TASKFILE" > $TASKFILE