mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Grab v2.4.10.13-alpha
Installer now receives Grab commandline options.
This commit is contained in:
parent
7b0860de1b
commit
e56d093ccf
11
grab.lua
11
grab.lua
|
@ -9,9 +9,10 @@ local event=require('event')
|
||||||
local term=require('term')
|
local term=require('term')
|
||||||
local args,options=shell.parse(...)
|
local args,options=shell.parse(...)
|
||||||
|
|
||||||
local grab_version="Grab v2.4.10.12-alpha"
|
local grab_version="Grab v2.4.10.13-alpha"
|
||||||
local grab_version_info={
|
local grab_infos={
|
||||||
version=grab_version
|
version=grab_version,
|
||||||
|
grab_options=options
|
||||||
}
|
}
|
||||||
|
|
||||||
local usage_text=[===[Grab - Official OpenComputerScripts Installer
|
local usage_text=[===[Grab - Official OpenComputerScripts Installer
|
||||||
|
@ -73,7 +74,7 @@ Notice:
|
||||||
Installer
|
Installer
|
||||||
A package can provide an installer for Grab. It will be loaded and executed after the package is ready.
|
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.
|
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.
|
If nothing is returned, Grab will give an warning and ignore it.
|
||||||
From Grab v2.4.8, option `installer` is deprecated. Use __installer__ instead.
|
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
|
if(not ok) then
|
||||||
print("[Installer Error]: " .. xerr)
|
print("[Installer Error]: " .. xerr)
|
||||||
elseif(type(xerr)=="function") then
|
elseif(type(xerr)=="function") then
|
||||||
if(not pcall(xerr,grab_version_info)) then
|
if(not pcall(xerr,grab_infos)) then
|
||||||
print("[Installer Error]: " .. xerr)
|
print("[Installer Error]: " .. xerr)
|
||||||
else
|
else
|
||||||
has_installed[this_lib]=true
|
has_installed[this_lib]=true
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
print("Thank you for installing Grab - The official OpenComputerScripts Installer.")
|
local function grab_installer(info)
|
||||||
os.execute("grab update")
|
print("Thank you for installing Grab - The official OpenComputerScripts Installer.")
|
||||||
print("Programs info has been updated.")
|
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
|
Loading…
Reference in New Issue
Block a user