Commit 1151ca3
committed
desktops: gate pin-file on repo setup, write atomically
Review feedback on PR #838:
1. The pin-file block ran even when the repo setup was skipped
(empty DESKTOP_REPO_URL), so a DE with `preferences:` but no
matching `url`/`key_url`/`keyring` would create an orphan file
under /etc/apt/preferences.d/. Nest the block inside the
existing `[[ -n \$DESKTOP_REPO_URL ... ]]` guard so pins only
land when the matching archive was actually configured.
2. The previous `: > \$pref_file` + `>>` loop left a truncated
file on mid-write failure, which apt would misparse rather
than ignore. Write to \${pref_file}.tmp, check each printf's
exit status, and atomically `mv` on success. Any failure
returns 1 (not exit 1 — that would kill armbian-config).
No change to the emitted file content; smoke-tested against
bianbu, still byte-identical to SpacemiT's documented pin file.1 parent 0c27568 commit 1151ca3
1 file changed
Lines changed: 37 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
| |||
0 commit comments