summaryrefslogtreecommitdiffstats
path: root/extra/uptime-kuma-push/build.js
diff options
context:
space:
mode:
Diffstat (limited to 'extra/uptime-kuma-push/build.js')
-rw-r--r--extra/uptime-kuma-push/build.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/extra/uptime-kuma-push/build.js b/extra/uptime-kuma-push/build.js
new file mode 100644
index 0000000..3dc8bf4
--- /dev/null
+++ b/extra/uptime-kuma-push/build.js
@@ -0,0 +1,48 @@
+const fs = require("fs");
+const platform = process.argv[2];
+
+if (!platform) {
+ console.error("No platform??");
+ process.exit(1);
+}
+
+const supportedPlatforms = [
+ {
+ name: "linux/amd64",
+ bin: "./build/uptime-kuma-push-amd64"
+ },
+ {
+ name: "linux/arm64",
+ bin: "./build/uptime-kuma-push-arm64"
+ },
+ {
+ name: "linux/arm/v7",
+ bin: "./build/uptime-kuma-push-armv7"
+ }
+];
+
+let platformObj = null;
+
+// Check if the platform is supported
+for (let i = 0; i < supportedPlatforms.length; i++) {
+ if (supportedPlatforms[i].name === platform) {
+ platformObj = supportedPlatforms[i];
+ break;
+ }
+}
+
+if (platformObj) {
+ let filename = platformObj.bin;
+
+ if (!fs.existsSync(filename)) {
+ console.error(`prebuilt: ${filename} is not found, please build it first`);
+ process.exit(1);
+ }
+
+ fs.renameSync(filename, "./uptime-kuma-push");
+ process.exit(0);
+} else {
+ console.error("Unsupported platform: " + platform);
+ process.exit(1);
+}
+