mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	auto upgrade packages on base opus update - github actions wip
This commit is contained in:
		
							
								
								
									
										33
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| # This is a basic workflow to help you get started with Actions | ||||
|  | ||||
| name: CI | ||||
|  | ||||
| # Controls when the action will run. Triggers the workflow on push or pull request | ||||
| # events but only for the master branch | ||||
| on: | ||||
|   push: | ||||
|     branches: [ develop-1.8 ] | ||||
|   pull_request: | ||||
|     branches: [ develop-1.8 ] | ||||
|  | ||||
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||||
| jobs: | ||||
|   # This workflow contains a single job called "build" | ||||
|   build: | ||||
|     # The type of runner that the job will run on | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     # Steps represent a sequence of tasks that will be executed as part of the job | ||||
|     steps: | ||||
|     # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||||
|     - uses: actions/checkout@v2 | ||||
|  | ||||
|     # Runs a single command using the runners shell | ||||
|     - name: Run a one-line script | ||||
|       run: ls | ||||
|  | ||||
|     # Runs a set of commands using the runners shell | ||||
|     - name: Run a multi-line script | ||||
|       run: | | ||||
|         date | ||||
|         echo test, and deploy your project. | ||||
| @@ -17,7 +17,7 @@ local page = UI.Page { | ||||
| 			UI:quit() | ||||
| 		end | ||||
|  | ||||
| 		return UI.FileSelect.eventHandler(self, event) | ||||
| 		return UI.Page.eventHandler(self, event) | ||||
| 	end, | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -16,9 +16,8 @@ local function makeSandbox() | ||||
| end | ||||
|  | ||||
| local function Syntax(msg) | ||||
| 	_G.printError(msg) | ||||
| 	print('\nSyntax: Package list | install [name] ... |  update [name] | uninstall [name]') | ||||
| 	error(0) | ||||
| 	print('Syntax: package list | install [name] ... |  update [name] | updateall | uninstall [name]\n') | ||||
| 	error(msg) | ||||
| end | ||||
|  | ||||
| local function progress(max) | ||||
| @@ -76,6 +75,11 @@ local function install(name, isUpdate, ignoreDeps) | ||||
| 	local packageDir = fs.combine('packages', name) | ||||
|  | ||||
| 	local list = Git.list(manifest.repository) | ||||
| 	-- clear out contents before install/update | ||||
| 	-- TODO: figure out whether to run | ||||
| 	-- install/uninstall for the package | ||||
| 	fs.delete(packageDir) | ||||
|  | ||||
| 	local showProgress = progress(Util.size(list)) | ||||
|  | ||||
| 	local getList = { } | ||||
| @@ -151,7 +155,7 @@ if action == 'uninstall' then | ||||
| 	runScript(manifest.uninstall) | ||||
|  | ||||
| 	local packageDir = fs.combine('packages', name) | ||||
| 	fs.delete(fs.resolve(packageDir)) | ||||
| 	fs.delete(packageDir) | ||||
| 	print('removed: ' .. packageDir) | ||||
| 	return | ||||
| end | ||||
|   | ||||
| @@ -12,7 +12,7 @@ for k,v in pairs(colors) do | ||||
| end | ||||
|  | ||||
| local allSettings = { } | ||||
| for k,v in pairs(UI.colors) do | ||||
| for k,v in pairs(UI.theme.colors) do | ||||
| 	allSettings[k] = { name = k, value = v } | ||||
| end | ||||
|  | ||||
|   | ||||
| @@ -1,24 +1,9 @@ | ||||
| local fs = _G.fs | ||||
| local fs    = _G.fs | ||||
| local shell = _ENV.shell | ||||
|  | ||||
| local function deleteIfExists(path) | ||||
| 	if fs.exists(path) then | ||||
| 		fs.delete(path) | ||||
| 		print("Deleted outdated file at: "..path) | ||||
| 	end | ||||
| if fs.exists('.opus_upgrade') then | ||||
| 	fs.delete('.opus_upgrade') | ||||
| 	print('Updating packages') | ||||
| 	shell.run('package updateall') | ||||
| 	os.reboot() | ||||
| end | ||||
| -- cleanup outdated files | ||||
| deleteIfExists('sys/apps/shell') | ||||
| deleteIfExists('sys/etc/app.db') | ||||
| deleteIfExists('sys/extensions') | ||||
| deleteIfExists('sys/network') | ||||
| deleteIfExists('startup') | ||||
| deleteIfExists('sys/apps/system/turtle.lua') | ||||
| deleteIfExists('sys/autorun/gps.lua') | ||||
| deleteIfExists('sys/autorun/gpshost.lua') | ||||
| deleteIfExists('sys/apps/network/redserver.lua') | ||||
| deleteIfExists('sys/apis') | ||||
| deleteIfExists('sys/autorun/apps.lua') | ||||
| deleteIfExists('sys/init/6.tl3.lua') | ||||
|  | ||||
| -- remove this file | ||||
| -- deleteIfExists('sys/autorun/upgraded.lua') | ||||
| @@ -7,9 +7,10 @@ Shell usage: | ||||
| > package list | ||||
| > package install <name> | ||||
| > package update <name> | ||||
| > package updateall | ||||
| > package uninstall <name> | ||||
| 
 | ||||
| Package definitions are located in usr/apps/packages. This file can be modified to add custom packages. | ||||
| Package definitions are located in usr/config/packages. This file can be modified to add custom packages. | ||||
| 
 | ||||
| Current stable packages | ||||
| ======================= | ||||
| @@ -47,13 +47,13 @@ function Entry:updateScroll() | ||||
| 		self.scroll = 0 -- ?? | ||||
| 	end | ||||
| 	if self.pos - self.scroll > self.width then | ||||
| 		self.scroll = self.pos - self.width | ||||
| 		self.scroll = math.max(0, self.pos - self.width) | ||||
| 	elseif self.pos < self.scroll then | ||||
| 		self.scroll = self.pos | ||||
| 	end | ||||
| 	if self.scroll > 0 then | ||||
| 		if self.scroll + self.width  > len then | ||||
| 			self.scroll = len - self.width | ||||
| 			self.scroll = math.max(0, len - self.width) | ||||
| 		end | ||||
| 	end | ||||
| 	if ps ~= self.scroll then | ||||
|   | ||||
| @@ -37,13 +37,14 @@ local textutils  = _G.textutils | ||||
| local UI = { } | ||||
| function UI:init() | ||||
| 	self.devices = { } | ||||
| 	self.theme = { } | ||||
| 	self.extChars = Util.getVersion() >= 1.76 | ||||
| 	self.colors = { | ||||
| 		primary = colors.green, | ||||
| 		secondary = colors.lightGray, | ||||
| 		tertiary = colors.gray, | ||||
| 	self.theme = { | ||||
| 		colors = { | ||||
| 			primary = colors.green, | ||||
| 			secondary = colors.lightGray, | ||||
| 			tertiary = colors.gray, | ||||
| 		} | ||||
| 	} | ||||
| 	self.extChars = Util.getVersion() >= 1.76 | ||||
|  | ||||
| 	local function keyFunction(event, code, held) | ||||
| 		local ie = Input:translate(event, code, held) | ||||
| @@ -206,6 +207,10 @@ function UI:loadTheme(filename) | ||||
| 		end | ||||
| 		Util.deepMerge(self.theme, theme) | ||||
| 	end | ||||
| 	for k,v in pairs(self.theme.colors) do | ||||
| 		Canvas.colorPalette[k] = Canvas.colorPalette[v] | ||||
| 		Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v] | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function UI:generateTheme(filename) | ||||
| @@ -920,6 +925,13 @@ function UI.Window:addTransition(effect, args, canvas) | ||||
| 	self.parent:addTransition(effect, args, canvas or self) | ||||
| end | ||||
|  | ||||
| UI.Window.docs.emit = [[emit(TABLE event) | ||||
| Send an event to the element. The event handler for the element is called. | ||||
| If the event handler returns true, then no further processing is done. | ||||
| If the event handler does not return true, then the event is sent to the parent element | ||||
| and continues up the element tree. | ||||
| If an accelerator is defined, the accelerated event is processed in the same manner. | ||||
| Accelerators are useful for making events unique.]] | ||||
| function UI.Window:emit(event) | ||||
| 	local parent = self | ||||
| 	while parent do | ||||
| @@ -1118,13 +1130,6 @@ end | ||||
|  | ||||
| loadComponents() | ||||
| UI:loadTheme('usr/config/ui.theme') | ||||
| Util.merge(UI.Window.defaults, UI.theme.Window) | ||||
| Util.merge(UI.colors, UI.theme.colors) | ||||
| UI:setDefaultDevice(UI.Device()) | ||||
|  | ||||
| for k,v in pairs(UI.colors) do | ||||
| 	Canvas.colorPalette[k] = Canvas.colorPalette[v] | ||||
| 	Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v] | ||||
| end | ||||
|  | ||||
| return UI | ||||
|   | ||||
| @@ -40,7 +40,7 @@ function UI.Chooser:draw() | ||||
| 	local value = choice and choice.name or self.nochoice | ||||
|  | ||||
| 	self:write(1, 1, self.leftIndicator, self.backgroundColor, colors.black) | ||||
| 	self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width-4) .. ' ', bg, fg) | ||||
| 	self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width - 4) .. ' ', bg, fg) | ||||
| 	self:write(self.width, 1, self.rightIndicator, self.backgroundColor, colors.black) | ||||
| end | ||||
|  | ||||
| @@ -54,7 +54,7 @@ function UI.Chooser:eventHandler(event) | ||||
| 		local choice | ||||
| 		if not k then k = 0 end | ||||
| 		if k and k < #self.choices then | ||||
| 			choice = self.choices[k+1] | ||||
| 			choice = self.choices[k + 1] | ||||
| 		else | ||||
| 			choice = self.choices[1] | ||||
| 		end | ||||
| @@ -62,11 +62,12 @@ function UI.Chooser:eventHandler(event) | ||||
| 		self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) | ||||
| 		self:draw() | ||||
| 		return true | ||||
|  | ||||
| 	elseif event.type == 'choice_prev' then | ||||
| 		local _,k = Util.find(self.choices, 'value', self.value) | ||||
| 		local choice | ||||
| 		if k and k > 1 then | ||||
| 			choice = self.choices[k-1] | ||||
| 			choice = self.choices[k - 1] | ||||
| 		else | ||||
| 			choice = self.choices[#self.choices] | ||||
| 		end | ||||
| @@ -74,6 +75,7 @@ function UI.Chooser:eventHandler(event) | ||||
| 		self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) | ||||
| 		self:draw() | ||||
| 		return true | ||||
|  | ||||
| 	elseif event.type == 'mouse_click' or event.type == 'mouse_doubleclick' then | ||||
| 		if event.x == 1 then | ||||
| 			self:emit({ type = 'choice_prev' }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kepler155c@gmail.com
					kepler155c@gmail.com