mirror of
https://github.com/theupriser/steamify-cachyos-live-iso.git
synced 2026-10-02 15:10:26 +02:00
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:
1 parent
2a25ad08d6
commit
94480e21a8
4 files changed
+26
-3
No files matched your search
@@ -10,6 +10,8 @@ buildiso is used to build CachyOS ISO.
|
|||||||
$ ./buildiso.sh -h
|
$ ./buildiso.sh -h
|
||||||
Usage: buildiso [options]
|
Usage: buildiso [options]
|
||||||
-c Disable clean work dir
|
-c Disable clean work dir
|
||||||
|
-r Disable building in RAM on systems with more than 23GB RAM
|
||||||
|
-w Remove build directory (not the ISO) after ISO file is built
|
||||||
-h This help
|
-h This help
|
||||||
-p <profile> Buildset or profile [default: desktop]
|
-p <profile> Buildset or profile [default: desktop]
|
||||||
-v Verbose output to log file, show profile detail (-q)
|
-v Verbose output to log file, show profile detail (-q)
|
||||||
@@ -34,7 +36,7 @@ cd cachyos-archiso
|
|||||||
|
|
||||||
### Build
|
### Build
|
||||||
```bash
|
```bash
|
||||||
sudo ./buildiso.sh -p desktop -v
|
sudo ./buildiso.sh -p desktop -v -w
|
||||||
```
|
```
|
||||||
|
|
||||||
As the result iso appears at the `out` folder
|
As the result iso appears at the `out` folder
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Defining the Version of the ISO. This line could be easy changed by a Script wich do that automatic before creating ISO self.
|
# Defining the Version of the ISO. This line could be easy changed by a Script wich do that automatic before creating ISO self.
|
||||||
# Default "GIT", because if somebody outside from the DEVs create a ISO, this ISO wouldnt have a specific Version number.
|
# Default "GIT", because if somebody outside from the DEVs create a ISO, this ISO wouldnt have a specific Version number.
|
||||||
CACHYOS_VERSION="250131"
|
CACHYOS_VERSION="251016"
|
||||||
|
|
||||||
if [ "${grub_platform}" == 'efi' ]; then
|
if [ "${grub_platform}" == 'efi' ]; then
|
||||||
bios_or_uefi='(UEFI)!'
|
bios_or_uefi='(UEFI)!'
|
||||||
|
|||||||
+12
-1
@@ -20,10 +20,14 @@ outFolder="${src_dir}/out"
|
|||||||
build_list_iso="desktop"
|
build_list_iso="desktop"
|
||||||
clean_first=true
|
clean_first=true
|
||||||
verbose=false
|
verbose=false
|
||||||
|
build_in_ram=true
|
||||||
|
remove_build_dir=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options]"
|
echo "Usage: ${0##*/} [options]"
|
||||||
echo ' -c Disable clean work dir'
|
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 " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
||||||
echo ' -v Verbose output to log file, show profile detail (-q)'
|
echo ' -v Verbose output to log file, show profile detail (-q)'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
@@ -34,12 +38,14 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$@")
|
||||||
|
|
||||||
opts='p:cvh'
|
opts='p:cvhrw'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
c) clean_first=false ;;
|
c) clean_first=false ;;
|
||||||
p) build_list_iso="$OPTARG" ;;
|
p) build_list_iso="$OPTARG" ;;
|
||||||
|
r) build_in_ram=false ;;
|
||||||
|
w) remove_build_dir=true ;;
|
||||||
v) verbose=true ;;
|
v) verbose=true ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||||
@@ -52,6 +58,11 @@ timer_start=$(get_timer)
|
|||||||
|
|
||||||
#check_root "$0" "${orig_argv[@]}"
|
#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}"
|
prepare_dir "${work_dir}"
|
||||||
|
|
||||||
import ${src_dir}/util-iso.sh
|
import ${src_dir}/util-iso.sh
|
||||||
|
|||||||
+10
@@ -212,6 +212,16 @@ run_build() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||||
|
if [[ "$build_in_ram" == "true" && "$remove_build_dir" == "false" ]]; then
|
||||||
|
msg "!!! Remember to remove $work_dir !!!"
|
||||||
|
msg2 "sudo rm -rf $work_dir"
|
||||||
|
fi
|
||||||
|
if [[ "$remove_build_dir" == "true" ]]; then
|
||||||
|
msg "Automatically removing build directory ($work_dir)..."
|
||||||
|
umount_fs
|
||||||
|
[ -d ${work_dir} ] && sudo rm -rf ${work_dir}
|
||||||
|
msg2 "Removed"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_iso_fn(){
|
gen_iso_fn(){
|
||||||
|
|||||||
Reference in new issue
Block a user