Finish implementation of proot to support Dotnet and JVM

This commit is contained in:
Vinicius Silva 2023-05-20 17:26:57 -03:00
parent 1409610025
commit 9174121cd8
2 changed files with 9 additions and 19 deletions

View File

@ -17,17 +17,8 @@ class Danix():
@staticmethod
def rm(filesystem_name):
os.system(f'fuser -km {MAIN_REPO}{filesystem_name}/danixfs/proc/')
os.system(f"umount {MAIN_REPO}{filesystem_name}/danixfs/proc/ ")
os.system(f'fuser -km {MAIN_REPO}{filesystem_name}/danixfs/sys/')
os.system(f"umount {MAIN_REPO}{filesystem_name}/danixfs/sys/ >/dev/null 2>&1")
os.system(f'fuser -km {MAIN_REPO}{filesystem_name}/danixfs/dev/')
os.system(f"umount {MAIN_REPO}{filesystem_name}/danixfs/dev/ >/dev/null 2>&1")
#return os.system(f"rm -r {MAIN_REPO}{filesystem_name}")
return os.system(f"rm -r {MAIN_REPO}{filesystem_name}")
@staticmethod
def get_size(environment_name, snapshot_name):
@ -70,8 +61,7 @@ class Danix():
@staticmethod
def navigate(filesystem_uuid):
return os.system(f"chroot {MAIN_REPO}{filesystem_uuid}/danixfs sh {MAIN_REPO}init.d/init.sh")
return os.system(f"{MAIN_REPO}{filesystem_uuid}/danixfs/proot -r {MAIN_REPO}{filesystem_uuid}/danixfs/ -w / -0 -b /dev -b /sys -b /proc -b /run sh {MAIN_REPO}init.d/init.sh")
@staticmethod
def build_environment(packages, config_comands, filesystem_uuid):
@ -83,10 +73,6 @@ class Danix():
os.system(f"rm /tmp/{filesystem}/{settings.ROOT_FS}")
os.system(f"mv /tmp/{filesystem} {MAIN_REPO}")
os.system(f"mount --bind /proc/ {MAIN_REPO}{filesystem_uuid}/danixfs/proc/")
os.system(f"mount --bind /sys/ {MAIN_REPO}{filesystem_uuid}/danixfs/sys/")
os.system(f"mount --bind /dev/ {MAIN_REPO}{filesystem_uuid}/danixfs/dev/")
print("\nPlease! Wait a moment!!")
print("Building container:")
print(f"Installing {len(packages)} packages\n")
@ -101,7 +87,11 @@ class Danix():
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs apk add ruby")
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs gem install lolcat")
os.system(f"rm -r {MAIN_REPO}{filesystem}/danixfs/dev >/dev/null 2>&1")
os.system(f"rm -r {MAIN_REPO}{filesystem}/danixfs/proc >/dev/null 2>&1")
os.system(f"rm -r {MAIN_REPO}{filesystem}/danixfs/sys >/dev/null 2>&1")
print(f"Environment builded succesfully!")
print("0 erros reported!")
Danix.navigate(filesystem)
Danix.navigate(filesystem)

View File

@ -4,7 +4,7 @@ from danixfs import Danix
from utils import check_equal_sentence
class Essentials():
packages = ["build-base", "vim", "nano", "micro", "git"]
packages = ["build-base", "vim","emacs","nano", "micro", "git"]
class Template():
@ -173,4 +173,4 @@ class Languanges():
def install(self, environment_name, template):
Template.install(self.packages, environment_name, self.config_commands, template)