Jump to content




OmniOS - The OS than can do (almost) anything


192 replies to this topic

Poll: OmniOS

How would you rate OmniOS?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.

Do you like OmniOS?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.

What do you want to be improved?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote Guests cannot vote

#161 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 05 October 2016 - 08:16 PM

View PostSewbacca, on 05 October 2016 - 08:14 PM, said:

You can simplify the if statements (maybe it decrease your performance, idk):
if mode:match '^[aw]b?$' then

Smart one, I'll definitely see if it increases performance!

And thanks!

#162 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 05 October 2016 - 08:18 PM

View PostCreator, on 05 October 2016 - 08:16 PM, said:

View PostSewbacca, on 05 October 2016 - 08:14 PM, said:

You can simplify the if statements (maybe it decrease your performance, idk):
if mode:match '^[aw]b?$' then

Smart one, I'll definitely see if it increases performance!

And thanks!

I meant decrease, because here is a function called.

#163 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 05 October 2016 - 08:19 PM

Oh, brain fart. Probably it'll be slower, but trying doesn't hurt.

#164 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 06 October 2016 - 09:48 PM

What did i do wrong?
I ran the installer and choosed latest.
I get an OmniOS shell?
And there isn't a help program?
Whaaaaaaaat?

#165 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 07 October 2016 - 04:10 AM

oh sorry bout that. I have yet to do that. In the meantime, try "list /OmniOS/usr/bin" and experiment around.

Edited by Creator, 07 October 2016 - 04:11 AM.


#166 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 07 October 2016 - 05:59 PM

Currently writing the documentation for OmniOS. Expect it to be ready soon. It will be located in OmniOS/doc

#167 Piorjade

  • Members
  • 244 posts
  • LocationComputer, Germany

Posted 07 October 2016 - 10:07 PM

I'm not quite sure if I'm allowed to do this, but I want to help you out a bit :P

When entering a non-existing path in list(.lua) it ends up being stuck and needs a reboot.
Here's the fixed code:
--[[
	Shell script: list by Creator
	for OmniOS
]]--

local path = (...) or getPath()


if fs.isDir(path) then
	for i, v in pairs(fs.list(path)) do
		if fs.isDir(path.."/"..v) then
			term.setTextColor(colors.green)
			print(v)
		else
			term.setTextColor(colors.white)
			print(v)
		end
	end
else
	term.setTextColor(colors.red)
	print("Not a directory.")
end

term.setTextColor(colors.white)

I'd be glad if I helped you out, maybe going to post further bugs when I find some.

EDIT:
This problem occurs on cat too, if you enter a folder.

New code:
--[[
    Shell script: cat by Creator
    for OmniOS
]]--

local path = (...) or getPath()

if fs.exists(path) and not fs.isDir(path) then
    local file = fs.open(path,"r")
    local data = file.readAll()
    file.close()
    print(data)
elseif fs.isDir(path) then
    term.setTextColor(colors.red)
    print("Path is a folder.")
else
    print("File does not exist.")
end

Edited by Piorjade, 07 October 2016 - 10:11 PM.


#168 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 08 October 2016 - 12:56 PM

View PostPiorjade, on 07 October 2016 - 10:07 PM, said:

I'm not quite sure if I'm allowed to do this, but I want to help you out a bit :P

When entering a non-existing path in list(.lua) it ends up being stuck and needs a reboot.
Here's the fixed code:
--[[
	Shell script: list by Creator
	for OmniOS
]]--

local path = (...) or getPath()


if fs.isDir(path) then
	for i, v in pairs(fs.list(path)) do
		if fs.isDir(path.."/"..v) then
			term.setTextColor(colors.green)
			print(v)
		else
			term.setTextColor(colors.white)
			print(v)
		end
	end
else
	term.setTextColor(colors.red)
	print("Not a directory.")
end

term.setTextColor(colors.white)

I'd be glad if I helped you out, maybe going to post further bugs when I find some.

EDIT:
This problem occurs on cat too, if you enter a folder.

New code:
--[[
	Shell script: cat by Creator
	for OmniOS
]]--

local path = (...) or getPath()

if fs.exists(path) and not fs.isDir(path) then
	local file = fs.open(path,"r")
	local data = file.readAll()
	file.close()
	print(data)
elseif fs.isDir(path) then
	term.setTextColor(colors.red)
	print("Path is a folder.")
else
	print("File does not exist.")
end

Thanks a lot!

I made the suggested changes and gave you credit in the scripts themselves.

#169 Piorjade

  • Members
  • 244 posts
  • LocationComputer, Germany

Posted 08 October 2016 - 06:34 PM

No problem :)

EDIT:
Looks like you didn't upload it yet :P

Anyways, this rewrite looks quite good ! :)

Edited by Piorjade, 08 October 2016 - 08:47 PM.


#170 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 October 2016 - 08:29 PM

Devfs is now working quite well. When assigning devfs to a directory, it reads and loads all the files in it. They can then be opened like normal files and will return some output. For example (zero device):

--[[
Zero device
]]
local function instance(mode)
if mode == "r" then
  local handle = {}
  function handle.readLine()
   return "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  end

  function handle.readAll()
   return "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  end

  function handle.close()
   handle.readLine = nil
   handle.readAll = nil
   handle.close = nil
  end

  return handle
elseif mode == "rb" then
  local handle = {}

  function handle.read()
   read "\0"
  end

  function handle.close()
   handle.read = nil
   handle.close = nil
  end

  return handle
elseif mode == "w" or mode == "a" or mode == "wb" or mode == "ab" then -- try if mode:match '^[aw]b?$' then
  local handle = {}
  function handle.write(input)
  end
  function handle.writeLine(input)
  
  end
  function handle.flush()
  end
  function handle.close()
   handle.write = nil
   handle.writeLine = nil
   handle.flush = nil
   handle.close = nil
  end
  return handle
end
end
return instance

Once the new filesystem has been set, the contents will be compiled, and a function is returned that can then be called when the file is opened. When the file is read from, it returns a bunch of zeroes. I hope this explanation kind of makes sense.

#171 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 10 October 2016 - 08:48 PM

View PostCreator, on 10 October 2016 - 08:29 PM, said:

Devfs is now working quite well. When assigning devfs to a directory, it reads and loads all the files in it. They can then be opened like normal files and will return some output. For example (zero device):
-- snippet --
Once the new filesystem has been set, the contents will be compiled, and a function is returned that can then be called when the file is opened. When the file is read from, it returns a bunch of zeroes. I hope this explanation kind of makes sense.

I don't see the sense of a handle, returning just zeros.

#172 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 October 2016 - 09:47 PM

That is what the zero device does. Other devices have different functions, like for example the random or urandom device. Or TTY.

#173 lkmnds

  • Members
  • 25 posts
  • LocationBrazil

Posted 10 October 2016 - 11:30 PM

Shouldn't the zero device return the number of zeros that you want and not a predetermined string?

like implementing a bytes argument in handle.read()

function handle.read(bytes)
	local result = ""
	-- check if bytes is less than 1, if it is a number, etc
	for i=1,bytes do
		result = result .. "\0"
	end
	return result
end

Edited by lkmnds, 10 October 2016 - 11:34 PM.


#174 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 October 2016 - 04:09 AM

Easier and faster:

return string.rep("\0", bytes)


#175 ell

  • Members
  • 232 posts

Posted 11 October 2016 - 04:38 AM

View PostLyqyd, on 11 October 2016 - 04:09 AM, said:

Easier and faster:

return string.rep("\0", bytes)

aaand smaller!
return ("\0"):rep(bytes)


#176 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 11 October 2016 - 09:02 AM

View PostLyqyd, on 11 October 2016 - 04:09 AM, said:

Easier and faster:

return string.rep("\0", bytes)

The idea is to provide a continuous stream, which I have yet to implement. And I know that this way is easier, but I'm trying to stay truthful to some linux features because they are awesome.

Edited by Creator, 11 October 2016 - 05:34 PM.


#177 Piorjade

  • Members
  • 244 posts
  • LocationComputer, Germany

Posted 11 October 2016 - 01:09 PM

Hands down, we never had to go to TLCO level just to make our OSes, hell you could just make it ontop of that and if you want to prevent TLCO, just run TLCO and make such a kind of running shell and rednet, that no matter if rednet crashes , it continues running shell and / or restart rednet. Aaand then build your OS ontop of shell :P

Tho we still kick out shell for fun / make it look cooler / make it maybe even more secure (which is honestly not that needed. :P )

My purpose for cLinux is fun :D

#178 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 11 October 2016 - 04:48 PM

View PostCreator, on 11 October 2016 - 09:02 AM, said:

View PostLyqyd, on 11 October 2016 - 04:09 AM, said:

Easier and faster:
 return string.rep("\0", bytes) 
The idea is to provide a continuous stream, which I have yet to implement. And I know that this way is easier, but im trying to stay truthfull to linux.

Well, i thought you are programming on OmniOS, not on a Linux OS.
I think that we have to develop OSes for CC, not to replicate already existing OSes.
Our OSes should be unique.
Yes, there is a ccLinux and it is okay, because it is not a replicate with another name.
I think the idea behind CC OSes are to implement features, like a desktop environment or a piping system,
but not the working wise (You know what i mean). Maybe i got you wrong, so correct me if i am wrong.
Sewbacca

Edited by Sewbacca, 16 October 2016 - 04:10 PM.


#179 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 11 October 2016 - 05:33 PM

View PostSewbacca, on 11 October 2016 - 04:48 PM, said:

View PostCreator, on 11 October 2016 - 09:02 AM, said:

View PostLyqyd, on 11 October 2016 - 04:09 AM, said:

Easier and faster:
 return string.rep("\0", bytes) 
The idea is to provide a continuous stream, which I have yet to implement. And I know that this way is easier, but im trying to stay truthfull to linux.

Well, i thought you are programmin on OmniOS, not on a Linux OS.
I think that we have to develop OSes for CC, not to replicate already existing OSes.
Our OSes should be unique.
Yes, there is a ccLinux and it is okay, because it is not a replicate with another name.
I think the idea behind CC OSes are to implement features, like a desktop environment or a piping system,
but not the working wise (You know what i mean). Maybe i got you wrong, so correct me if i am wrong.
Sewbacca

I just think that devices are a neat idea and that I should implement them into OmniOS. It is true that I got the idea from Linux, but me saying that I am staying truthful to Linux was an overstatement. I just think that some of the features are nice and I plan to implement them.

#180 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 13 October 2016 - 06:29 PM

A small update:
  • removed useless code, reducing OS size.
  • fixed a few kernel issues
  • discovered a whole new set vulnerabilities






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users