uptime-kuma/extra/install.batsh
2021-08-17 23:08:35 +08:00

70 lines
1.9 KiB
Plaintext

println("=====================");
println("Uptime Kuma Installer");
println("=====================");
println("");
println("---------------------------------------");
println("This script is designed for Linux and basic usage.");
println("For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation");
println("---------------------------------------");
println("");
println("Local - Install Uptime Kuma in your current machine with git, Node.js 14 and pm2");
println("Docker - Install Uptime Kuma Docker container");
println("");
if ("$1" != "") {
type = "$1";
} else {
call("read", "-p", "Which installation method do you prefer? [DOCKER/local]: ", "type");
}
if (type == "local") {
if ("$1" != "") {
port = "$3";
} else {
call("read", "-p", "Listening Port [3001]: ", "port");
}
if (exists("/etc/redhat-release")) {
os = call("cat", "/etc/redhat-release");
distribution = "rhel";
}
bash("arch=$(uname -i)");
println("Your OS: " ++ os);
println("Distribution: " ++ distribution);
println("Arch: " ++ arch);
if (distribution == "rhel") {
bash("nodePath=$(command -v node)");
if (nodePath != "") {
bash("nodeVersion=$(node -e 'console.log(process.versions.node.split(`.`)[0])')");
println("Node Version: " ++ nodeVersion);
if (nodeVersion < "12") {
println("Error: Required Node.js 14");
call("exit", "1");
} else {
if (nodeVersion == "12") {
println("Warning: NodeJS " ++ nodeVersion ++ " is not tested.");
}
println("OK");
}
} else {
}
call("yum", "install", "git", "-y");
}
} else {
call("read", "-p", "Expose Port [3001]: ", "port");
call("read", "-p", "Volume Name [uptime-kuma]: ", "volume");
}