wip: implementing install script

This commit is contained in:
LouisLam 2021-08-19 02:38:45 +08:00
parent 61944d642e
commit bb0af35d47
2 changed files with 15 additions and 10 deletions

View File

@ -1,13 +1,15 @@
// install.sh is generated by ./extra/install.batsh, do not modify it directly. // install.sh is generated by ./extra/install.batsh, do not modify it directly.
// "npm run compile-install-script" to compile install.sh // "npm run compile-install-script" to compile install.sh
// The command is working on Windows PowerShell and Docker for Windows only. // The command is working on Windows PowerShell and Docker for Windows only.
// curl -o uptime-kuma-install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash uptime-kuma-install.sh
println("====================="); println("=====================");
println("Uptime Kuma Installer"); println("Uptime Kuma Installer");
println("====================="); println("=====================");
println(""); println("Supported OS: CentOS 7/8, Ubuntu >= 16.04 and Debian");
println("---------------------------------------"); println("---------------------------------------");
println("This script is designed for Linux and basic usage."); println("This script is designed for Linux and basic usage.");
println("Supported OS: CentOS 7/8, Ubuntu >= 16.04 and Debian");
println("For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation"); println("For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation");
println("---------------------------------------"); println("---------------------------------------");
println(""); println("");
@ -104,7 +106,7 @@ if (type == "local") {
if ("$3" != "") { if ("$3" != "") {
port = "$3"; port = "$3";
} else { } else {
call("read", "-p", "Listening Port [$port]: ", "port"); call("read", "-p", "Listening Port [$defaultPort]: ", "port");
if (port == "") { if (port == "") {
port = defaultPort; port = defaultPort;
@ -114,7 +116,7 @@ if (type == "local") {
if ("$2" != "") { if ("$2" != "") {
installPath = "$2"; installPath = "$2";
} else { } else {
call("read", "-p", "Installation Path [$installPath]: ", "installPath"); call("read", "-p", "Installation Path [$defaultInstallPath]: ", "installPath");
if (installPath == "") { if (installPath == "") {
installPath = defaultInstallPath; installPath = defaultInstallPath;
@ -210,7 +212,7 @@ if (type == "local") {
if ("$3" != "") { if ("$3" != "") {
port = "$3"; port = "$3";
} else { } else {
call("read", "-p", "Expose Port [$port]: ", "port"); call("read", "-p", "Expose Port [$defaultPort]: ", "port");
if (port == "") { if (port == "") {
port = defaultPort; port = defaultPort;
@ -232,3 +234,5 @@ if (type == "local") {
bash("docker volume create $volume"); bash("docker volume create $volume");
bash("docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1"); bash("docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1");
} }
println("http://localhost:$port");

View File

@ -1,13 +1,13 @@
# install.sh is generated by ./extra/install.batsh, do not modify it directly. # install.sh is generated by ./extra/install.batsh, do not modify it directly.
# "npm run compile-install-script" to compile install.sh # "npm run compile-install-script" to compile install.sh
# The command is working on Windows PowerShell and Docker for Windows only. # The command is working on Windows PowerShell and Docker for Windows only.
# curl -o uptime-kuma-install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash uptime-kuma-install.sh
"echo" "-e" "=====================" "echo" "-e" "====================="
"echo" "-e" "Uptime Kuma Installer" "echo" "-e" "Uptime Kuma Installer"
"echo" "-e" "=====================" "echo" "-e" "====================="
"echo" "-e" "" "echo" "-e" "Supported OS: CentOS 7/8, Ubuntu >= 16.04 and Debian"
"echo" "-e" "---------------------------------------" "echo" "-e" "---------------------------------------"
"echo" "-e" "This script is designed for Linux and basic usage." "echo" "-e" "This script is designed for Linux and basic usage."
"echo" "-e" "Supported OS: CentOS 7/8, Ubuntu >= 16.04 and Debian"
"echo" "-e" "For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation" "echo" "-e" "For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation"
"echo" "-e" "---------------------------------------" "echo" "-e" "---------------------------------------"
"echo" "-e" "" "echo" "-e" ""
@ -89,7 +89,7 @@ fi
if [ "$3" != "" ]; then if [ "$3" != "" ]; then
port="$3" port="$3"
else else
"read" "-p" "Listening Port [$port]: " "port" "read" "-p" "Listening Port [$defaultPort]: " "port"
if [ "$port" == "" ]; then if [ "$port" == "" ]; then
port="$defaultPort" port="$defaultPort"
fi fi
@ -97,7 +97,7 @@ fi
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
installPath="$2" installPath="$2"
else else
"read" "-p" "Installation Path [$installPath]: " "installPath" "read" "-p" "Installation Path [$defaultInstallPath]: " "installPath"
if [ "$installPath" == "" ]; then if [ "$installPath" == "" ]; then
installPath="$defaultInstallPath" installPath="$defaultInstallPath"
fi fi
@ -177,7 +177,7 @@ fi
if [ "$3" != "" ]; then if [ "$3" != "" ]; then
port="$3" port="$3"
else else
"read" "-p" "Expose Port [$port]: " "port" "read" "-p" "Expose Port [$defaultPort]: " "port"
if [ "$port" == "" ]; then if [ "$port" == "" ]; then
port="$defaultPort" port="$defaultPort"
fi fi
@ -195,3 +195,4 @@ fi
docker volume create $volume docker volume create $volume
docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1 docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1
fi fi
"echo" "-e" "http://localhost:$port"