Include Init dir option complete
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from os.path import exists
|
||||||
import sys
|
import sys
|
||||||
import sll
|
import sll
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -44,6 +45,17 @@ def copy_file(source: str | Path, destination: str | Path) -> Path:
|
|||||||
# shutil.copy2 preserves file metadata
|
# shutil.copy2 preserves file metadata
|
||||||
copied_path = shutil.copy2(src_path, dst_path)
|
copied_path = shutil.copy2(src_path, dst_path)
|
||||||
return Path(copied_path)
|
return Path(copied_path)
|
||||||
|
def copy_folder(source_dir: str | Path, destination_dir: str | Path, overwrite=True):
|
||||||
|
src = Path(source_dir).resolve()
|
||||||
|
dst = Path(destination_dir).resolve()
|
||||||
|
|
||||||
|
if not src.exists():
|
||||||
|
sll.warn(f"Source directory for {src} doesnt exist")
|
||||||
|
if not src.is_dir():
|
||||||
|
sll.warn(f"Source path is not a directory {src}")
|
||||||
|
|
||||||
|
shutil.copytree(src,dst,dirs_exist_ok=overwrite)
|
||||||
|
return dst
|
||||||
def dir_exists(dirpath: str | Path) -> bool:
|
def dir_exists(dirpath: str | Path) -> bool:
|
||||||
path = Path(dirpath)
|
path = Path(dirpath)
|
||||||
return path.is_dir()
|
return path.is_dir()
|
||||||
@@ -101,6 +113,31 @@ def compress_directory(
|
|||||||
|
|
||||||
return output_path
|
return output_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Install Functions
|
||||||
|
|
||||||
|
|
||||||
|
def copy_init_dir():
|
||||||
|
TreeLib.execute_task_with_spinner("Copying init directory", copy_folder, str(SOURCE_DIR) + "/include/root/etc/init.d", str(OUTPUT_DIR)+ "/root/etc/init.d", indent=5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def bundle_dualroot():
|
def bundle_dualroot():
|
||||||
def showBar(percent: float):
|
def showBar(percent: float):
|
||||||
bar = TreeLib.draw_progress_bar(int(percent),20)
|
bar = TreeLib.draw_progress_bar(int(percent),20)
|
||||||
@@ -125,7 +162,7 @@ def bundle_dualroot():
|
|||||||
else:
|
else:
|
||||||
dualroot = compress_directory(str(SOURCE_DIR)+"/include/dual_rootfs",str(OUTPUT_DIR)+"/dualrootfs.tar.gz",progress_callback=showBar)
|
dualroot = compress_directory(str(SOURCE_DIR)+"/include/dual_rootfs",str(OUTPUT_DIR)+"/dualrootfs.tar.gz",progress_callback=showBar)
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
|
||||||
sll.warn("Build Troposphere script... i hope everything goes well :/")
|
sll.warn("Build Troposphere script... i hope everything goes well :/")
|
||||||
|
|
||||||
@@ -142,7 +179,8 @@ sll.log(f"Creating output dump -> {OUTPUT_DIR}")
|
|||||||
sll.log("Checking required source tree")
|
sll.log("Checking required source tree")
|
||||||
bundle_dualroot()
|
bundle_dualroot()
|
||||||
|
|
||||||
sll.log("Grabbing Config")
|
sll.log("Continuing from BuildConfig ...")
|
||||||
|
if BuildConfig.Include_Init_dir: copy_init_dir()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -43,8 +43,8 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"file": "Installer Compiler.canvas",
|
"file": "Installer Compiler.canvas",
|
||||||
"viewState": {
|
"viewState": {
|
||||||
"x": -308.8184712754345,
|
"x": -268.33992768217,
|
||||||
"y": -345.6115967557915,
|
"y": 184.44489369829932,
|
||||||
"zoom": -0.8
|
"zoom": -0.8
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user