forked from ItzLevvie/dogfood-msinternal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.js
50 lines (43 loc) · 2.51 KB
/
launch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use strict";
const https = require("https");
const getBranch = "Dogfood_DevMain";
const getFFN = "ea4a4090-de26-49d7-93c1-91bff9e53fc3";
const getBuild = "16.0.14021.20000";
function print(getBranch, getFFN, getBuild) {
console.log("sudo apt update > /dev/null 2>&1");
console.log("sudo apt install cabextract > /dev/null 2>&1");
console.log("");
console.log("wget http://officecdn.microsoft.com.edgesuite.net/pr/" + getFFN + "/Office/Data/" + getBuild + "/i640.cab -P ClickToRun > /dev/null 2>&1");
console.log("");
console.log("cabextract ClickToRun/i640.cab -d ClickToRun > /dev/null 2>&1");
console.log("rm ClickToRun/i640.cab");
console.log("");
console.log("{");
console.log(" echo \"@echo off\"");
console.log(" echo \"\"");
console.log(" echo \"if not exist \\\"%CommonProgramFiles%\\microsoft shared\\ClickToRun\\OfficeClickToRun.exe\\\" (\"");
console.log(" echo \" robocopy \\\"%~dp0ClickToRun\\\" \\\"%CommonProgramFiles%\\microsoft shared\\ClickToRun\\\" > nul 2>&1\"");
console.log(" echo \")\"");
console.log(" echo \"\"");
console.log(" echo \"if exist \\\"%CommonProgramFiles%\\microsoft shared\\ClickToRun\\OfficeClickToRun.exe\\\" (\"");
console.log(" echo \" start \\\"\\\" \\\"%CommonProgramFiles%\\microsoft shared\\ClickToRun\\OfficeClickToRun.exe\\\" platform=x64 culture=en-us productstoadd=O365ProPlusRetail.16_en-us_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/" + getFFN + " baseurl.16=http://officecdn.microsoft.com/pr/" + getFFN + " version.16=" + getBuild + " mediatype.16=CDN sourcetype.16=CDN O365ProPlusRetail.excludedapps.16=groove deliverymechanism=" + getFFN + "\"");
console.log(" echo \")\"");
console.log("} > launch.bat");
console.log("");
console.log("rm launch.js launch.sh > /dev/null 2>&1");
console.log("");
console.log("zip -r9 " + getBranch + "_" + getBuild + "_x64_O365ProPlusRetail_en-us.zip * > /dev/null 2>&1");
}
https.get("https://mrodevicemgr.officeapps.live.com/mrodevicemgrsvc/api/v2/C2RReleaseData?audienceFFN=" + getFFN, (getResponse) => {
getResponse.on("data", (getData) => {
if (getResponse.statusCode === 200) {
const getJSON = JSON.parse(getData);
const getBuild = getJSON.AvailableBuild;
print(getBranch, getFFN, getBuild);
} else if (getResponse.statusCode === 404) {
print(getBranch, getFFN, getBuild);
}
});
}).on("error", () => {
print(getBranch, getFFN, getBuild);
});