An interactive command-line interface (CLI) tool to help you install, use, and administer an AO instance.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

import { execSync } from 'child_process'
// Returns one of: off, installed, enabled, running, synced, error
function serviceStatus() {
try {
const stdout = execSync('systemctl status ao')
const isServiceRunning = stdout.includes('Active: active (running)')
if(isServiceRunning) return 'running'
else if(stdout.includes('error')) return 'error'
else if(stdout.includes('stopped')) return 'installed'
} catch(err) {
return 'error'
}
return 'off'
}
// Return true if the specified AO repo exists: ao-svelte or ao-3 are expected values
export function aoIsInstalled(version) {
console.log('aoIsInstalled not implemented yet')
return true
}
function installAo(version) {
if(!version) {
version = aoEnv('AO_VERSION')
if(!version) {
version = 'ao-svelte'
setAoEnv('AO_VERSION', 'ao-svelte')
console.log('No AO server/frontend version specified, defaulting to ao-svelte.')
}
}
console.log('todo: git clone the correct repo now')
}
export default {
description: 'AO server instance on this computer',
status: serviceStatus,
install: installAo,
}