1
0
Fork 0
mirror of synced 2024-06-29 19:41:03 +12:00

Formatting.

This commit is contained in:
mike12345567 2021-05-10 13:19:09 +01:00
parent 77b4b206f7
commit 502ae91aae

View file

@ -15,22 +15,20 @@ function execute(command) {
}) })
} }
async function commandExistsUnix (command) { async function commandExistsUnix(command) {
const unixCmd = `command -v ${command} 2>/dev/null && { echo >&1 ${command}; exit 0; }` const unixCmd = `command -v ${command} 2>/dev/null && { echo >&1 ${command}; exit 0; }`
return execute(command) return execute(command)
} }
async function commandExistsWindows (command) { async function commandExistsWindows(command) {
if (/[\x00-\x1f<>:"|?*]/.test(command)) { if (/[\x00-\x1f<>:"|?*]/.test(command)) {
return false return false
} }
return execute(`where ${command}`) return execute(`where ${command}`)
} }
function commandExists (command) { function commandExists(command) {
return windows return windows ? commandExistsWindows(command) : commandExistsUnix(command)
? commandExistsWindows(command)
: commandExistsUnix(command)
} }
async function init() { async function init() {
@ -41,18 +39,23 @@ async function init() {
return return
} }
if (mac) { if (mac) {
console.log("Please install docker by visiting: https://docs.docker.com/docker-for-mac/install/") console.log(
"Please install docker by visiting: https://docs.docker.com/docker-for-mac/install/"
)
} else if (windows) { } else if (windows) {
console.log("Please install docker by visiting: https://docs.docker.com/docker-for-windows/install/") console.log(
"Please install docker by visiting: https://docs.docker.com/docker-for-windows/install/"
)
} else if (linux) { } else if (linux) {
console.log("Beginning automated linux installation.") console.log("Beginning automated linux installation.")
await execute(`./hosting/scripts/linux/get-docker.sh`) await execute(`./hosting/scripts/linux/get-docker.sh`)
await execute(`./hosting/scripts/linux/get-docker-compose.sh`) await execute(`./hosting/scripts/linux/get-docker-compose.sh`)
} else { } else {
console.error("Platform unknown - please look online for information about installing docker for our OS.") console.error(
"Platform unknown - please look online for information about installing docker for our OS."
)
} }
console.log("Once installation complete please re-run the setup script.") console.log("Once installation complete please re-run the setup script.")
process.exit(-1) process.exit(-1)
} }
init() init()