Skip to content

Commit c607ebb

Browse files
author
3aa49ec6bfc910647fa1c5a013e48eef
committed
Add runFskOnVirtualDisk function to storage module
1 parent e49b4a4 commit c607ebb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/worker/modules/lockChimes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logWithTimestamp } from "./log.js";
2-
import { mountTeslaCamAsReadWrite, mountUsbDriveToHost, unmountTeslaCam, unmountUsbDriveFromHost } from "./storage.js";
2+
import { mountTeslaCamAsReadWrite, mountUsbDriveToHost, unmountTeslaCam, unmountUsbDriveFromHost, runFskOnVirtualDisk } from "./storage.js";
33
import { executeBashCommand } from "./bash.js";
44
import fs from 'fs';
55

@@ -22,6 +22,8 @@ const installLockChime = async () => {
2222
await unmountUsbDriveFromHost();
2323
await mountTeslaCamAsReadWrite();
2424
logWithTimestamp(`Copying LockChime.wav to USB drive`)
25-
await executeBashCommand(`cp /tmp/LockChime.wav /mnt/TeslaCam/LockChime.wav`)
25+
await executeBashCommand(`cp /tmp/LockChime.wav /mnt/TeslaCam/LockChime.wav && chmod 777 /mnt/TeslaCam/LockChime.wav`)
26+
await unmountTeslaCam();
27+
await runFskOnVirtualDisk();
2628
await mountUsbDriveToHost();
2729
}

src/worker/modules/storage.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export const mountUsbDriveToHost = async () => {
3030
await executeBashCommand("sudo modprobe g_mass_storage file=/vusb/TeslaCam")
3131
}
3232

33+
export const runFskOnVirtualDisk = async () => {
34+
logWithTimestamp("Running fsck on virtual disk, just in case")
35+
await executeBashCommand("sudo fsck -y /vusb/TeslaCam")
36+
}
37+
38+
3339
// Not in use - leaving for now as it may be useful later
3440
// async function listFolderContents(folderPath, recursive = false) {
3541
// let entries = [];

0 commit comments

Comments
 (0)