All checks were successful
Build and test project / build-and-test (push) Successful in 1m32s
35 lines
945 B
JavaScript
35 lines
945 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { WEBROOT, WEBROOT_FIRMWARE, FIRMWARE_PATH } = require('./paths');
|
|
|
|
function hasNickelMenuAssets() {
|
|
return fs.existsSync(path.join(WEBROOT, 'nickelmenu', 'NickelMenu.zip'))
|
|
&& fs.existsSync(path.join(WEBROOT, 'nickelmenu', 'kobo-config.zip'));
|
|
}
|
|
|
|
function hasKoreaderAssets() {
|
|
return fs.existsSync(path.join(WEBROOT, 'koreader', 'koreader-kobo.zip'))
|
|
&& fs.existsSync(path.join(WEBROOT, 'koreader', 'release.json'));
|
|
}
|
|
|
|
function hasFirmwareZip() {
|
|
return fs.existsSync(FIRMWARE_PATH);
|
|
}
|
|
|
|
function setupFirmwareSymlink() {
|
|
try { fs.unlinkSync(WEBROOT_FIRMWARE); } catch {}
|
|
fs.symlinkSync(path.resolve(FIRMWARE_PATH), WEBROOT_FIRMWARE);
|
|
}
|
|
|
|
function cleanupFirmwareSymlink() {
|
|
try { fs.unlinkSync(WEBROOT_FIRMWARE); } catch {}
|
|
}
|
|
|
|
module.exports = {
|
|
hasNickelMenuAssets,
|
|
hasKoreaderAssets,
|
|
hasFirmwareZip,
|
|
setupFirmwareSymlink,
|
|
cleanupFirmwareSymlink,
|
|
};
|