Skip to content

Commit 55a8261

Browse files
committedAug 6, 2021
Merge branch 'dev' into dev-stable
2 parents 37962bb + cfdbedc commit 55a8261

File tree

48 files changed

+350
-379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+350
-379
lines changed
 

‎.github/workflows/shellcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
- name: Run ShellCheck
3030
uses: ludeeus/action-shellcheck@master
3131
with:
32-
severity: error
32+
severity: warning
3333
env:
3434
SHELLCHECK_OPTS: --shell=bash

‎build.sh

+35-59
Original file line numberDiff line numberDiff line change
@@ -90,53 +90,48 @@ _usage () {
9090
echo " General options:"
9191
echo " -b | --boot-splash Enable boot splash"
9292
echo " -e | --cleanup | --cleaning Enable post-build cleaning"
93-
echo " --tarball Build rootfs in tar.xz format"
93+
echo " -r | --tarball Build rootfs in tar.xz format"
9494
echo " -h | --help This help message and exit"
9595
echo
9696
echo " -a | --arch <arch> Set iso architecture"
97-
echo " Default: ${arch}"
9897
echo " -c | --comp-type <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz, zstd)"
99-
echo " Default: ${sfs_comp}"
10098
echo " -g | --gpgkey <key> Set gpg key"
101-
echo " Default: ${gpg_key}"
10299
echo " -l | --lang <lang> Specifies the default language for the live environment"
103-
echo " Default: ${locale_name}"
104-
echo " -k | --kernel <kernel> Set special kernel type.See below for available kernels"
105-
echo " Default: ${defaultkernel}"
100+
echo " -k | --kernel <kernel> Set special kernel type. See below for available kernels"
106101
echo " -o | --out <out_dir> Set the output directory"
107-
echo " Default: ${out_dir}"
108102
echo " -p | --password <password> Set a live user password"
109-
echo " Default: ${password}"
110103
echo " -t | --comp-opts <options> Set compressor-specific options."
111-
echo " Default: empty"
112104
echo " -u | --user <username> Set user name"
113-
echo " Default: ${username}"
114105
echo " -w | --work <work_dir> Set the working directory"
115-
echo " Default: ${work_dir}"
116106
echo
117107

118-
local blank="33" _arch _dirname _type
119-
108+
local blank="29" _arch _dirname _type _output _first
120109
for _type in "locale" "kernel"; do
121110
echo " ${_type} for each architecture:"
122111
for _arch in $(find "${script_path}/system/" -maxdepth 1 -mindepth 1 -name "${_type}-*" -print0 | xargs -I{} -0 basename {} | sed "s|${_type}-||g"); do
123-
echo -n " ${_arch}$(echo_blank "$(( "${blank}" - 4 - "${#_arch}" ))")"
112+
echo -n " ${_arch}$(echo_blank "$(( "${blank}" - "${#_arch}" ))")"
124113
"${tools_dir}/${_type}.sh" -a "${_arch}" show
125114
done
126115
echo
127116
done
128117

129118
echo " Channel:"
130119
for _dirname in $(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -d -b -n --line show | sed "s|.add$||g"); do
131-
echo -ne " ${_dirname}$(echo_blank "$(( "${blank}" - 4 - "${#_dirname}" ))")"
132-
"${tools_dir}/channel.sh" --version "${alteriso_version}" --nocheck desc "${_dirname}"
120+
readarray -t _output < <("${tools_dir}/channel.sh" --version "${alteriso_version}" --nocheck desc "${_dirname}")
121+
_first=true
122+
echo -n " ${_dirname}"
123+
for _out in "${_output[@]}"; do
124+
"${_first}" && echo -e " $(echo_blank "$(( "${blank}" - 4 - "${#_dirname}" ))")${_out}" || echo -e " $(echo_blank "$(( "${blank}" + 5 - "${#_dirname}" ))")${_out}"
125+
_first=false
126+
done
133127
done
134128

135129
echo
136130
echo " Debug options: Please use at your own risk."
137131
echo " -d | --debug Enable debug messages"
138132
echo " -x | --bash-debug Enable bash debug mode(set -xv)"
139133
echo " --channellist Output the channel list and exit"
134+
echo " --config Load additional config file"
140135
echo " --gitversion Add Git commit hash to image file version"
141136
echo " --logpath <file> Set log file path (use with --log)"
142137
echo " --[no]log (No) log ;re-run script with tee"
@@ -145,11 +140,12 @@ _usage () {
145140
echo " --nocolor No output colored output"
146141
echo " --[no]confirm (No) check the settings before building"
147142
echo " --nochkver No check the version of the channel"
148-
echo " --nodebug No debug message"
143+
echo " --nodebug Disable all debug messages"
149144
echo " --noefi No efi boot (Use only for debugging)"
150145
echo " --noloopmod No check and load kernel module automatically"
151146
echo " --nodepend No check package dependencies before building"
152147
echo " --noiso No build iso image (Use with --tarball)"
148+
echo " --nosigcheck No pacman signature check"
153149
echo " --pacman-debug Enable pacman debug mode"
154150
echo " --normwork No remove working dir"
155151
echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)"
@@ -228,10 +224,7 @@ show_channel_list() {
228224

229225
# Execute command for each module. It will be executed with {} replaced with the module name.
230226
# for_module <command>
231-
for_module(){
232-
local module
233-
for module in "${modules[@]}"; do eval "${@//"{}"/${module}}"; done
234-
}
227+
for_module(){ local module && for module in "${modules[@]}"; do eval "${@//"{}"/${module}}"; done; }
235228

236229
# pacstrapを実行
237230
_pacstrap(){
@@ -390,6 +383,7 @@ show_settings() {
390383
msg_info "The compression method of squashfs is ${sfs_comp}."
391384
msg_info "Use the ${channel_name%.add} channel."
392385
msg_info "Build with architecture ${arch}."
386+
(( "${#additional_exclude_pkg[@]}" != 0 )) && msg_info "Excluded packages: ${additional_exclude_pkg[*]}"
393387
if [[ "${noconfirm}" = false ]]; then
394388
echo -e "\nPress Enter to continue or Ctrl + C to cancel."
395389
read -r
@@ -404,41 +398,37 @@ show_settings() {
404398

405399
# Preparation for build
406400
prepare_build() {
401+
# Debug mode
402+
[[ "${bash_debug}" = true ]] && set -x -v
403+
407404
# Show alteriso version
408-
if [[ -d "${script_path}/.git" ]]; then
409-
cd "${script_path}"
410-
msg_debug "The version of alteriso is $(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')."
411-
cd "${OLDPWD}"
412-
fi
405+
[[ -n "${gitrev-""}" ]] && msg_debug "The version of alteriso is ${gitrev}"
413406

414407
# Load configs
415408
load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
416409

417-
# Debug mode
418-
if [[ "${bash_debug}" = true ]]; then
419-
set -x -v
420-
fi
421-
422410
# Legacy mode
423411
if [[ "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" ver "${channel_name}")" = "3.0" ]]; then
424412
msg_warn "The module cannot be used because it works with Alter ISO3.0 compatibility."
425-
case "${include_extra-"unset"}" in
426-
"true")
427-
modules=("base" "share" "share-extra" "gtk-tools" "pamac" "calamares" "zsh-powerline")
428-
;;
429-
"false" | "unset")
430-
modules=("base" "share")
431-
;;
432-
esac
413+
modules=("legacy")
414+
[[ "${include_extra-"unset"}" = true ]] && modules=("legacy-extra")
433415
fi
434416

435-
local module_check
417+
# Load presets
418+
local _modules=() module_check
419+
for_module '[[ -f "${preset_dir}/{}" ]] && readarray -t -O "${#_modules[@]}" _modules < <(cat "${preset_dir}/{}") || _modules+=("{}")'
420+
modules=("${_modules[@]}")
421+
unset _modules
422+
423+
# Check modules
436424
module_check(){
437425
msg_debug "Checking ${1} module ..."
438426
bash "${tools_dir}/module.sh" check "${1}" || msg_error "Module ${1} is not available." "1";
439427
}
440428
readarray -t modules < <(printf "%s\n" "${modules[@]}" | awk '!a[$0]++')
441429
for_module "module_check {}"
430+
431+
# Load modules
442432
for_module load_config "${module_dir}/{}/config.any" "${module_dir}/{}/config.${arch}"
443433
msg_debug "Loaded modules: ${modules[*]}"
444434
! printf "%s\n" "${modules[@]}" | grep -x "share" >/dev/null 2>&1 && msg_warn "The share module is not loaded."
@@ -478,9 +468,7 @@ prepare_build() {
478468
# Check architecture for each channel
479469
local _exit=0
480470
bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -a "${arch}" -n -b check "${channel_name}" || _exit="${?}"
481-
if (( "${_exit}" != 0 )) && (( "${_exit}" != 1 )); then
482-
msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
483-
fi
471+
( (( "${_exit}" != 0 )) && (( "${_exit}" != 1 )) ) && msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
484472

485473
# Run with tee
486474
if [[ ! "${logging}" = false ]]; then
@@ -1034,9 +1022,7 @@ make_overisofs() {
10341022
make_iso() {
10351023
local _iso_efi_boot_args=()
10361024
# If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image.
1037-
if [[ -f "${build_dir}/efiboot.img" ]]; then
1038-
_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)
1039-
fi
1025+
[[ -f "${build_dir}/efiboot.img" ]] && _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)
10401026

10411027
mkdir -p -- "${out_dir}"
10421028
msg_info "Creating ISO image..."
@@ -1070,13 +1056,8 @@ make_iso() {
10701056
ARGUMENT=("${DEFAULT_ARGUMENT[@]}" "${@}")
10711057
OPTS=("a:" "b" "c:" "d" "e" "g:" "h" "j" "k:" "l:" "o:" "p:" "r" "t:" "u:" "w:" "x")
10721058
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" "tar-type:" "tar-opts:")
1073-
if ! OPT=$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
1074-
#if ! readarray OPT < <(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
1075-
exit 1
1076-
fi
1059+
OPT="$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}")" || exit 1
10771060

1078-
#eval set -- "${OPT[@]}"4
1079-
#msg_debug "Argument: ${OPT[@]}"
10801061
eval set -- "${OPT}"
10811062
msg_debug "Argument: ${OPT}"
10821063
unset OPT OPTS OPTL DEFAULT_ARGUMENT
@@ -1308,12 +1289,7 @@ else
13081289
fi
13091290

13101291
# Set vars
1311-
build_dir="${work_dir}/build/${arch}"
1312-
cache_dir="${work_dir}/cache/${arch}"
1313-
airootfs_dir="${build_dir}/airootfs"
1314-
isofs_dir="${build_dir}/iso"
1315-
lockfile_dir="${build_dir}/lockfile"
1316-
gitrev="$(cd "${script_path}"; git rev-parse --short HEAD)"
1292+
build_dir="${work_dir}/build/${arch}" cache_dir="${work_dir}/cache/${arch}" airootfs_dir="${build_dir}/airootfs" isofs_dir="${build_dir}/iso" lockfile_dir="${build_dir}/lockfile" gitrev="$(cd "${script_path}"; git rev-parse --short HEAD)" preset_dir="${script_path}/presets"
13171293

13181294
# Create dir
13191295
for _dir in build_dir cache_dir airootfs_dir isofs_dir lockfile_dir out_dir; do

0 commit comments

Comments
 (0)
Please sign in to comment.