Grab v2.4.10.13-alpha

Installer now receives Grab commandline options.
master
Kirigaya Kazuto 2019-01-17 20:13:10 +08:00
parent 7b0860de1b
commit e56d093ccf
2 changed files with 19 additions and 8 deletions

View File

@ -9,9 +9,10 @@ local event=require('event')
local term=require('term')
local args,options=shell.parse(...)
local grab_version="Grab v2.4.10.12-alpha"
local grab_version_info={
version=grab_version
local grab_version="Grab v2.4.10.13-alpha"
local grab_infos={
version=grab_version,
grab_options=options
}
local usage_text=[===[Grab - Official OpenComputerScripts Installer
@ -73,7 +74,7 @@ Notice:
Installer
A package can provide an installer for Grab. It will be loaded and executed after the package is ready.
Thus require(...) calls on depended libraries is ok.
From Grab v2.4.6, installer should return a function, which will be later called with a table filled with some information. (Currently, it contains version tag of Grab.)
From Grab v2.4.6, installer should return a function, which will be later called with a table filled with some information.
If nothing is returned, Grab will give an warning and ignore it.
From Grab v2.4.8, option `installer` is deprecated. Use __installer__ instead.
]===]
@ -1097,7 +1098,7 @@ if(args[1]=="install") then
if(not ok) then
print("[Installer Error]: " .. xerr)
elseif(type(xerr)=="function") then
if(not pcall(xerr,grab_version_info)) then
if(not pcall(xerr,grab_infos)) then
print("[Installer Error]: " .. xerr)
else
has_installed[this_lib]=true

View File

@ -1,3 +1,13 @@
print("Thank you for installing Grab - The official OpenComputerScripts Installer.")
os.execute("grab update")
print("Programs info has been updated.")
local function grab_installer(info)
print("Thank you for installing Grab - The official OpenComputerScripts Installer.")
print("Installer Loaded by: " .. info.version)
if(info.grab_options and info.grab_options["cn"]) then
print("China mirror detected.")
os.execute("grab update --cn")
else
os.execute("grab update")
end
print("Programs info has been updated.")
end
return grab_installer