@@ -90,53 +90,48 @@ _usage () {
90
90
echo " General options:"
91
91
echo " -b | --boot-splash Enable boot splash"
92
92
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"
94
94
echo " -h | --help This help message and exit"
95
95
echo
96
96
echo " -a | --arch <arch> Set iso architecture"
97
- echo " Default: ${arch} "
98
97
echo " -c | --comp-type <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz, zstd)"
99
- echo " Default: ${sfs_comp} "
100
98
echo " -g | --gpgkey <key> Set gpg key"
101
- echo " Default: ${gpg_key} "
102
99
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"
106
101
echo " -o | --out <out_dir> Set the output directory"
107
- echo " Default: ${out_dir} "
108
102
echo " -p | --password <password> Set a live user password"
109
- echo " Default: ${password} "
110
103
echo " -t | --comp-opts <options> Set compressor-specific options."
111
- echo " Default: empty"
112
104
echo " -u | --user <username> Set user name"
113
- echo " Default: ${username} "
114
105
echo " -w | --work <work_dir> Set the working directory"
115
- echo " Default: ${work_dir} "
116
106
echo
117
107
118
- local blank=" 33" _arch _dirname _type
119
-
108
+ local blank=" 29" _arch _dirname _type _output _first
120
109
for _type in " locale" " kernel" ; do
121
110
echo " ${_type} for each architecture:"
122
111
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} " )) " ) "
124
113
" ${tools_dir} /${_type} .sh" -a " ${_arch} " show
125
114
done
126
115
echo
127
116
done
128
117
129
118
echo " Channel:"
130
119
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
133
127
done
134
128
135
129
echo
136
130
echo " Debug options: Please use at your own risk."
137
131
echo " -d | --debug Enable debug messages"
138
132
echo " -x | --bash-debug Enable bash debug mode(set -xv)"
139
133
echo " --channellist Output the channel list and exit"
134
+ echo " --config Load additional config file"
140
135
echo " --gitversion Add Git commit hash to image file version"
141
136
echo " --logpath <file> Set log file path (use with --log)"
142
137
echo " --[no]log (No) log ;re-run script with tee"
@@ -145,11 +140,12 @@ _usage () {
145
140
echo " --nocolor No output colored output"
146
141
echo " --[no]confirm (No) check the settings before building"
147
142
echo " --nochkver No check the version of the channel"
148
- echo " --nodebug No debug message "
143
+ echo " --nodebug Disable all debug messages "
149
144
echo " --noefi No efi boot (Use only for debugging)"
150
145
echo " --noloopmod No check and load kernel module automatically"
151
146
echo " --nodepend No check package dependencies before building"
152
147
echo " --noiso No build iso image (Use with --tarball)"
148
+ echo " --nosigcheck No pacman signature check"
153
149
echo " --pacman-debug Enable pacman debug mode"
154
150
echo " --normwork No remove working dir"
155
151
echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)"
@@ -228,10 +224,7 @@ show_channel_list() {
228
224
229
225
# Execute command for each module. It will be executed with {} replaced with the module name.
230
226
# 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 ; }
235
228
236
229
# pacstrapを実行
237
230
_pacstrap (){
@@ -390,6 +383,7 @@ show_settings() {
390
383
msg_info " The compression method of squashfs is ${sfs_comp} ."
391
384
msg_info " Use the ${channel_name% .add} channel."
392
385
msg_info " Build with architecture ${arch} ."
386
+ (( "${# additional_exclude_pkg[@]} " != 0 )) && msg_info " Excluded packages: ${additional_exclude_pkg[*]} "
393
387
if [[ " ${noconfirm} " = false ]]; then
394
388
echo -e " \nPress Enter to continue or Ctrl + C to cancel."
395
389
read -r
@@ -404,41 +398,37 @@ show_settings() {
404
398
405
399
# Preparation for build
406
400
prepare_build () {
401
+ # Debug mode
402
+ [[ " ${bash_debug} " = true ]] && set -x -v
403
+
407
404
# 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} "
413
406
414
407
# Load configs
415
408
load_config " ${channel_dir} /config.any" " ${channel_dir} /config.${arch} "
416
409
417
- # Debug mode
418
- if [[ " ${bash_debug} " = true ]]; then
419
- set -x -v
420
- fi
421
-
422
410
# Legacy mode
423
411
if [[ " $( bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " ver " ${channel_name} " ) " = " 3.0" ]]; then
424
412
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" )
433
415
fi
434
416
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
436
424
module_check (){
437
425
msg_debug " Checking ${1} module ..."
438
426
bash " ${tools_dir} /module.sh" check " ${1} " || msg_error " Module ${1} is not available." " 1" ;
439
427
}
440
428
readarray -t modules < <( printf " %s\n" " ${modules[@]} " | awk ' !a[$0]++' )
441
429
for_module " module_check {}"
430
+
431
+ # Load modules
442
432
for_module load_config " ${module_dir} /{}/config.any" " ${module_dir} /{}/config.${arch} "
443
433
msg_debug " Loaded modules: ${modules[*]} "
444
434
! 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() {
478
468
# Check architecture for each channel
479
469
local _exit=0
480
470
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"
484
472
485
473
# Run with tee
486
474
if [[ ! " ${logging} " = false ]]; then
@@ -1034,9 +1022,7 @@ make_overisofs() {
1034
1022
make_iso () {
1035
1023
local _iso_efi_boot_args=()
1036
1024
# 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)
1040
1026
1041
1027
mkdir -p -- " ${out_dir} "
1042
1028
msg_info " Creating ISO image..."
@@ -1070,13 +1056,8 @@ make_iso() {
1070
1056
ARGUMENT=(" ${DEFAULT_ARGUMENT[@]} " " ${@ } " )
1071
1057
OPTS=(" a:" " b" " c:" " d" " e" " g:" " h" " j" " k:" " l:" " o:" " p:" " r" " t:" " u:" " w:" " x" )
1072
1058
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
1077
1060
1078
- # eval set -- "${OPT[@]}"4
1079
- # msg_debug "Argument: ${OPT[@]}"
1080
1061
eval set -- " ${OPT} "
1081
1062
msg_debug " Argument: ${OPT} "
1082
1063
unset OPT OPTS OPTL DEFAULT_ARGUMENT
@@ -1308,12 +1289,7 @@ else
1308
1289
fi
1309
1290
1310
1291
# 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"
1317
1293
1318
1294
# Create dir
1319
1295
for _dir in build_dir cache_dir airootfs_dir isofs_dir lockfile_dir out_dir; do
0 commit comments