From: Edward Delaporte Date: Mon, 6 Jul 2026 04:24:28 +0000 (-0500) Subject: Track install in ~/dot X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/commitdiff_plain/1674c31a23d3aaa4c37ccde88a5cf16483369dfc?ds=sidebyside;hp=8919e050f688153441db6ac6195dfa6d6ededa8e Track install in ~/dot --- diff --git a/bin/dot b/bin/dot index 0fd7dd7..c3e4a6a 100755 --- a/bin/dot +++ b/bin/dot @@ -1,25 +1,27 @@ #!/bin/bash -# dot - a (mostly) one script dotfiles manager -# -# Copyright 2026 Edward Delaporte V -# Licensed under AGPLv3 and later. -# -# Features -# symlinks - any file in $HOME/dotfiles/files may be symlinked -# -# dot setup -# install the necessary tools to $HOME/envs/dot -# -# dot link FILE -# updates ~/dot.HOSTNAME.yaml -# to include a symlink from ~/dotfiles/files/FILE to ~/.FILE -# -# dot check -# check setup against ~/dot.HOSTNAME.yaml -# -# dot apply -# apply config in ~/dot.HOSTNAME.yaml +read -d '' HELP << EOF +dot - a (mostly) one script dotfiles manager +Copyright 2026 Edward Delaporte V +Licensed under AGPLv3 and later. + +dot setup + install the necessary tools to $HOME/envs/dot + +dot link FILE + updates ~/dot.HOSTNAME.yaml + to include a symlink from ~/dotfiles/files/FILE to ~/.FILE + +dot check + check setup against ~/dot.HOSTNAME.yaml + +dot apply + apply config in ~/dot.HOSTNAME.yaml +EOF + +if [ ! -n "$1" ] || [ "$1" == "help" ]; then + echo "$HELP" +fi # set -v ENVS="$HOME/envs" @@ -27,6 +29,7 @@ ANSIBLE="$ENVS/ansible/bin/ansible-playbook" TASKFILE="$HOME/dot.$HOSTNAME.yaml" LINKFILES="$HOME/dotfiles/files" INSTALLS="$HOME/dotfiles/install" +DOT="$HOME/dot" read -d '' EMPTY_TASKFILE << EOF --- @@ -114,7 +117,28 @@ if [ "$1" == "install" ]; then ls -p | grep -v / exit 1 fi - $INSTALLS/$2 -fi - + if [[ ! -f "$INSTALLS/$2.sh" ]]; then + echo "No such install script $INSTALLS/$2.sh" + echo "Run dot install with no params to list scripts." + exit 1 + fi +mkdir -p $DOT +read -d '' RUN_INSTALL << EOF + - name: check $2 + stat: + path: "$DOT/$2.installed" + register: $2_installed + - name: install $2 + ansible.builtin.shell: | + "$INSTALLS/$2.sh" + touch "$DOT/$2.installed" + when: not $2_installed.stat.exists + - name: verify $2 is installed + ansible.builtin.debug: + msg: "$2 is installed." + when: $2_installed.stat.exists +EOF + echo " $RUN_INSTALL" >> $TASKFILE + echo "Run 'dot apply' to run the install" +fi