X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=system-status;h=12621cc8eda5c3d44cfa5dd09923f4ab7a710a05;hb=4d0dc703ef2e62cd16ea84f27456f6f50f74baa3;hp=b3c22e4ea8126f1a24330b039aceef3803ed1d03;hpb=f91bdcc85d4742254fefc2c9880a0c76dc2a65ed;p=distro-setup diff --git a/system-status b/system-status index b3c22e4..12621cc 100755 --- a/system-status +++ b/system-status @@ -64,64 +64,65 @@ write-status() { end=true fi + # these conditions are so we dont have an overly verbose prompt if $begin && $end; then chars+=("DISTRO!") elif $begin; then chars+=("DISTRO-BEGIN!") elif $end; then chars+=("DISTRO-END!") - fi - - f=~/.local/conflink - for _ in 1; do - if [[ -e $f ]]; then - now=$(date +%s) - fsec=$(stat -c%Y $f) - # the / 60 makes it 0-59 seconds less strict, +1 makes sure we - # dont have any false positives. - fmin=$(( (fsec - now ) / 60 + 1 )) - fminplus=$(( fmin + 60*24 )) - # Filesystem files get copied, so find any newer than the last run. - # The rest are hueristics: - # Given the last time we added a file in git, is that newer than the last conflink run. - # Given new files not added to git, were they modified more recently than the last conflink? but, - # push their modification time back by a day so we can develop them before needing to add them to git. - - all_dirs=({/a/bin/ds,/p/c}{/filesystem,/machine_specific/$HOSTNAME/filesystem}) - # This part is copied from conflink - for x in /p/c/machine_specific/*.hosts /a/bin/ds/machine_specific/*.hosts; do - if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi - done - - # just because i forget a lot, -mmin -NUM means files modified <= NUM minutes ago - if (( $(date -d "$(git log --diff-filter=ACR --format=%aD -1)" +%s) > fsec )) || \ - [[ $(find ${all_dirs[@]} -mmin $fmin -type f -print -quit 2>/dev/null) ]]; then - v conflink newer git or newer filesystem files - chars+=("CONFLINK!") - break - fi - - for d in /a/bin/distro-setup /p/c; do - cd $d - if [[ ! -e .git ]]; then - # some hosts i dont push all of /p/c - continue - fi - untracked=$(git ls-files -o --exclude-standard) - if [[ $untracked && $(find $untracked -mmin $fminplus -type f -print -quit) ]]; then - v conflink: untracked in $d + else + f=~/.local/conflink + for _ in 1; do + if [[ -e $f ]]; then + now=$(date +%s) + fsec=$(stat -c%Y $f) + # the / 60 makes it 0-59 seconds less strict, +1 makes sure we + # dont have any false positives. + fmin=$(( (fsec - now ) / 60 + 1 )) + fminplus=$(( fmin + 60*24 )) + # Filesystem files get copied, so find any newer than the last run. + # The rest are hueristics: + # Given the last time we added a file in git, is that newer than the last conflink run. + # Given new files not added to git, were they modified more recently than the last conflink? but, + # push their modification time back by a day so we can develop them before needing to add them to git. + + all_dirs=({/a/bin/ds,/p/c}{/filesystem,/machine_specific/$HOSTNAME/filesystem}) + # This part is copied from conflink + for x in /p/c/machine_specific/*.hosts /a/bin/ds/machine_specific/*.hosts; do + if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi + done + + # just because i forget a lot, -mmin -NUM means files modified <= NUM minutes ago + if (( $(date -d "$(git log --diff-filter=ACR --format=%aD -1)" +%s) > fsec )) || \ + [[ $(find ${all_dirs[@]} -mmin $fmin -type f -print -quit 2>/dev/null) ]]; then + v conflink newer git or newer filesystem files chars+=("CONFLINK!") break fi - done - fi - if [[ ! -e $f || $(<$f) != 0 ]]; then - v conflink: last run not found or failed - chars+=("CONFLINK!") - break - fi - done + for d in /a/bin/distro-setup /p/c; do + cd $d + if [[ ! -e .git ]]; then + # some hosts i dont push all of /p/c + continue + fi + untracked=$(git ls-files -o --exclude-standard) + if [[ $untracked && $(find $untracked -mmin $fminplus -type f -print -quit) ]]; then + v conflink: untracked in $d + chars+=("CONFLINK!") + break + fi + done + + fi + if [[ ! -e $f || $(<$f) != 0 ]]; then + v conflink: last run not found or failed + chars+=("CONFLINK!") + break + fi + done + fi ## Clean the paniclog, but only up to 4 times per day, or else we