aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/justfile
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:48 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:48 +0100
commitdd7cede921cb3b5b003cfecc3ab7d76f16df841c (patch)
tree5ff798636f4f52593f41553ea31d960d61961602 /justfile
parentb367ccd184d45f0f65fc2b4f12a6f21b528ee7c3 (diff)
downloaddotfiles-dd7cede921cb3b5b003cfecc3ab7d76f16df841c.tar.gz
dotfiles-dd7cede921cb3b5b003cfecc3ab7d76f16df841c.tar.bz2
dotfiles-dd7cede921cb3b5b003cfecc3ab7d76f16df841c.zip
fix(etc-diff,etc-upstream-diff): use doas cat for root-only live files
/etc/doas.conf (0600) and similar mode-restricted files triggered 'Permission denied' when diff tried to read them as the user. Read via 'doas cat' on the live side; keep the repo/pristine side as the user since those are readable.
Diffstat (limited to 'justfile')
-rw-r--r--justfile9
1 files changed, 5 insertions, 4 deletions
diff --git a/justfile b/justfile
index e3e2743..eac90ac 100644
--- a/justfile
+++ b/justfile
@@ -233,10 +233,11 @@ etc-diff *paths:
if [ ! -f "$repo" ]; then
echo "skip: $live (not a regular file in etc/)" >&2; continue
fi
- if [ ! -f "$live" ]; then
+ if ! doas test -f "$live"; then
echo "skip: $live (missing or not a regular file on host)" >&2; continue
fi
- diff -u --label "$live" --label "$repo" "$live" "$repo" || true
+ # Use doas cat so we can diff root-readable files (e.g. /etc/doas.conf 0600)
+ diff -u --label "$live" --label "$repo" <(doas cat "$live") "$repo" || true
done
# Diff live /etc/<path> against pristine pacman version (all modified backup files if no args)
@@ -279,7 +280,7 @@ etc-upstream-diff *paths:
*..*|*/./*) echo "error: unsafe path: $path" >&2; exit 1 ;;
esac
[[ "$path" = /etc/* ]] || { echo "error: $path not under /etc" >&2; exit 1; }
- [ -f "$path" ] || { echo "skip: $path (not a regular file)" >&2; continue; }
+ doas test -f "$path" || { echo "skip: $path (not a regular file)" >&2; continue; }
if ! cache=$(pristine "$path"); then
if [ "$explicit" = 1 ]; then
echo "error: cannot obtain pristine for $path" >&2
@@ -292,7 +293,7 @@ etc-upstream-diff *paths:
echo "skip: $path (not present in package archive)" >&2
continue
fi
- diff -u --label "$path (pristine)" --label "$path (live)" "$out" "$path" || true
+ diff -u --label "$path (pristine)" --label "$path (live)" "$out" <(doas cat "$path") || true
done
# Copy one or more /etc/<path> regular files into the repo's etc/ tree