5 # Email : hayao@fascode.net
7 # (c) 2019-2021 Fascode Network.
11 # The main script that runs the build
17 # Do not change these values.
18 script_path="$( cd -P "$( dirname "$(readlink -f "${0}")" )" && pwd )"
19 defaultconfig="${script_path}/default.conf"
20 tools_dir="${script_path}/tools"
21 module_dir="${script_path}/modules"
22 customized_username=false
23 customized_password=false
24 customized_kernel=false
25 customized_logpath=false
27 makepkg_script_args=()
30 alteriso_version="3.1"
33 [[ ! -f "${defaultconfig}" ]] && "${tools_dir}/msg.sh" -a 'build.sh' error "${defaultconfig} was not found." && exit 1
34 for config in "${defaultconfig}" "${script_path}/custom.conf"; do
35 [[ -f "${config}" ]] && source "${config}"
40 # Message common function
41 # msg_common [type] [-n] [string]
43 local _msg_opts=("-a" "build.sh") _type="${1}"
45 [[ "${1}" = "-n" ]] && _msg_opts+=("-o" "-n") && shift 1
46 [[ "${msgdebug}" = true ]] && _msg_opts+=("-x")
47 [[ "${nocolor}" = true ]] && _msg_opts+=("-n")
48 _msg_opts+=("${_type}" "${@}")
49 "${tools_dir}/msg.sh" "${_msg_opts[@]}"
52 # Show an INFO message
53 # ${1}: message string
54 msg_info() { msg_common info "${@}"; }
56 # Show an Warning message
57 # ${1}: message string
58 msg_warn() { msg_common warn "${@}"; }
60 # Show an debug message
61 # ${1}: message string
63 [[ "${debug}" = true ]] && msg_common debug "${@}"
67 # Show an ERROR message then exit with status
68 # ${1}: message string
69 # ${2}: exit code number (with 0 does not exit)
71 msg_common error "${1}"
72 [[ -n "${2:-}" ]] && exit "${2}"
76 # Usage: getclm <number>
77 # 標準入力から値を受けとり、引数で指定された列を抽出します。
78 getclm() { cut -d " " -f "${1}"; }
80 # Usage: echo_blank <number>
81 # 指定されたぶんの半角空白文字を出力します
82 echo_blank(){ yes " " 2> /dev/null | head -n "${1}" | tr -d "\n"; }
85 echo "usage ${0} [options] [channel]"
87 echo "A channel is a profile of AlterISO settings."
89 echo " General options:"
90 echo " -b | --boot-splash Enable boot splash"
91 echo " -e | --cleanup | --cleaning Enable post-build cleaning"
92 echo " --tarball Build rootfs in tar.xz format"
93 echo " -h | --help This help message and exit"
95 echo " -a | --arch <arch> Set iso architecture"
96 echo " Default: ${arch}"
97 echo " -c | --comp-type <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz, zstd)"
98 echo " Default: ${sfs_comp}"
99 echo " -g | --gpgkey <key> Set gpg key"
100 echo " Default: ${gpg_key}"
101 echo " -l | --lang <lang> Specifies the default language for the live environment"
102 echo " Default: ${locale_name}"
103 echo " -k | --kernel <kernel> Set special kernel type.See below for available kernels"
104 echo " Default: ${defaultkernel}"
105 echo " -o | --out <out_dir> Set the output directory"
106 echo " Default: ${out_dir}"
107 echo " -p | --password <password> Set a live user password"
108 echo " Default: ${password}"
109 echo " -t | --comp-opts <options> Set compressor-specific options."
110 echo " Default: empty"
111 echo " -u | --user <username> Set user name"
112 echo " Default: ${username}"
113 echo " -w | --work <work_dir> Set the working directory"
114 echo " Default: ${work_dir}"
117 local blank="33" _arch _dirname _type
119 for _type in "locale" "kernel"; do
120 echo " ${_type} for each architecture:"
121 for _arch in $(find "${script_path}/system/" -maxdepth 1 -mindepth 1 -name "${_type}-*" -print0 | xargs -I{} -0 basename {} | sed "s|${_type}-||g"); do
122 echo -n " ${_arch}$(echo_blank "$(( "${blank}" - 4 - "${#_arch}" ))")"
123 "${tools_dir}/${_type}.sh" -a "${_arch}" show
129 for _dirname in $(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -d -b -n show); do
130 echo -ne " ${_dirname%.add}$(echo_blank "$(( "${blank}" - 3 - "$(echo "${_dirname%.add}" | wc -m)" ))")"
131 "${tools_dir}/channel.sh" --version "${alteriso_version}" --nocheck desc "${_dirname%.add}"
135 echo " Debug options: Please use at your own risk."
136 echo " -d | --debug Enable debug messages"
137 echo " -x | --bash-debug Enable bash debug mode(set -xv)"
138 echo " --channellist Output the channel list and exit"
139 echo " --gitversion Add Git commit hash to image file version"
140 echo " --logpath <file> Set log file path (use with --log)"
141 echo " --[no]log (No) log ;re-run script with tee"
142 echo " --msgdebug Enables output debugging"
143 echo " --noaur Ignore aur packages (Use only for debugging)"
144 echo " --nocolor No output colored output"
145 echo " --[no]confirm (No) check the settings before building"
146 echo " --nochkver No check the version of the channel"
147 echo " --nodebug No debug message"
148 echo " --noefi No efi boot (Use only for debugging)"
149 echo " --noloopmod No check and load kernel module automatically"
150 echo " --nodepend No check package dependencies before building"
151 echo " --noiso No build iso image (Use with --tarball)"
152 echo " --pacman-debug Enable pacman debug mode"
153 echo " --normwork No remove working dir"
154 echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)"
156 echo " Many packages are installed from AUR, so specifying --noaur can cause problems."
158 [[ -n "${1:-}" ]] && exit "${1}"
161 # Unmount helper Usage: _umount <target>
162 _umount() { if mountpoint -q "${1}"; then umount -lf "${1}"; fi; }
164 # Mount helper Usage: _mount <source> <target>
165 _mount() { ! mountpoint -q "${2}" && [[ -f "${1}" ]] && [[ -d "${2}" ]] && mount "${1}" "${2}"; return 0; }
169 local _args=("${build_dir}")
170 [[ "${debug}" = true ]] && _args=("-d" "${_args[@]}")
171 [[ "${nocolor}" = true ]] && _args+=("--nocolor")
172 "${tools_dir}/umount.sh" "${_args[@]}"
175 # Mount airootfs on "${airootfs_dir}"
177 mkdir -p "${airootfs_dir}"
178 _mount "${airootfs_dir}.img" "${airootfs_dir}"
182 # Helper function to run make_*() only one time.
185 if [[ ! -e "${lockfile_dir}/build.${1}" ]]; then
186 msg_debug "Running ${1} ..."
189 mkdir -p "${lockfile_dir}"; touch "${lockfile_dir}/build.${1}"
192 msg_debug "Skipped because ${1} has already been executed."
196 # Show message when file is removed
197 # remove <file> <file> ...
200 for _file in "${@}"; do msg_debug "Removing ${_file}"; rm -rf "${_file}"; done
207 msg_error "It was killed by the user.\nThe process may not have completed successfully."
212 # load_config [file1] [file2] ...
215 for _file in "${@}"; do [[ -f "${_file}" ]] && source "${_file}" && msg_debug "The settings have been overwritten by the ${_file}"; done
219 # Display channel list
220 show_channel_list() {
221 local _args=("-v" "${alteriso_version}" show)
222 [[ "${nochkver}" = true ]] && _args+=("-n")
223 bash "${tools_dir}/channel.sh" "${_args[@]}"
226 # Execute command for each module. It will be executed with {} replaced with the module name.
227 # for_module <command>
230 for module in "${modules[@]}"; do eval "$(echo "${@}" | sed "s|{}|${module}|g")"; done
235 msg_info "Installing packages to ${airootfs_dir}/'..."
236 local _args=("-c" "-G" "-M" "--" "${airootfs_dir}" "${@}")
237 [[ "${pacman_debug}" = true ]] && _args+=(--debug)
238 pacstrap -C "${build_dir}/pacman.conf" "${_args[@]}"
239 msg_info "Packages installed successfully!"
242 # chroot環境でpacmanコマンドを実行
243 # /etc/alteriso-pacman.confを準備してコマンドを実行します
244 _run_with_pacmanconf(){
245 sed "s|^CacheDir =|#CacheDir =|g" "${build_dir}/pacman.conf" > "${airootfs_dir}/etc/alteriso-pacman.conf"
247 remove "${airootfs_dir}/etc/alteriso-pacman.conf"
252 msg_debug "Run command in chroot\nCommand: ${*}"
253 eval -- arch-chroot "${airootfs_dir}" "${@}"
257 msg_info "Cleaning up what we can on airootfs..."
259 # Delete pacman database sync cache files (*.tar.gz)
260 [[ -d "${airootfs_dir}/var/lib/pacman" ]] && find "${airootfs_dir}/var/lib/pacman" -maxdepth 1 -type f -delete
262 # Delete pacman database sync cache
263 [[ -d "${airootfs_dir}/var/lib/pacman/sync" ]] && find "${airootfs_dir}/var/lib/pacman/sync" -delete
265 # Delete pacman package cache
266 [[ -d "${airootfs_dir}/var/cache/pacman/pkg" ]] && find "${airootfs_dir}/var/cache/pacman/pkg" -type f -delete
268 # Delete all log files, keeps empty dirs.
269 [[ -d "${airootfs_dir}/var/log" ]] && find "${airootfs_dir}/var/log" -type f -delete
271 # Delete all temporary files and dirs
272 [[ -d "${airootfs_dir}/var/tmp" ]] && find "${airootfs_dir}/var/tmp" -mindepth 1 -delete
274 # Delete package pacman related files.
275 find "${build_dir}" \( -name '*.pacnew' -o -name '*.pacsave' -o -name '*.pacorig' \) -delete
277 # Delete all cache file
278 [[ -d "${airootfs_dir}/var/cache" ]] && find "${airootfs_dir}/var/cache" -mindepth 1 -delete
280 # Create an empty /etc/machine-id
281 printf '' > "${airootfs_dir}/etc/machine-id"
288 # Delete all files in /boot
289 [[ -d "${airootfs_dir}/boot" ]] && find "${airootfs_dir}/boot" -mindepth 1 -delete
293 msg_info "Creating md5 checksum ..."
294 echo "$(md5sum "${1}" | getclm 1) $(basename "${1}")" > "${1}.md5"
295 msg_info "Creating sha256 checksum ..."
296 echo "$(sha256sum "${1}" | getclm 1) $(basename "${1}")" > "${1}.sha256"
299 # Check the value of a variable that can only be set to true or false.
301 local _value _variable
302 for _variable in "${@}"; do
303 msg_debug -n "Checking ${_variable}..."
304 eval ': ${'${_variable}':=""}'
305 _value="$(eval echo '$'${_variable})"
306 if [[ ! -v "${1}" ]] || [[ "${_value}" = "" ]]; then
307 [[ "${debug}" = true ]] && echo ; msg_error "The variable name ${_variable} is empty." "1"
308 elif [[ ! "${_value}" = "true" ]] && [[ ! "${_value}" = "false" ]]; then
309 [[ "${debug}" = true ]] && echo ; msg_error "The variable name ${_variable} is not of bool type (${_variable} = ${_value})" "1"
310 elif [[ "${debug}" = true ]]; then
317 bash $([[ "${bash_debug}" = true ]] && echo -n "-x" ) "${tools_dir}/clean.sh" -o -w "$(realpath "${build_dir}")" "$([[ "${debug}" = true ]] && printf "%s" "-d")" "$([[ "${noconfirm}" = true ]] && printf "%s" "-n")" "$([[ "${nocolor}" = true ]] && printf "%s" "--nocolor")"
321 # Check the build environment and create a directory.
324 if [[ "${nodepend}" = false ]]; then
325 local _check_failed=false _pkg _result=0
326 msg_info "Checking dependencies ..."
327 if ! pacman -Qq pyalpm > /dev/null 2>&1; then
328 msg_error "pyalpm is not installed." 1
330 for _pkg in "${dependence[@]}"; do
331 eval "${tools_dir}/package.py" "${_pkg}" "$( [[ "${debug}" = false ]] && echo "> /dev/null")" || _result="${?}"
332 if (( _result == 3 )) || (( _result == 4 )); then
337 [[ "${_check_failed}" = true ]] && exit 1
340 # Load loop kernel module
341 if [[ "${noloopmod}" = false ]]; then
342 [[ ! -d "/usr/lib/modules/$(uname -r)" ]] && msg_error "The currently running kernel module could not be found.\nProbably the system kernel has been updated.\nReboot your system to run the latest kernel." "1"
343 [[ -z "$(lsmod | getclm 1 | grep -x "loop")" ]] && modprobe loop
347 if [[ "${normwork}" = false ]]; then
348 msg_info "Deleting the contents of ${build_dir}..."
353 if [[ -n "${gpg_key}" ]]; then
354 gpg --batch --output "${work_dir}/pubkey.gpg" --export "${gpg_key}"
355 exec {ARCHISO_GNUPG_FD}<>"${build_dir}/pubkey.gpg"
356 export ARCHISO_GNUPG_FD
359 # 強制終了時に作業ディレクトリを削除する
360 local _trap_remove_work
361 _trap_remove_work() {
363 [[ "${normwork}" = false ]] && echo && _run_cleansh
366 trap '_trap_remove_work' 1 2 3 15
374 if [[ "${boot_splash}" = true ]]; then
375 msg_info "Boot splash is enabled."
376 msg_info "Theme is used ${theme_name}."
378 msg_info "Language is ${locale_fullname}."
379 msg_info "Use the ${kernel} kernel."
380 msg_info "Live username is ${username}."
381 msg_info "Live user password is ${password}."
382 msg_info "The compression method of squashfs is ${sfs_comp}."
383 msg_info "Use the ${channel_name%.add} channel."
384 msg_info "Build with architecture ${arch}."
385 if [[ "${noconfirm}" = false ]]; then
386 echo -e "\nPress Enter to continue or Ctrl + C to cancel."
390 trap 'umount_trap' 1 2 3 15
396 # Preparation for build
398 # Show alteriso version
399 if [[ -d "${script_path}/.git" ]]; then
401 msg_debug "The version of alteriso is $(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')."
406 load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
409 if [[ "${bash_debug}" = true ]]; then
414 if [[ "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" ver "${channel_name}")" = "3.0" ]]; then
415 msg_warn "The module cannot be used because it works with Alter ISO3.0 compatibility."
416 if [[ ! -z "${include_extra+SET}" ]]; then
417 if [[ "${include_extra}" = true ]]; then
418 modules=("base" "share" "share-extra" "calamares" "zsh-powerline")
420 modules=("base" "share")
427 msg_debug "Checking ${1} module ..."
428 bash "${tools_dir}/module.sh" check "${1}" || msg_error "Module ${1} is not available." "1";
430 readarray -t modules < <(printf "%s\n" "${modules[@]}" | awk '!a[$0]++')
431 for_module "module_check {}"
432 for_module load_config "${module_dir}/{}/config.any" "${module_dir}/{}/config.${arch}"
433 msg_debug "Loaded modules: ${modules[*]}"
434 ! printf "%s\n" "${modules[@]}" | grep -x "share" >/dev/null 2>&1 && msg_warn "The share module is not loaded."
437 [[ "${customized_kernel}" = false ]] && kernel="${defaultkernel}"
440 eval "$(bash "${tools_dir}/locale.sh" -s -a "${arch}" get "${locale_name}")"
441 eval "$(bash "${tools_dir}/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")"
443 # Set username and password
444 [[ "${customized_username}" = false ]] && username="${defaultusername}"
445 [[ "${customized_password}" = false ]] && password="${defaultpassword}"
448 [[ "${gitversion}" = true ]] && iso_version="${iso_version}-${gitrev}"
450 # Generate iso file name.
451 local _channel_name="${channel_name%.add}-${locale_version}"
452 iso_filename="${iso_name}-${_channel_name}-${iso_version}-${arch}.iso"
453 [[ "${nochname}" = true ]] && iso_filename="${iso_name}-${iso_version}-${arch}.iso"
454 msg_debug "Iso filename is ${iso_filename}"
457 check_bool boot_splash cleaning noconfirm nodepend customized_username customized_password noloopmod nochname tarball noiso noaur customized_syslinux norescue_entry debug bash_debug nocolor msgdebug noefi nosigcheck gitversion
459 # Check architecture for each channel
461 bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -a "${arch}" -n -b check "${channel_name}" || _exit="${?}"
462 if (( "${_exit}" != 0 )) && (( "${_exit}" != 1 )); then
463 msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
467 if [[ ! "${logging}" = false ]]; then
468 [[ "${customized_logpath}" = false ]] && logging="${out_dir}/${iso_filename%.iso}.log"
469 mkdir -p "$(dirname "${logging}")" && touch "${logging}"
470 msg_warn "Re-run sudo ${0} ${ARGUMENT[*]} --nodepend --nolog --nocolor 2>&1 | tee ${logging}"
471 sudo "${0}" "${ARGUMENT[@]}" --nolog --nocolor --nodepend 2>&1 | tee "${logging}"
477 # Set argument of pkglist.sh
478 pkglist_args=("-a" "${arch}" "-k" "${kernel}" "-c" "${channel_dir}" "-l" "${locale_name}")
479 [[ "${boot_splash}" = true ]] && pkglist_args+=("-b")
480 [[ "${debug}" = true ]] && pkglist_args+=("-d")
481 [[ "${memtest86}" = true ]] && pkglist_args+=("-m")
482 [[ "${nocolor}" = true ]] && pkglist_args+=("--nocolor")
483 (( "${#additional_exclude_pkg[@]}" >= 1 )) && pkglist_args+=("-e" "${additional_exclude_pkg[*]}")
484 pkglist_args+=("${modules[@]}")
486 # Set argument of aur.sh and pkgbuild.sh
487 [[ "${bash_debug}" = true ]] && makepkg_script_args+=("-x")
488 [[ "${pacman_debug}" = true ]] && makepkg_script_args+=("-d")
494 # Setup custom pacman.conf with current cache directories.
496 # Pacman configuration file used only when building
497 # If there is pacman.conf for each channel, use that for building
498 local _pacman_conf _pacman_conf_list=("${script_path}/pacman-${arch}.conf" "${channel_dir}/pacman-${arch}.conf" "${script_path}/system/pacman-${arch}.conf")
499 for _pacman_conf in "${_pacman_conf_list[@]}"; do
500 if [[ -f "${_pacman_conf}" ]]; then
501 build_pacman_conf="${_pacman_conf}"
506 msg_debug "Use ${build_pacman_conf}"
507 sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dir}|g" "${build_pacman_conf}" > "${build_dir}/pacman.conf"
509 [[ "${nosigcheck}" = true ]] && sed -ir "s|^s*SigLevel.+|SigLevel = Never|g" "${build_pacman_conf}"
511 [[ -n "$(find "${cache_dir}" -maxdepth 1 -name '*.pkg.tar.*' 2> /dev/null)" ]] && msg_info "Use cached package files in ${cache_dir}"
513 # Share any architecture packages
514 #while read -r _pkg; do
515 # if [[ ! -f "${cache_dir}/$(basename "${_pkg}")" ]]; then
516 # ln -s "${_pkg}" "${cache_dir}"
518 #done < <(find "${cache_dir}/../" -type d -name "$(basename "${cache_dir}")" -prune -o -type f -name "*-any.pkg.tar.*" -printf "%p\n")
523 # Base installation (airootfs)
525 msg_info "Creating ext4 image of 32GiB..."
526 truncate -s 32G -- "${airootfs_dir}.img"
527 mkfs.ext4 -O '^has_journal,^resize_inode' -E 'lazy_itable_init=0' -m 0 -F -- "${airootfs_dir}.img" 32G
528 tune2fs -c "0" -i "0" "${airootfs_dir}.img"
531 msg_info "Mounting ${airootfs_dir}.img on ${airootfs_dir}"
537 # Additional packages (airootfs)
538 make_packages_repo() {
539 msg_debug "pkglist.sh ${pkglist_args[*]}"
540 local _pkglist=($("${tools_dir}/pkglist.sh" "${pkglist_args[@]}"))
542 # Create a list of packages to be finally installed as packages.list directly under the working directory.
543 echo -e "# The list of packages that is installed in live cd.\n#\n" > "${build_dir}/packages.list"
544 printf "%s\n" "${_pkglist[@]}" >> "${build_dir}/packages.list"
546 # Install packages on airootfs
547 _pacstrap "${_pkglist[@]}"
552 make_packages_aur() {
553 local _pkglist_aur=($("${tools_dir}/pkglist.sh" --aur "${pkglist_args[@]}"))
555 # Create a list of packages to be finally installed as packages.list directly under the working directory.
556 echo -e "\n# AUR packages.\n#\n" >> "${build_dir}/packages.list"
557 printf "%s\n" "${_pkglist_aur[@]}" >> "${build_dir}/packages.list"
560 cp -rf --preserve=mode "${script_path}/system/aur.sh" "${airootfs_dir}/root/aur.sh"
563 _run_with_pacmanconf _chroot_run "bash" "/root/aur.sh" "${makepkg_script_args[@]}" "${_pkglist_aur[@]}"
566 remove "${airootfs_dir}/root/aur.sh"
573 local _pkgbuild_dirs=("${channel_dir}/pkgbuild.any" "${channel_dir}/pkgbuild.${arch}")
574 for_module '_pkgbuild_dirs+=("${module_dir}/{}/pkgbuild.any" "${module_dir}/{}/pkgbuild.${arch}")'
576 # Copy PKGBUILD to work
577 mkdir -p "${airootfs_dir}/pkgbuilds/"
578 for _dir in $(find "${_pkgbuild_dirs[@]}" -type f -name "PKGBUILD" -print0 2>/dev/null | xargs -0 -I{} realpath {} | xargs -I{} dirname {}); do
579 msg_info "Find $(basename "${_dir}")"
580 cp -r "${_dir}" "${airootfs_dir}/pkgbuilds/"
584 cp -rf --preserve=mode "${script_path}/system/pkgbuild.sh" "${airootfs_dir}/root/pkgbuild.sh"
587 _run_with_pacmanconf _chroot_run "bash" "/root/pkgbuild.sh" "${makepkg_script_args[@]}" "/pkgbuilds"
590 remove "${airootfs_dir}/root/pkgbuild.sh"
595 # Customize installation (airootfs)
596 make_customize_airootfs() {
597 # Overwrite airootfs with customize_airootfs.
598 local _airootfs _airootfs_script_options _script _script_list _airootfs_list=() _main_script
600 for_module '_airootfs_list+=("${module_dir}/{}/airootfs.any" "${module_dir}/{}/airootfs.${arch}")'
601 _airootfs_list+=("${channel_dir}/airootfs.any" "${channel_dir}/airootfs.${arch}")
603 for _airootfs in "${_airootfs_list[@]}";do
604 if [[ -d "${_airootfs}" ]]; then
605 msg_debug "Copying airootfs ${_airootfs} ..."
606 cp -af "${_airootfs}"/* "${airootfs_dir}"
610 # Replace /etc/mkinitcpio.conf if Plymouth is enabled.
611 if [[ "${boot_splash}" = true ]]; then
612 cp -f "${script_path}/mkinitcpio/mkinitcpio-plymouth.conf" "${airootfs_dir}/etc/mkinitcpio.conf"
614 cp -f "${script_path}/mkinitcpio/mkinitcpio.conf" "${airootfs_dir}/etc/mkinitcpio.conf"
617 # customize_airootfs options
618 # -b : Enable boot splash.
619 # -d : Enable debug mode.
620 # -g <locale_gen_name> : Set locale-gen.
621 # -i <inst_dir> : Set install dir
622 # -k <kernel config line> : Set kernel name.
623 # -o <os name> : Set os name.
624 # -p <password> : Set password.
625 # -s <shell> : Set user shell.
626 # -t : Set plymouth theme.
627 # -u <username> : Set live user name.
628 # -x : Enable bash debug mode.
629 # -z <locale_time> : Set the time zone.
630 # -l <locale_name> : Set language.
632 # -j is obsolete in AlterISO3 and cannot be used.
633 # -r is obsolete due to the removal of rebuild.
634 # -k changed in AlterISO3 from passing kernel name to passing kernel configuration.
636 # Generate options of customize_airootfs.sh.
637 _airootfs_script_options="-p '${password}' -k '${kernel} ${kernel_filename} ${kernel_mkinitcpio_profile}' -u '${username}' -o '${os_name}' -i '${install_dir}' -s '${usershell}' -a '${arch}' -g '${locale_gen_name}' -l '${locale_name}' -z '${locale_time}' -t ${theme_name}"
638 [[ "${boot_splash}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -b"
639 [[ "${debug}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -d"
640 [[ "${bash_debug}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -x"
642 _main_script="root/customize_airootfs.sh"
645 "${airootfs_dir}/root/customize_airootfs_${channel_name}.sh"
646 "${airootfs_dir}/root/customize_airootfs_${channel_name%.add}.sh"
649 for_module '_script_list+=("${airootfs_dir}/root/customize_airootfs_{}.sh")'
652 for _script in "${_script_list[@]}"; do
653 if [[ -f "${_script}" ]]; then
654 echo -e "\n$(cat "${_script}")" >> "${airootfs_dir}/${_main_script}"
657 msg_debug "${_script} was not found."
661 chmod 755 "${airootfs_dir}/${_main_script}"
662 cp "${airootfs_dir}/${_main_script}" "${build_dir}/$(basename ${_main_script})"
663 _chroot_run "${_main_script} ${_airootfs_script_options}"
664 remove "${airootfs_dir}/${_main_script}"
666 # /root permission https://github.com/archlinux/archiso/commit/d39e2ba41bf556674501062742190c29ee11cd59
667 chmod -f 750 "${airootfs_dir}/root"
672 # Copy mkinitcpio archiso hooks and build initramfs (airootfs)
673 make_setup_mkinitcpio() {
675 mkdir -p "${airootfs_dir}/etc/initcpio/hooks" "${airootfs_dir}/etc/initcpio/install"
677 for _hook in "archiso" "archiso_shutdown" "archiso_pxe_common" "archiso_pxe_nbd" "archiso_pxe_http" "archiso_pxe_nfs" "archiso_loop_mnt"; do
678 cp "${script_path}/system/initcpio/hooks/${_hook}" "${airootfs_dir}/etc/initcpio/hooks"
679 cp "${script_path}/system/initcpio/install/${_hook}" "${airootfs_dir}/etc/initcpio/install"
682 sed -i "s|/usr/lib/initcpio/|/etc/initcpio/|g" "${airootfs_dir}/etc/initcpio/install/archiso_shutdown"
683 cp "${script_path}/system/initcpio/install/archiso_kms" "${airootfs_dir}/etc/initcpio/install"
684 cp "${script_path}/system/initcpio/archiso_shutdown" "${airootfs_dir}/etc/initcpio"
685 if [[ "${boot_splash}" = true ]]; then
686 cp "${script_path}/mkinitcpio/mkinitcpio-archiso-plymouth.conf" "${airootfs_dir}/etc/mkinitcpio-archiso.conf"
688 cp "${script_path}/mkinitcpio/mkinitcpio-archiso.conf" "${airootfs_dir}/etc/mkinitcpio-archiso.conf"
690 if [[ "${gpg_key}" ]]; then
691 gpg --export "${gpg_key}" >"${build_dir}/gpgkey"
692 exec 17<>"${build_dir}/gpgkey"
695 _chroot_run "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/${kernel_filename} -g /boot/archiso.img"
697 [[ "${gpg_key}" ]] && exec 17<&-
702 # Prepare kernel/initramfs ${install_dir}/boot/
704 mkdir -p "${isofs_dir}/${install_dir}/boot/${arch}"
705 cp "${airootfs_dir}/boot/archiso.img" "${isofs_dir}/${install_dir}/boot/${arch}/archiso.img"
706 cp "${airootfs_dir}/boot/${kernel_filename}" "${isofs_dir}/${install_dir}/boot/${arch}/${kernel_filename}"
711 # Add other aditional/extra files to ${install_dir}/boot/
713 if [[ -e "${airootfs_dir}/boot/memtest86+/memtest.bin" ]]; then
714 install -m 0644 -- "${airootfs_dir}/boot/memtest86+/memtest.bin" "${isofs_dir}/${install_dir}/boot/memtest"
715 install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/"
716 install -m 0644 -- "${airootfs_dir}/usr/share/licenses/common/GPL2/license.txt" "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/"
720 msg_info "Preparing microcode for the ISO 9660 file system..."
722 for _ucode_image in {intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio}; do
723 if [[ -e "${airootfs_dir}/boot/${_ucode_image}" ]]; then
724 msg_info "Installimg ${_ucode_image} ..."
725 install -m 0644 -- "${airootfs_dir}/boot/${_ucode_image}" "${isofs_dir}/${install_dir}/boot/"
726 if [[ -e "${airootfs_dir}/usr/share/licenses/${_ucode_image%.*}/" ]]; then
727 install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/${_ucode_image%.*}/"
728 install -m 0644 -- "${airootfs_dir}/usr/share/licenses/${_ucode_image%.*}/"* "${isofs_dir}/${install_dir}/boot/licenses/${_ucode_image%.*}/"
737 # Prepare /${install_dir}/boot/syslinux
739 mkdir -p "${isofs_dir}/syslinux"
741 # 一時ディレクトリに設定ファイルをコピー
742 mkdir -p "${build_dir}/syslinux/"
743 cp -a "${script_path}/syslinux/"* "${build_dir}/syslinux/"
744 if [[ -d "${channel_dir}/syslinux" ]] && [[ "${customized_syslinux}" = true ]]; then
745 cp -af "${channel_dir}/syslinux"* "${build_dir}/syslinux/"
748 # copy all syslinux config to work dir
749 for _cfg in "${build_dir}/syslinux/"*.cfg; do
750 sed "s|%ARCHISO_LABEL%|${iso_label}|g;
751 s|%OS_NAME%|${os_name}|g;
752 s|%KERNEL_FILENAME%|${kernel_filename}|g;
754 s|%INSTALL_DIR%|${install_dir}|g" "${_cfg}" > "${isofs_dir}/syslinux/${_cfg##*/}"
757 # Replace the SYSLINUX configuration file with or without boot splash.
758 local _use_config_name _no_use_config_name _pxe_or_sys
759 if [[ "${boot_splash}" = true ]]; then
760 _use_config_name=splash
761 _no_use_config_name=nosplash
763 _use_config_name=nosplash
764 _no_use_config_name=splash
766 for _pxe_or_sys in "sys" "pxe"; do
767 remove "${isofs_dir}/syslinux/archiso_${_pxe_or_sys}_${_no_use_config_name}.cfg"
768 mv "${isofs_dir}/syslinux/archiso_${_pxe_or_sys}_${_use_config_name}.cfg" "${isofs_dir}/syslinux/archiso_${_pxe_or_sys}.cfg"
771 # Set syslinux wallpaper
772 if [[ -f "${channel_dir}/splash.png" ]]; then
773 cp "${channel_dir}/splash.png" "${isofs_dir}/syslinux"
775 cp "${script_path}/syslinux/splash.png" "${isofs_dir}/syslinux"
780 function _remove_config() {
781 remove "${isofs_dir}/syslinux/${1}"
782 sed -i "s|$(cat "${isofs_dir}/syslinux/archiso_sys_load.cfg" | grep "${1}")||g" "${isofs_dir}/syslinux/archiso_sys_load.cfg"
785 [[ "${norescue_entry}" = true ]] && _remove_config archiso_sys_rescue.cfg
786 [[ "${memtest86}" = false ]] && _remove_config memtest86.cfg
789 cp "${airootfs_dir}/usr/lib/syslinux/bios/"*.c32 "${isofs_dir}/syslinux"
790 cp "${airootfs_dir}/usr/lib/syslinux/bios/lpxelinux.0" "${isofs_dir}/syslinux"
791 cp "${airootfs_dir}/usr/lib/syslinux/bios/memdisk" "${isofs_dir}/syslinux"
794 if [[ -e "${isofs_dir}/syslinux/hdt.c32" ]]; then
795 install -d -m 0755 -- "${isofs_dir}/syslinux/hdt"
796 if [[ -e "${airootfs_dir}/usr/share/hwdata/pci.ids" ]]; then
797 gzip -c -9 "${airootfs_dir}/usr/share/hwdata/pci.ids" > "${isofs_dir}/syslinux/hdt/pciids.gz"
799 find "${airootfs_dir}/usr/lib/modules" -name 'modules.alias' -print -exec gzip -c -9 '{}' ';' -quit > "${isofs_dir}/syslinux/hdt/modalias.gz"
807 install -d -m 0755 -- "${isofs_dir}/syslinux"
808 sed "s|%INSTALL_DIR%|${install_dir}|g" "${script_path}/system/isolinux.cfg" > "${isofs_dir}/syslinux/isolinux.cfg"
809 install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isolinux.bin" "${isofs_dir}/syslinux/"
810 install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isohdpfx.bin" "${isofs_dir}/syslinux/"
817 install -d -m 0755 -- "${isofs_dir}/EFI/boot"
819 local _bootfile="$(basename "$(ls "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-boot"*".efi" )")"
820 install -m 0644 -- "${airootfs_dir}/usr/lib/systemd/boot/efi/${_bootfile}" "${isofs_dir}/EFI/boot/${_bootfile#systemd-}"
822 local _use_config_name="nosplash"
823 if [[ "${boot_splash}" = true ]]; then
824 _use_config_name="splash"
827 install -d -m 0755 -- "${isofs_dir}/loader/entries"
828 sed "s|%ARCH%|${arch}|g;" "${script_path}/efiboot/${_use_config_name}/loader.conf" > "${isofs_dir}/loader/loader.conf"
830 local _efi_config_list=() _efi_config
831 _efi_config_list+=($(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue"))
833 if [[ "${norescue_entry}" = false ]]; then
834 _efi_config_list+=($(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue"))
837 for _efi_config in "${_efi_config_list[@]}"; do
838 sed "s|%ARCHISO_LABEL%|${iso_label}|g;
839 s|%OS_NAME%|${os_name}|g;
840 s|%KERNEL_FILENAME%|${kernel_filename}|g;
842 s|%INSTALL_DIR%|${install_dir}|g" \
843 "${_efi_config}" > "${isofs_dir}/loader/entries/$(basename "${_efi_config}" | sed "s|usb|${arch}|g")"
846 # edk2-shell based UEFI shell
847 local _efi_shell_arch
848 if [[ -d "${airootfs_dir}/usr/share/edk2-shell" ]]; then
849 for _efi_shell_arch in $(find "${airootfs_dir}/usr/share/edk2-shell" -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -I{} basename {}); do
850 if [[ -f "${airootfs_dir}/usr/share/edk2-shell/${_efi_shell_arch}/Shell_Full.efi" ]]; then
851 cp "${airootfs_dir}/usr/share/edk2-shell/${_efi_shell_arch}/Shell_Full.efi" "${isofs_dir}/EFI/shell_${_efi_shell_arch}.efi"
852 elif [[ -f "${airootfs_dir}/usr/share/edk2-shell/${_efi_shell_arch}/Shell.efi" ]]; then
853 cp "${airootfs_dir}/usr/share/edk2-shell/${_efi_shell_arch}/Shell.efi" "${isofs_dir}/EFI/shell_${_efi_shell_arch}.efi"
857 echo -e "title UEFI Shell ${_efi_shell_arch}\nefi /EFI/shell_${_efi_shell_arch}.efi" > "${isofs_dir}/loader/entries/uefi-shell-${_efi_shell_arch}.conf"
864 # Prepare efiboot.img::/EFI for "El Torito" EFI boot mode
866 truncate -s 128M "${build_dir}/efiboot.img"
867 mkfs.fat -n ARCHISO_EFI "${build_dir}/efiboot.img"
869 mkdir -p "${build_dir}/efiboot"
870 mount "${build_dir}/efiboot.img" "${build_dir}/efiboot"
872 mkdir -p "${build_dir}/efiboot/EFI/alteriso/${arch}"
873 cp "${isofs_dir}/${install_dir}/boot/${arch}/${kernel_filename}" "${build_dir}/efiboot/EFI/alteriso/${arch}/${kernel_filename}.efi"
874 cp "${isofs_dir}/${install_dir}/boot/${arch}/archiso.img" "${build_dir}/efiboot/EFI/alteriso/${arch}/archiso.img"
877 for _ucode_image in "${airootfs_dir}/boot/"{intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio}; do
878 [[ -e "${_ucode_image}" ]] && cp "${_ucode_image}" "${build_dir}/efiboot/EFI/alteriso/"
881 mkdir -p "${build_dir}/efiboot/EFI/boot"
883 cp "${airootfs_dir}/usr/share/efitools/efi/HashTool.efi" "${build_dir}/efiboot/EFI/boot/"
885 local _bootfile="$(basename "$(ls "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-boot"*".efi" )")"
886 cp "${airootfs_dir}/usr/lib/systemd/boot/efi/${_bootfile}" "${build_dir}/efiboot/EFI/boot/${_bootfile#systemd-}"
888 local _use_config_name="nosplash"
889 [[ "${boot_splash}" = true ]] && _use_config_name="splash"
891 mkdir -p "${build_dir}/efiboot/loader/entries"
892 sed "s|%ARCH%|${arch}|g;" "${script_path}/efiboot/${_use_config_name}/loader.conf" > "${build_dir}/efiboot/loader/loader.conf"
894 find "${isofs_dir}/loader/entries/" -maxdepth 1 -mindepth 1 -name "uefi-shell*" -type f -printf "%p\0" | xargs -0 -I{} cp {} "${build_dir}/efiboot/loader/entries/"
896 local _efi_config _efi_config_list=($(ls "${script_path}/efiboot/${_use_config_name}/archiso-cd"*".conf"))
898 if [[ "${norescue_entry}" = false ]]; then
899 _efi_config_list=($(printf "%s\n" "${_efi_config_list[@]}" | grep -v "rescue"))
902 for _efi_config in "${_efi_config_list[@]}"; do
903 sed "s|%ARCHISO_LABEL%|${iso_label}|g;
904 s|%OS_NAME%|${os_name}|g;
905 s|%KERNEL_FILENAME%|${kernel_filename}|g;
907 s|%INSTALL_DIR%|${install_dir}|g" \
908 "${_efi_config}" > "${build_dir}/efiboot/loader/entries/$(basename "${_efi_config}" | sed "s|cd|${arch}|g")"
911 find "${isofs_dir}/EFI" -maxdepth 1 -mindepth 1 -name "shell*.efi" -printf "%p\0" | xargs -0 -I{} cp {} "${build_dir}/efiboot/EFI/"
912 umount -d "${build_dir}/efiboot"
919 # backup airootfs.img for tarball
920 msg_info "Copying airootfs.img ..."
921 cp "${airootfs_dir}.img" "${airootfs_dir}.img.org"
925 if [[ -f "${airootfs_dir}/root/optimize_for_tarball.sh" ]]; then
926 _chroot_run "bash /root/optimize_for_tarball.sh -u ${username}"
930 _chroot_run "mkinitcpio -P"
932 remove "${airootfs_dir}/root/optimize_for_tarball.sh"
934 mkdir -p "${out_dir}"
935 msg_info "Creating tarball..."
936 local tar_path="$(realpath ${out_dir})/${iso_filename%.iso}.tar.xz"
937 cd -- "${airootfs_dir}"
938 tar -v -J -p -c -f "${tar_path}" ./*
941 _mkchecksum "${tar_path}"
942 msg_info "Done! | $(ls -sh ${tar_path})"
944 remove "${airootfs_dir}.img"
945 mv "${airootfs_dir}.img.org" "${airootfs_dir}.img"
947 if [[ "${noiso}" = true ]]; then
948 msg_info "The password for the live user and root is ${password}."
955 # Build airootfs filesystem image
959 # Create packages list
960 msg_info "Creating a list of installed packages on live-enviroment..."
962 pacman -Q --sysroot "${airootfs_dir}" | tee "${isofs_dir}/${install_dir}/pkglist.${arch}.txt" "${build_dir}/packages-full.list" > /dev/null
965 remove "${airootfs_dir}/root/optimize_for_tarball.sh"
969 mkdir -p -- "${isofs_dir}/${install_dir}/${arch}"
970 msg_info "Creating SquashFS image, this may take some time..."
971 mksquashfs "${airootfs_dir}" "${build_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" "${sfs_comp_opt[@]}"
974 msg_info "Creating checksum file for self-test..."
975 echo "$(sha512sum "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" | getclm 1) airootfs.sfs" > "${isofs_dir}/${install_dir}/${arch}/airootfs.sha512"
979 if [[ -v gpg_key ]] && (( "${#gpg_key}" != 0 )); then
980 msg_info "Creating signature file ($gpg_key) ..."
981 cd -- "${isofs_dir}/${install_dir}/${arch}"
982 gpg --detach-sign --default-key "${gpg_key}" "airootfs.sfs"
989 [[ "${cleaning}" = true ]] && remove "${airootfs_dir}" "${airootfs_dir}.img"
994 make_alteriso_info(){
996 if [[ "${include_info}" = true ]]; then
997 local _info_file="${isofs_dir}/alteriso-info" _version="${iso_version}"
998 remove "${_info_file}"; touch "${_info_file}"
999 [[ -d "${script_path}/.git" ]] && [[ "${gitversion}" = false ]] && _version="${iso_version}-${gitrev}"
1000 "${tools_dir}/alteriso-info.sh" -a "${arch}" -b "${boot_splash}" -c "${channel_name%.add}" -d "${iso_publisher}" -k "${kernel}" -o "${os_name}" -p "${password}" -u "${username}" -v "${_version}" > "${_info_file}"
1006 # Add files to the root of isofs
1008 local _over_isofs_list _isofs
1009 _over_isofs_list=("${channel_dir}/over_isofs.any""${channel_dir}/over_isofs.${arch}")
1010 for_module '_over_isofs_list+=("${module_dir}/{}/over_isofs.any""${module_dir}/{}/over_isofs.${arch}")'
1011 for _isofs in "${_over_isofs_list[@]}"; do
1012 [[ -d "${_isofs}" ]] && cp -af "${_isofs}"/* "${isofs_dir}"
1020 local _iso_efi_boot_args=()
1021 # If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image.
1022 if [[ -f "${build_dir}/efiboot.img" ]]; then
1023 _iso_efi_boot_args=(-append_partition 2 C12A7328-F81F-11D2-BA4B-00A0C93EC93B "${build_dir}/efiboot.img" -appended_part_as_gpt -eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot -isohybrid-gpt-basdat)
1026 mkdir -p -- "${out_dir}"
1027 msg_info "Creating ISO image..."
1028 xorriso -as mkisofs \
1030 -full-iso9660-filenames \
1034 -volid "${iso_label}" \
1035 -appid "${iso_application}" \
1036 -publisher "${iso_publisher}" \
1037 -preparer "prepared by AlterISO" \
1038 -eltorito-boot syslinux/isolinux.bin \
1039 -eltorito-catalog syslinux/boot.cat \
1040 -no-emul-boot -boot-load-size 4 -boot-info-table \
1041 -isohybrid-mbr ${build_dir}/iso/syslinux/isohdpfx.bin \
1042 "${_iso_efi_boot_args[@]}" \
1043 -output "${out_dir}/${iso_filename}" \
1045 _mkchecksum "${out_dir}/${iso_filename}"
1046 msg_info "Done! | $(ls -sh -- "${out_dir}/${iso_filename}")"
1048 msg_info "The password for the live user and root is ${password}."
1055 ARGUMENT=("${@}" ${DEFAULT_ARGUMENT})
1056 OPTS=("a:" "b" "c:" "d" "e" "g:" "h" "j" "k:" "l:" "o:" "p:" "r" "t:" "u:" "w:" "x")
1057 OPTL=("arch:" "boot-splash" "comp-type:" "debug" "cleaning" "cleanup" "gpgkey:" "help" "lang:" "japanese" "kernel:" "out:" "password:" "comp-opts:" "user:" "work:" "bash-debug" "nocolor" "noconfirm" "nodepend" "gitversion" "msgdebug" "noloopmod" "tarball" "noiso" "noaur" "nochkver" "channellist" "config:" "noefi" "nodebug" "nosigcheck" "normwork" "log" "logpath:" "nolog" "nopkgbuild" "pacman-debug" "confirm")
1058 if ! OPT=$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
1062 eval set -- "${OPT}"
1063 msg_debug "Argument: ${OPT}"
1064 unset OPT OPTS OPTL DEFAULT_ARGUMENT
1078 "gzip" | "lzma" | "lzo" | "lz4" | "xz" | "zstd") sfs_comp="${2}" ;;
1079 *) msg_error "Invaild compressors '${2}'" '1' ;;
1087 -e | --cleaning | --cleanup)
1100 msg_error "This option is obsolete in AlterISO 3. To use Japanese, use \"-l ja\"." "1"
1103 customized_kernel=true
1116 customized_password=true
1125 if [[ "${2}" = "reset" ]]; then
1133 customized_username=true
1134 username="$(echo -n "${2}" | sed 's/ //g' | tr '[:upper:]' '[:lower:]')"
1163 if [[ -d "${script_path}/.git" ]]; then
1166 msg_error "There is no git directory. You need to use git clone to use this feature." "1"
1226 customized_logpath=true
1242 msg_error "Invalid argument '${1}'"
1249 if (( ! "${EUID}" == 0 )); then
1250 msg_warn "This script must be run as root." >&2
1251 msg_warn "Re-run 'sudo ${0} ${ARGUMENT[*]}'"
1252 sudo "${0}" "${ARGUMENT[@]}"
1256 # Show config message
1257 msg_debug "Use the default configuration file (${defaultconfig})."
1258 [[ -f "${script_path}/custom.conf" ]] && msg_debug "The default settings have been overridden by custom.conf"
1261 [[ "${bash_debug}" = true ]] && set -x -v
1263 # Check for a valid channel name
1264 if [[ -n "${1+SET}" ]]; then
1265 case "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -n check "${1}"; printf "${?}")" in
1267 msg_error "Invalid channel ${1}" "1"
1271 channel_name="$(basename "${1%/}")"
1274 channel_dir="${script_path}/channels/${1}"
1279 channel_dir="${script_path}/channels/${channel_name}"
1283 work_dir="$(realpath "${work_dir}")"
1284 build_dir="${work_dir}/build/${arch}"
1285 cache_dir="${work_dir}/cache/${arch}"
1286 airootfs_dir="${build_dir}/airootfs"
1287 isofs_dir="${build_dir}/iso"
1288 lockfile_dir="${build_dir}/lockfile"
1289 gitrev="$(cd "${script_path}"; git rev-parse --short HEAD)"
1292 for _dir in "${build_dir}" "${cache_dir}" "${airootfs_dir}" "${isofs_dir}" "${lockfile_dir}"; do
1296 # Set for special channels
1297 if [[ -d "${channel_dir}.add" ]]; then
1299 channel_dir="${channel_dir}.add"
1300 elif [[ "${channel_name}" = "clean" ]]; then
1305 # Check channel version
1306 msg_debug "channel path is ${channel_dir}"
1307 if [[ ! "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" ver "${channel_name}" | cut -d "." -f 1)" = "$(echo "${alteriso_version}" | cut -d "." -f 1)" ]] && [[ "${nochkver}" = false ]]; then
1308 msg_error "This channel does not support Alter ISO 3."
1309 if [[ -d "${script_path}/.git" ]]; then
1310 msg_error "Please run \"git checkout alteriso-2\"" "1"
1312 msg_error "Please download old version here.\nhttps://github.com/FascodeNet/alterlinux/releases" "1"
1321 run_once make_pacman_conf
1322 run_once make_basefs # Mount airootfs
1323 run_once make_packages_repo
1324 [[ "${noaur}" = false ]] && run_once make_packages_aur
1325 [[ "${nopkgbuild}" = false ]] && run_once make_pkgbuild
1326 run_once make_customize_airootfs
1327 run_once make_setup_mkinitcpio
1328 [[ "${tarball}" = true ]] && run_once make_tarball
1329 if [[ "${noiso}" = false ]]; then
1330 run_once make_syslinux
1331 run_once make_isolinux
1333 run_once make_boot_extra
1334 if [[ "${noefi}" = false ]]; then
1336 run_once make_efiboot
1338 run_once make_alteriso_info
1339 run_once make_prepare
1340 run_once make_overisofs
1344 [[ "${cleaning}" = true ]] && _run_cleansh