Formatting and some completion to install script
This commit is contained in:
40
sh.py
40
sh.py
@@ -1,14 +1,14 @@
|
||||
"""
|
||||
The shell for PyNVOS
|
||||
Version: 0.2.0.0401
|
||||
Version: 0.2.0.0402
|
||||
"""
|
||||
|
||||
import importlib
|
||||
import os
|
||||
import cmd
|
||||
import shutil
|
||||
|
||||
# from ..sys.krnl import Kernel
|
||||
print(__name__)
|
||||
|
||||
class shell(cmd.Cmd):
|
||||
jail_mgr = importlib.import_module(".jail_mgr", "vfs.sys")
|
||||
jailmgr = jail_mgr.PyJail()
|
||||
@@ -42,9 +42,17 @@ class shell(cmd.Cmd):
|
||||
|
||||
def do_pkg(self, pkg):
|
||||
"""Downloads packages over the internet."""
|
||||
self.jailmgr.netsock(f"https://pkg.novacow.ch/repo/{kver}/meta/{pkg}.pmd", None, "PKG", f"{pkg}")
|
||||
shutil.copy(self.jailmgr.fs(f"/usr/netsock/cache/{pkg}.pmd"), self.jailmgr.fs(f"/usr/pkg/metacache/"))
|
||||
with open(self.jailmgr.fs(f"/usr/pkgs/metacache/{pkg}.pmd"), "r") as f:
|
||||
self.jailmgr.netsock(
|
||||
f"https://pkg.novacow.ch/repo/{self.kver}/meta/{pkg}.pmd",
|
||||
None,
|
||||
"PKG",
|
||||
f"{pkg}",
|
||||
)
|
||||
shutil.copy(
|
||||
self.jailmgr.fs(f"/usr/netsock/cache/{pkg}.pmd"),
|
||||
self.jailmgr.fs("/usr/pkg/metacache/"),
|
||||
)
|
||||
with open(self.jailmgr.fs(f"/usr/pkg/metacache/{pkg}.pmd"), "r") as f:
|
||||
package_meta = f.read()
|
||||
f.close()
|
||||
self.jailmgr.msg("shell.do_pkg", package_meta, True, "INFO")
|
||||
@@ -52,16 +60,26 @@ class shell(cmd.Cmd):
|
||||
if y_n_confirmation.lower() != "y":
|
||||
print("Aborted.")
|
||||
return
|
||||
self.jailmgr.netsock(f"https://pkg.novacow.ch/repo/{kver}/main/static/binary/{pkg}.py", None, "PKG", f"{pkg}")
|
||||
shutil.copy(self.jailmgr.fs(f"/usr/netsock/cache/{pkg}.py"), self.jailmgr.fs(f"/usr/bin/"))
|
||||
self.jailmgr.netsock(
|
||||
f"https://pkg.novacow.ch/repo/{self.kver}/main/static/binary/{pkg}.py",
|
||||
None,
|
||||
"PKG",
|
||||
f"{pkg}",
|
||||
)
|
||||
shutil.copy(
|
||||
self.jailmgr.fs(f"/usr/netsock/cache/{pkg}.py"),
|
||||
self.jailmgr.fs("/usr/bin/"),
|
||||
)
|
||||
|
||||
def postloop(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '<run_path>':
|
||||
if __name__ == "<run_path>":
|
||||
shell().cmdloop()
|
||||
if __name__ == '__main__':
|
||||
print("The shell can't be ran as a standalone program and must be ran in conjunction with the jail manager.")
|
||||
if __name__ == "__main__":
|
||||
print(
|
||||
"The shell can't be ran as a standalone program and must be ran in conjunction with the jail manager."
|
||||
)
|
||||
input("Press Enter to continue...")
|
||||
exit(-1)
|
||||
|
Reference in New Issue
Block a user