-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved lots of code into a subproject
I think stuff like zip and github installing belong in a repository dedicated to installing from github. Moved these libraries into a new project called grin (Github Release INstaller)
- Loading branch information
1 parent
7a6a8e0
commit b7b7b12
Showing
9 changed files
with
26 additions
and
1,629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "lasm"] | ||
path = lasm | ||
url = https://github.com/Yevano/LuaAssemblyTools.git | ||
[submodule "grin"] | ||
path = grin | ||
url = https://github.com/ElvishJerricco/Grin.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,7 @@ | ||
-- use build.xml to import the zip and json libraries directly | ||
|
||
local zip = setmetatable({}, {__index=getfenv()}) | ||
local json = setmetatable({}, {__index=getfenv()}) | ||
local base64 = setmetatable({}, {__index=getfenv()}) | ||
|
||
do | ||
local function zip_api_make() | ||
@ZIP@ | ||
end | ||
setfenv(zip_api_make, zip) | ||
zip_api_make() | ||
|
||
local function json_api_make() | ||
@JSON@ | ||
end | ||
setfenv(json_api_make, json) | ||
json_api_make() | ||
|
||
local function base64_api_make() | ||
@BASE64@ | ||
end | ||
setfenv(base64_api_make, base64) | ||
base64_api_make() | ||
end | ||
|
||
local oldTime = os.time() | ||
local function sleepCheckin() | ||
local newTime = os.time() | ||
if newTime - oldTime >= (0.020 * 1.5) then | ||
oldTime = newTime | ||
sleep(0) | ||
end | ||
local function grin(...) | ||
@GRIN@ | ||
end | ||
|
||
local function combine(path, ...) | ||
if not path then | ||
return "" | ||
end | ||
return fs.combine(path, combine(...)) | ||
end | ||
|
||
-- Begin installation | ||
|
||
local githubApiResponse = assert(http.get("https://api.github.com/repos/Yevano/JVML-JIT/releases")) | ||
assert(githubApiResponse.getResponseCode() == 200, "Failed github response") | ||
print("Got github response") | ||
local githubApiJSON = json.decode(githubApiResponse.readAll()) | ||
assert(githubApiJSON and | ||
githubApiJSON[1] and | ||
githubApiJSON[1].assets and | ||
githubApiJSON[1].assets[1] and | ||
githubApiJSON[1].assets[1].url, | ||
"Malformed response") | ||
print("Got JSON") | ||
local zipResponse = assert(http.get(githubApiJSON[1].assets[1].url, {["Accept"]="application/octet-stream"})) | ||
assert(zipResponse.getResponseCode() == 200 or zipResponse.getResponseCode() == 302, "Failed zip response") | ||
local base64Str = zipResponse.readAll() | ||
print("Decoding base64") | ||
sleep(0) | ||
local zipTbl = assert(base64.decode(base64Str), "Failed to decode base 64") | ||
print("Zip scanned. Unarchiving...") | ||
sleep(0) | ||
|
||
local i = 0 | ||
local zfs = zip.open({read=function() | ||
sleepCheckin() | ||
i = i + 1 | ||
return zipTbl[i] | ||
end}) | ||
|
||
local function copyFilesFromDir(dir) | ||
for i,v in ipairs(zfs.list(dir)) do | ||
sleepCheckin() | ||
local fullPath = fs.combine(dir, v) | ||
if zfs.isDir(fullPath) then | ||
copyFilesFromDir(fullPath) | ||
else | ||
print("Copying file: " .. fullPath) | ||
local fh = fs.open(combine(shell.dir(), "jvml", fullPath), "wb") | ||
local zfh = zfs.open(fullPath, "rb") | ||
for b in zfh.read do | ||
sleepCheckin() | ||
fh.write(b) | ||
end | ||
fh.close() | ||
zfh.close() | ||
end | ||
end | ||
end | ||
grin("-u", "Yevano", "-r", "JVML-JIT") | ||
|
||
copyFilesFromDir("") | ||
print("Installation complete. It is recommended that you add jvml/bin to your shell's path at startup") | ||
print("It is recommended that you add jvml/bin to your shell's path.") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.