first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { access } from 'node:fs/promises';
|
||||
import { constants } from 'node:fs';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
const run = promisify(execFile);
|
||||
const checks = [
|
||||
['session', async () => process.env.XDG_SESSION_TYPE || 'unknown'],
|
||||
['portal', async () => { await access('/usr/share/dbus-1/services/org.freedesktop.portal.Desktop.service', constants.F_OK); return 'installed'; }],
|
||||
['pipewire', async () => { await run('sh', ['-lc', 'command -v pw-cat']); return 'installed'; }],
|
||||
['at-spi', async () => { await run('sh', ['-lc', 'command -v gsettings']); return 'desktop tools present'; }],
|
||||
['libei', async () => { await run('sh', ['-lc', 'ldconfig -p 2>/dev/null | grep -q libei']); return 'installed'; }],
|
||||
['ydotool', async () => { await run('sh', ['-lc', 'command -v ydotool']); return 'optional fallback present'; }],
|
||||
];
|
||||
|
||||
let failed = 0;
|
||||
for (const [name, check] of checks) {
|
||||
try { console.log(`ok ${name}: ${await check()}`); }
|
||||
catch { failed += 1; console.log(`---- ${name}: unavailable`); }
|
||||
}
|
||||
console.log(failed ? `cu-doctor: ${failed} optional/required checks unavailable` : 'cu-doctor: all checks passed');
|
||||
process.exitCode = failed ? 1 : 0;
|
||||
Reference in New Issue
Block a user