X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=build.sh;h=07b324a0c37e0c4ccfd2b66d76565c498ad392b6;hb=32973d0650ce3a242b9664b410c6be6a8c41ff33;hp=bc5504d76a30fe1ec0c5b02b45eb59a68e20e65e;hpb=efc60b61f1c4a77c49e4d285c1f54f81873e892b;p=alterlinux%2Falterlinux.git diff --git a/build.sh b/build.sh index bc5504d7..07b324a0 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ # The main script that runs the build # -set -eu +set -Eeu # Internal config # Do not change these values. @@ -27,12 +27,14 @@ pkglist_args=() makepkg_script_args=() modules=() DEFAULT_ARGUMENT="" +ARGUMENT=("${@}") alteriso_version="3.1" +norepopkg=() # Load config file [[ ! -f "${defaultconfig}" ]] && "${tools_dir}/msg.sh" -a 'build.sh' error "${defaultconfig} was not found." && exit 1 for config in "${defaultconfig}" "${script_path}/custom.conf"; do - [[ -f "${config}" ]] && source "${config}" + [[ -f "${config}" ]] && source "${config}" && loaded_files+=("${config}") done umask 0022 @@ -60,8 +62,7 @@ msg_warn() { msg_common warn "${@}"; } # Show an debug message # ${1}: message string msg_debug() { - [[ "${debug}" = true ]] && msg_common debug "${@}" - return 0 + [[ "${debug}" = true ]] && msg_common debug "${@}" || return 0 } # Show an ERROR message then exit with status @@ -69,7 +70,7 @@ msg_debug() { # ${2}: exit code number (with 0 does not exit) msg_error() { msg_common error "${1}" - [[ -n "${2:-}" ]] && exit "${2}" + [[ -n "${2:-""}" ]] && exit "${2}" || return 0 } @@ -89,46 +90,39 @@ _usage () { echo " General options:" echo " -b | --boot-splash Enable boot splash" echo " -e | --cleanup | --cleaning Enable post-build cleaning" - echo " --tarball Build rootfs in tar.xz format" + echo " -r | --tarball Build rootfs in tar.xz format" echo " -h | --help This help message and exit" echo echo " -a | --arch Set iso architecture" - echo " Default: ${arch}" echo " -c | --comp-type Set SquashFS compression type (gzip, lzma, lzo, xz, zstd)" - echo " Default: ${sfs_comp}" echo " -g | --gpgkey Set gpg key" - echo " Default: ${gpg_key}" echo " -l | --lang Specifies the default language for the live environment" - echo " Default: ${locale_name}" - echo " -k | --kernel Set special kernel type.See below for available kernels" - echo " Default: ${defaultkernel}" + echo " -k | --kernel Set special kernel type. See below for available kernels" echo " -o | --out Set the output directory" - echo " Default: ${out_dir}" echo " -p | --password Set a live user password" - echo " Default: ${password}" echo " -t | --comp-opts Set compressor-specific options." - echo " Default: empty" echo " -u | --user Set user name" - echo " Default: ${username}" echo " -w | --work Set the working directory" - echo " Default: ${work_dir}" echo - local blank="33" _arch _dirname _type - + local blank="29" _arch _dirname _type _output _first for _type in "locale" "kernel"; do echo " ${_type} for each architecture:" for _arch in $(find "${script_path}/system/" -maxdepth 1 -mindepth 1 -name "${_type}-*" -print0 | xargs -I{} -0 basename {} | sed "s|${_type}-||g"); do - echo -n " ${_arch}$(echo_blank "$(( "${blank}" - 4 - "${#_arch}" ))")" - "${tools_dir}/${_type}.sh" -a "${_arch}" show + echo " ${_arch}$(echo_blank "$(( "${blank}" - "${#_arch}" ))")$("${tools_dir}/${_type}.sh" -a "${_arch}" show)" done echo done echo " Channel:" - for _dirname in $(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -d -b -n show); do - echo -ne " ${_dirname%.add}$(echo_blank "$(( "${blank}" - 3 - "$(echo "${_dirname%.add}" | wc -m)" ))")" - "${tools_dir}/channel.sh" --version "${alteriso_version}" --nocheck desc "${_dirname%.add}" + for _dirname in $(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -d -b -n --line show | sed "s|.add$||g"); do + readarray -t _output < <("${tools_dir}/channel.sh" --version "${alteriso_version}" --nocheck desc "${_dirname}") + _first=true + echo -n " ${_dirname}" + for _out in "${_output[@]}"; do + "${_first}" && echo -e " $(echo_blank "$(( "${blank}" - 4 - "${#_dirname}" ))")${_out}" || echo -e " $(echo_blank "$(( "${blank}" + 5 - "${#_dirname}" ))")${_out}" + _first=false + done done echo @@ -136,7 +130,8 @@ _usage () { echo " -d | --debug Enable debug messages" echo " -x | --bash-debug Enable bash debug mode(set -xv)" echo " --channellist Output the channel list and exit" - echo " --gitversion Add Git commit hash to image file version" + echo " --config Load additional config file" + echo " --[no]gitversion Add Git commit hash to image file version" echo " --logpath Set log file path (use with --log)" echo " --[no]log (No) log ;re-run script with tee" echo " --msgdebug Enables output debugging" @@ -144,14 +139,18 @@ _usage () { echo " --nocolor No output colored output" echo " --[no]confirm (No) check the settings before building" echo " --nochkver No check the version of the channel" - echo " --nodebug No debug message" + echo " --nodebug Disable all debug messages" echo " --noefi No efi boot (Use only for debugging)" echo " --noloopmod No check and load kernel module automatically" echo " --nodepend No check package dependencies before building" echo " --noiso No build iso image (Use with --tarball)" + echo " --nosigcheck No pacman signature check" echo " --pacman-debug Enable pacman debug mode" echo " --normwork No remove working dir" echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)" + echo " --tar-type Set compression type (gzip, lzma, lzo, xz, zstd)" + echo " --tar-opts