Merge branch 'main' into dev
This commit is contained in:
commit
4874994543
|
|
@ -24,6 +24,4 @@ jobs:
|
||||||
sudo apt update -y
|
sudo apt update -y
|
||||||
sudo apt install make -y
|
sudo apt install make -y
|
||||||
cd danix
|
cd danix
|
||||||
sudo make install
|
|
||||||
sudo make aliases
|
|
||||||
sudo danix
|
|
||||||
|
|
|
||||||
49
README.md
49
README.md
|
|
@ -3,13 +3,13 @@
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
* Author: Vinicius F. da Silva
|
* Author: Vinicius F. da Silva
|
||||||
* Version 0.1
|
* Version 0.1.4
|
||||||
* Released: 2023
|
* Released: 2023
|
||||||
|
|
||||||
A very simple subsystem builder!
|
A very simple subsystem builder!
|
||||||
|
|
||||||
The Danixfs is a root filesystem management! Build a Alpine subsystem and pre install
|
The Danixfs is a root filesystem management! Build a Alpine subsystem and pre install
|
||||||
essentials packages and compiers from languanges choice by user:
|
essentials packages and compilers from languages choice by user:
|
||||||
# Image:
|
# Image:
|
||||||
|
|
||||||
#### Building a clike environment
|
#### Building a clike environment
|
||||||
|
|
@ -31,13 +31,19 @@ essentials packages and compiers from languanges choice by user:
|
||||||
* tar 1.34 or higher
|
* tar 1.34 or higher
|
||||||
* python3 or higher
|
* python3 or higher
|
||||||
* pip3 or higher
|
* pip3 or higher
|
||||||
# Run Danix
|
* python-is-python3
|
||||||
|
# Install Danix
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ sudo make config
|
$ cd danixfs
|
||||||
```
|
```
|
||||||
|
|
||||||
To clean configuracion run:
|
|
||||||
|
```shell
|
||||||
|
$ sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
To clean configuration run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ sudo make clean
|
$ sudo make clean
|
||||||
|
|
@ -49,12 +55,17 @@ $ danix -h
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
# Remove Danix
|
||||||
|
|
||||||
|
To remove danix run:
|
||||||
|
```shell
|
||||||
|
$ sudo danixclean
|
||||||
|
```
|
||||||
# Common erros
|
# Common erros
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
To fix this erro open file *registry.py* located in /usr/local/lib/python3.10/dist-packages/django/apps/
|
To fix this problem open file *registry.py*
|
||||||
|
|
||||||
Search for
|
Search for
|
||||||
|
|
||||||
|
|
@ -62,10 +73,30 @@ Search for
|
||||||
raise RuntimeError("populate() isn't reentrant")"
|
raise RuntimeError("populate() isn't reentrant")"
|
||||||
```
|
```
|
||||||
|
|
||||||
line. And replace for following code:
|
line. And replace by following code:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
self.app_configs = {}
|
self.app_configs = {}
|
||||||
```
|
```
|
||||||
|
|
||||||
Save file and try again
|
Save file and run
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sudo make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sudo make aliases
|
||||||
|
```
|
||||||
|
|
||||||
|
Close terminal, open again and run
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ danix --help
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import os, settings, app
|
import os, settings, app
|
||||||
from sh import du
|
from sh import du
|
||||||
from settings import MAIN_REPO
|
from settings import MAIN_REPO
|
||||||
|
from utils import download_checksum, validate_checksum
|
||||||
|
from utils import get_message, check_equal_sentence as equals, generate_checksum, remove_checksum_files
|
||||||
class Danix():
|
class Danix():
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
@ -69,29 +71,43 @@ class Danix():
|
||||||
|
|
||||||
os.system(f"mkdir /tmp/{filesystem}")
|
os.system(f"mkdir /tmp/{filesystem}")
|
||||||
os.system(f"curl --silent -LO --output-dir /tmp/{filesystem} {settings.REPO_NAME}/{settings.ROOT_FS}")
|
os.system(f"curl --silent -LO --output-dir /tmp/{filesystem} {settings.REPO_NAME}/{settings.ROOT_FS}")
|
||||||
os.system(f"tar -xf /tmp/{filesystem}/{settings.ROOT_FS} -C /tmp/{filesystem}")
|
|
||||||
os.system(f"rm /tmp/{filesystem}/{settings.ROOT_FS}")
|
|
||||||
os.system(f"mv /tmp/{filesystem} {MAIN_REPO}")
|
|
||||||
|
|
||||||
print("\nPlease! Wait a moment!!")
|
|
||||||
print("Building container:")
|
|
||||||
print(f"Installing {len(packages)} packages\n")
|
|
||||||
|
|
||||||
for command in config_comands:
|
|
||||||
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs {command}")
|
|
||||||
|
|
||||||
for package in packages:
|
|
||||||
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs apk add {package}")
|
|
||||||
|
|
||||||
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs apk add fish")
|
|
||||||
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")
|
resp_downloaded_checksum = download_checksum()
|
||||||
os.system(f"rm -r {MAIN_REPO}{filesystem}/danixfs/proc >/dev/null 2>&1")
|
resp_generateed_checksum = generate_checksum(f"/tmp/{filesystem}/{settings.ROOT_FS}")
|
||||||
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)
|
is_downloaded_and_generate = equals(resp_downloaded_checksum, 0) and equals(resp_generateed_checksum, 0)
|
||||||
|
|
||||||
|
is_valid_checksum = validate_checksum(filesystem)
|
||||||
|
|
||||||
|
remove_checksum_files()
|
||||||
|
|
||||||
|
if is_downloaded_and_generate and is_valid_checksum:
|
||||||
|
|
||||||
|
os.system(f"tar -xf /tmp/{filesystem}/{settings.ROOT_FS} -C /tmp/{filesystem}")
|
||||||
|
os.system(f"rm /tmp/{filesystem}/{settings.ROOT_FS}")
|
||||||
|
os.system(f"mv /tmp/{filesystem} {MAIN_REPO}")
|
||||||
|
|
||||||
|
print("\nPlease! Wait a moment!!")
|
||||||
|
print("Building container:")
|
||||||
|
print(f"Installing {len(packages)} packages\n")
|
||||||
|
|
||||||
|
for command in config_comands:
|
||||||
|
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs {command}")
|
||||||
|
|
||||||
|
for package in packages:
|
||||||
|
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs apk add {package}")
|
||||||
|
|
||||||
|
os.system(f"chroot {MAIN_REPO}{filesystem}/danixfs apk add fish")
|
||||||
|
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)
|
||||||
|
else:
|
||||||
|
get_message("🔴 Failed integrity base image verification!", True, 1)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ else
|
||||||
|
|
||||||
@$(PYTHON) $(DANIX_PATH)/manage.py migrate
|
@$(PYTHON) $(DANIX_PATH)/manage.py migrate
|
||||||
|
|
||||||
@echo "Installation successfully!!! Please 'make aliases without sudo'"
|
@echo "Installation successfully!!! Please 'make aliases without' sudo"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,33 @@
|
||||||
import os
|
import os
|
||||||
from settings import MAIN_REPO, MAIN_DIR, BASE_DIR
|
import sh
|
||||||
|
from settings import MAIN_REPO, MAIN_DIR, BASE_DIR, REPO_NAME
|
||||||
|
|
||||||
|
|
||||||
|
def download_checksum():
|
||||||
|
|
||||||
|
return os.system(f"curl --silent -LO --output-dir /tmp/ {REPO_NAME}danixfs.checksum")
|
||||||
|
|
||||||
|
|
||||||
|
def generate_checksum(package_path):
|
||||||
|
os.system("touch /tmp/local_danixfs.checksum")
|
||||||
|
return os.system(f"sha256sum {package_path} >> /tmp/local_danixfs.checksum")
|
||||||
|
|
||||||
|
|
||||||
|
def remove_checksum_files():
|
||||||
|
os.system("rm /tmp/danixfs.checksum >/dev/null 2>&1")
|
||||||
|
os.system("rm /tmp/local_danixfs.checksum >/dev/null 2>&1")
|
||||||
|
|
||||||
|
def read_line(file_path):
|
||||||
|
file = open(file_path, 'r')
|
||||||
|
checksum = file.readlines()
|
||||||
|
return checksum
|
||||||
|
|
||||||
|
def validate_checksum(filesystem):
|
||||||
|
|
||||||
|
remote_checksum = ''.join(read_line(f"/tmp/danixfs.checksum")).replace(f"/tmp/{filesystem}/", "")
|
||||||
|
local_checksum = ''.join(read_line(f"/tmp/local_danixfs.checksum")).replace(f"/tmp/{filesystem}/", "")
|
||||||
|
|
||||||
|
return True if local_checksum == remote_checksum else False
|
||||||
|
|
||||||
def separate(path):
|
def separate(path):
|
||||||
list_path = path.split(" ")
|
list_path = path.split(" ")
|
||||||
|
|
@ -91,6 +119,7 @@ def print_environment_list_header():
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_equal_sentence(left_expression, right_expression):
|
def check_equal_sentence(left_expression, right_expression):
|
||||||
|
|
||||||
return left_expression == right_expression
|
return left_expression == right_expression
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
BIN
danixfs.tar.gz
BIN
danixfs.tar.gz
Binary file not shown.
Loading…
Reference in New Issue