This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kepler's profile picture

Application Installer

Started by Kepler, 27 December 2016 - 09:06 PM
Kepler #1
Posted 27 December 2016 - 10:06 PM
A UI for installing files from pastebin or git.



Creating your own installer
Make a copy of QzyKRFgK on pastebin and fill out the relevant fields.
Modify the steps section if needed.

Running the installer
The installer provides several "steps" such as: install, uninstall, update.
The default is install. You can pass the step as an argument when running the installer. Example:
pastebin run XXXXXX uninstall.

Sample Installer
Spoiler

install = {
  title	   = 'Example Program',
  version	 = '1.0',
  author	  = 'yourname',
  description = [[
Provide a description
Can be multiline, word wrapping will occur on smaller screens
]],
  license = [[
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.]],
  copyrightYear = 2016,
  copyrightHolders = 'yourname',
  -- either list files
  files = {
	[ 'dir1/somefile1' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'dir1/somefile2' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'dir2/somefile3' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'dir2/somefile4' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'somefile5' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'somefile6' ] = 'http://pastebin.com/raw/Cmnq3tgk',
	[ 'somefile7' ] = 'http://pastebin.com/raw/Cmnq3tgk',
  },
  -- or supply git repo info
  --gitUser   = 'user',
  --gitRepo   = 'repo',
  --gitBranch = 'branch',
  steps = {  -- the screens that will be displayed during install
	install = { -- configure entries as desired
	  'splash',
	  'license',
	  'files',
	  'review',
	  'install', -- must be last
	},
	update = {
	  'review',
	  'install', -- must be last
	},
	automatic = {	-- no user interaction - can only contain 1 entry
	  'install',
	},
	uninstall = {
	  'review',
	  'uninstall', -- must be last
	},
  },
  -- all following are optional
  directory   = 'test',	-- install into specific directory
  rebootAfter = false,	 -- If a reboot is required after installation
  diskspace   = 40000,	 -- approximate disk space required
}
print('Downloading Installer...')
local h = http.get('http://pastebin.com/raw/598YVLuc')
if not h then
  error('Failed to download installer')
end
local contents = h.readAll()
if not contents then
  error('Failed to download installer')
end
local fn, msg = load(contents, 'Installer.lua', nil, getfenv(1))
if fn then
  fn(...)
else
  error(msg)
end

Installer code (for the interested): 598YVLuc
Cross_Sans #2
Posted 01 January 2017 - 12:20 PM
Amazing :o/> !