Implement building ISO in RAM and automatic removal of build directory (#67)

* feat: Implement building ISO in RAM

* feat: Implement removing build directory

* README: Remove build directory by default

* Use mktemp to create work directory

Co-authored-by: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com>

* Adapt cehcks for mktemp

* util-iso.sh: Fix typo

Co-authored-by: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com>

* util-iso.sh: Ensure safe removal of directory by quoting variable

Co-authored-by: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com>

* util-iso.sh: umount_fs first and then start removal

* util-iso.sh: Properly handle removal of work directory

---------

Co-authored-by: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com>
This commit is contained in:
veuxitandVasiliy Stelmachenok authored and GitHub committed 2025-11-20 10:13:41 +01:00
1 parent 2a25ad08d6
commit 94480e21a8
4 files changed
+26 -3

No files matched your search

+12 -1
View File
@@ -20,10 +20,14 @@ outFolder="${src_dir}/out"
build_list_iso="desktop"
clean_first=true
verbose=false
build_in_ram=true
remove_build_dir=false
usage() {
echo "Usage: ${0##*/} [options]"
echo ' -c Disable clean work dir'
echo ' -r Disable building in RAM on systems with more than 23GB RAM'
echo ' -w Remove build directory (not the ISO) after ISO file is built'
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo ' -v Verbose output to log file, show profile detail (-q)'
echo ' -h This help'
@@ -34,12 +38,14 @@ usage() {
orig_argv=("$@")
opts='p:cvh'
opts='p:cvhrw'
while getopts "${opts}" arg; do
case "${arg}" in
c) clean_first=false ;;
p) build_list_iso="$OPTARG" ;;
r) build_in_ram=false ;;
w) remove_build_dir=true ;;
v) verbose=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
@@ -52,6 +58,11 @@ timer_start=$(get_timer)
#check_root "$0" "${orig_argv[@]}"
# Build ISO in RAM if RAM amount is greater than 23GB. This would speed up build process and extend disk lifetime
if [[ "$build_in_ram" == "true" ]] && [[ $(grep MemTotal /proc/meminfo | awk '{print int($2/1024/1024)}') -gt 23 ]]; then
work_dir="$(mktemp -d --suffix="-cachyos-iso")"
fi
prepare_dir "${work_dir}"
import ${src_dir}/util-iso.sh