mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 17:29:08 +08:00
wip: implementing install script
This commit is contained in:
69
extra/install.batsh
Normal file
69
extra/install.batsh
Normal file
@@ -0,0 +1,69 @@
|
||||
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");
|
||||
}
|
Reference in New Issue
Block a user