parrot-blackbox 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parrot-blackbox",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "parrot-blackbox — crash-proof, multi-cloud backup & recovery automation for Parrot OS. Daily/weekly off-disk backups with automatic catch-up, smart storage across many MEGA + Google Drive accounts, Timeshift snapshot backups and one-command restore.",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -168,7 +168,7 @@ export async function deleteSnapshot(name, { privileged = 'noninteractive' } = {
168
168
  /**
169
169
  * Resolve the on-disk directory of a snapshot.
170
170
  * BTRFS mode keeps snapshots in a hidden subvolume that Timeshift mounts at
171
- * /run/timeshift/backup (e.g. .../timeshift-btrfs/snapshots/<name>) — check the
171
+ * /run/timeshift/NNNN/backup (e.g. .../timeshift-btrfs/snapshots/<name>) — check the
172
172
  * classic locations first, then search the mounted backup tree.
173
173
  */
174
174
  export function snapshotDirFor(snapshot, { privileged = 'noninteractive' } = {}) {
@@ -185,13 +185,25 @@ export function snapshotDirFor(snapshot, { privileged = 'noninteractive' } = {})
185
185
  if (direct) return direct;
186
186
 
187
187
  // Best effort: search the mounted Timeshift backup tree for the snapshot dir.
188
+ // BTRFS mode uses dynamic PIDs in the mount path: /run/timeshift/NNNN/backup/...
188
189
  try {
189
- if (fs.existsSync('/run/timeshift/backup')) {
190
- const found = execaSync(
190
+ if (fs.existsSync('/run/timeshift')) {
191
+ // Try without sudo first (faster)
192
+ let found = execaSync(
191
193
  'bash',
192
- ['-c', `find /run/timeshift/backup -maxdepth 5 -type d -name '${snapshot.name}' 2>/dev/null | head -1`],
194
+ ['-c', `find /run/timeshift -maxdepth 5 -type d -name '${snapshot.name}' 2>/dev/null | head -1`],
193
195
  { reject: false, timeout: 5000 },
194
196
  ).stdout.trim();
197
+
198
+ // If that fails and we can use sudo, try with elevated privileges
199
+ if (!found && privileged === 'interactive') {
200
+ found = execaSync(
201
+ 'sudo',
202
+ ['bash', '-c', `find /run/timeshift -maxdepth 5 -type d -name '${snapshot.name}' 2>/dev/null | head -1`],
203
+ { reject: false, timeout: 5000 },
204
+ ).stdout.trim();
205
+ }
206
+
195
207
  if (found) return found;
196
208
  }
197
209
  } catch {
@@ -177,7 +177,7 @@ async function listBackupsAction() {
177
177
  const accs = listAccounts();
178
178
  p.log.message(pc.bold('Local snapshots (Timeshift):'));
179
179
  try {
180
- const local = await listLocalSnapshots({ privileged: 'noninteractive' });
180
+ const local = await listLocalSnapshots({ privileged: 'interactive' });
181
181
  if (!local.length) p.log.message(pc.dim(' none'));
182
182
  for (const sn of local) p.log.message(` - ${pc.cyan(sn.name)}`);
183
183
  } catch (e) {