#1 fix and #3 fix for edge

This commit is contained in:
2024-11-23 13:22:49 +01:00
parent edcfa6110a
commit 77fbcb9b31
4 changed files with 20 additions and 8 deletions

View File

@@ -25,14 +25,26 @@ Linux only scripts.
### The 4 branches ### The 4 branches
Which branch works best for you? Which branch works best for you?
Well, that's pretty simple. We have 4 branches (`main`, `next`, `edge` and `no-posix`). Well, that's pretty simple. We have 4 branches (`main`, `next`, `edge` and `no-posix`).
If you want the most stable experience, then the `main` branch is for you. If you want the most stable experience, then the `main` branch is for you.
If you want the lastest features, but also a more stable experience (compared to `edge`), If you want the lastest features, but also a more stable experience (compared to `edge`),
then the `next` branch is for you then the `next` branch is for you
If you want the bleeding-edge and don't care about stability, then `edge` is for you. If you want the bleeding-edge and don't care about stability, then `edge` is for you.
If you only need simple jailing and no POSIX compatibility, then `no-posix` is for you. If you only need simple jailing and no POSIX compatibility, then `no-posix` is for you.
### Issues ### Issues
Please report issues [over here](https://git.novacow.ch/Nova/PyJail/issues/) Please report issues [over here](https://git.novacow.ch/Nova/PyJail/issues/)
And please check if your issue isn't a duplicate before reporting. And please check if your issue isn't a duplicate before reporting.

View File

@@ -1 +1 @@
edge0004-base0.2.1 edge0005-base0.2.1

View File

@@ -1,6 +1,6 @@
""" """
This is the PyJail, a jailing tool for running Python apps in a sandboxed environment. This is the PyJail, a jailing tool for running Python apps in a sandboxed environment.
Version: edge0004-base0.2.1 Version: edge0005-base0.2.1
""" """
import os import os
import time import time
@@ -58,10 +58,10 @@ class PyJail:
msg = f"[{time.time}] [{caller}] [{log_level}] {message}" msg = f"[{time.time}] [{caller}] [{log_level}] {message}"
with open(self.fs("/proc/klog"), "a+") as f: with open(self.fs("/proc/klog"), "a+") as f:
f.write(msg) f.write(msg)
if emit is True and (log_level.upper() == "ERROR" or log_level.upper() == "CRITICAL"): if emit is True and log_level.upper() == "CRITICAL":
print(msg) print(msg)
elif emit is True: elif emit is True:
print(message)
return 0 return 0
def fs(self, check_path=None, resolve_symlinks=True): def fs(self, check_path=None, resolve_symlinks=True):
@@ -137,7 +137,7 @@ class PyJail:
""" """
Returns the kernel version Returns the kernel version
""" """
return "edge0004-base0.2.1" return "edge0005-base0.2.1"
def netsock(self, ip, port, mode, msg): def netsock(self, ip, port, mode, msg):
""" """

6
sh.py
View File

@@ -1,6 +1,6 @@
""" """
The shell for PyNVOS The shell for PyNVOS
Version: 0.2.0.0400 Version: 0.2.0.0401
""" """
import importlib import importlib
import os import os
@@ -13,7 +13,7 @@ class shell(cmd.Cmd):
jail_mgr = importlib.import_module(".jail_mgr", "vfs.sys") jail_mgr = importlib.import_module(".jail_mgr", "vfs.sys")
jailmgr = jail_mgr.PyJail() jailmgr = jail_mgr.PyJail()
kver = jailmgr.kver() kver = jailmgr.kver()
intro = f"Shell started, PyNVOS {kver}" intro = f"Shell started, PyJail {kver}"
prompt = "shell-0.2$ " prompt = "shell-0.2$ "
file = None file = None
@@ -47,7 +47,7 @@ class shell(cmd.Cmd):
with open(self.jailmgr.fs(f"/usr/pkgs/metacache/{pkg}.pmd"), "r") as f: with open(self.jailmgr.fs(f"/usr/pkgs/metacache/{pkg}.pmd"), "r") as f:
package_meta = f.read() package_meta = f.read()
f.close() f.close()
print(package_meta) self.jailmgr.msg("shell.do_pkg", package_meta, True, "INFO")
y_n_confirmation = input("Do you want to install this package? [y/N] ") y_n_confirmation = input("Do you want to install this package? [y/N] ")
if y_n_confirmation.lower() != "y": if y_n_confirmation.lower() != "y":
print("Aborted.") print("Aborted.")