@@ -30,6 +30,8 @@ DEFAULT_ARGUMENT=""
30
30
ARGUMENT=(" ${@ } " )
31
31
alteriso_version=" 3.1"
32
32
norepopkg=()
33
+ legacy_mode=false
34
+ rerun=false
33
35
34
36
# Load config file
35
37
[[ ! -f " ${defaultconfig} " ]] && " ${tools_dir} /msg.sh" -a ' build.sh' error " ${defaultconfig} was not found." && exit 1
@@ -42,8 +44,7 @@ umask 0022
42
44
# Message common function
43
45
# msg_common [type] [-n] [string]
44
46
msg_common (){
45
- local _msg_opts=(" -a" " build.sh" ) _type=" ${1} "
46
- shift 1
47
+ local _msg_opts=(" -a" " build.sh" ) _type=" ${1} " && shift 1
47
48
[[ " ${1} " = " -n" ]] && _msg_opts+=(" -o" " -n" ) && shift 1
48
49
[[ " ${msgdebug} " = true ]] && _msg_opts+=(" -x" )
49
50
[[ " ${nocolor} " = true ]] && _msg_opts+=(" -n" )
@@ -83,28 +84,7 @@ getclm() { cut -d " " -f "${1}"; }
83
84
echo_blank (){ yes " " 2> /dev/null | head -n " ${1} " | tr -d " \n" ; }
84
85
85
86
_usage () {
86
- echo " usage ${0} [options] [channel]"
87
- echo
88
- echo " A channel is a profile of AlterISO settings."
89
- echo
90
- echo " General options:"
91
- echo " -b | --boot-splash Enable boot splash"
92
- echo " -e | --cleanup | --cleaning Enable post-build cleaning"
93
- echo " -r | --tarball Build rootfs in tar.xz format"
94
- echo " -h | --help This help message and exit"
95
- echo
96
- echo " -a | --arch <arch> Set iso architecture"
97
- echo " -c | --comp-type <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz, zstd)"
98
- echo " -g | --gpgkey <key> Set gpg key"
99
- echo " -l | --lang <lang> Specifies the default language for the live environment"
100
- echo " -k | --kernel <kernel> Set special kernel type. See below for available kernels"
101
- echo " -o | --out <out_dir> Set the output directory"
102
- echo " -p | --password <password> Set a live user password"
103
- echo " -t | --comp-opts <options> Set compressor-specific options."
104
- echo " -u | --user <username> Set user name"
105
- echo " -w | --work <work_dir> Set the working directory"
106
- echo
107
-
87
+ cat " ${script_path} /docs/build.sh/help.1"
108
88
local blank=" 29" _arch _dirname _type _output _first
109
89
for _type in " locale" " kernel" ; do
110
90
echo " ${_type} for each architecture:"
@@ -124,36 +104,7 @@ _usage () {
124
104
_first=false
125
105
done
126
106
done
127
-
128
- echo
129
- echo " Debug options: Please use at your own risk."
130
- echo " -d | --debug Enable debug messages"
131
- echo " -x | --bash-debug Enable bash debug mode(set -xv)"
132
- echo " --channellist Output the channel list and exit"
133
- echo " --config Load additional config file"
134
- echo " --[no]gitversion Add Git commit hash to image file version"
135
- echo " --logpath <file> Set log file path (use with --log)"
136
- echo " --[no]log (No) log ;re-run script with tee"
137
- echo " --msgdebug Enables output debugging"
138
- echo " --noaur Ignore aur packages (Use only for debugging)"
139
- echo " --nocolor No output colored output"
140
- echo " --[no]confirm (No) check the settings before building"
141
- echo " --nochkver No check the version of the channel"
142
- echo " --nodebug Disable all debug messages"
143
- echo " --noefi No efi boot (Use only for debugging)"
144
- echo " --noloopmod No check and load kernel module automatically"
145
- echo " --nodepend No check package dependencies before building"
146
- echo " --noiso No build iso image (Use with --tarball)"
147
- echo " --nosigcheck No pacman signature check"
148
- echo " --pacman-debug Enable pacman debug mode"
149
- echo " --normwork No remove working dir"
150
- echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)"
151
- echo " --tar-type <comp_type> Set compression type (gzip, lzma, lzo, xz, zstd)"
152
- echo " --tar-opts <option> Set tar command argument (Use with --tarball)"
153
- echo " --add-module <module> Load additional modules (Separated by \" ,\" )"
154
- echo
155
- echo " Many packages are installed from AUR, so specifying --noaur can cause problems."
156
- echo
107
+ cat " ${script_path} /docs/build.sh/help.2"
157
108
[[ -n " ${1:- } " ]] && exit " ${1} "
158
109
}
159
110
@@ -298,7 +249,8 @@ check_bool() {
298
249
for _variable in " ${@ } " ; do
299
250
msg_debug -n " Checking ${_variable} ..."
300
251
eval " : \$ {${_variable} :=''}"
301
- _value=" $( eval echo " \$ ${_variable} " ) "
252
+ _value=" $( eval echo " \$ {${_variable} ,,}" ) "
253
+ eval " ${_variable} =${_value} "
302
254
if [[ ! -v " ${1} " ]] || [[ " ${_value} " = " " ]]; then
303
255
[[ " ${debug} " = true ]] && echo ; msg_error " The variable name ${_variable} is empty." " 1"
304
256
elif [[ ! " ${_value} " = " true" ]] && [[ ! " ${_value} " = " false" ]]; then
@@ -414,6 +366,7 @@ prepare_build() {
414
366
if [[ " $( bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " ver " ${channel_name} " ) " = " 3.0" ]]; then
415
367
msg_warn " The module cannot be used because it works with Alter ISO3.0 compatibility."
416
368
modules=(" legacy" )
369
+ legacy_mode=true
417
370
[[ " ${include_extra-" unset" } " = true ]] && modules=(" legacy-extra" )
418
371
fi
419
372
@@ -425,8 +378,8 @@ prepare_build() {
425
378
426
379
# Check modules
427
380
module_check (){
428
- msg_debug " Checking ${1} module ..."
429
- bash " ${tools_dir} /module.sh" check " ${1} " || msg_error " Module ${1} is not available." " 1" ;
381
+ msg_debug -n " Checking ${1} module ... "
382
+ bash " ${tools_dir} /module.sh" check " ${1} " || msg_error " Module ${1} is not available." " 1" && echo " ${module_dir} / ${1} "
430
383
}
431
384
readarray -t modules < <( printf " %s\n" " ${modules[@]} " | awk ' !a[$0]++' )
432
385
for_module " module_check {}"
@@ -478,8 +431,8 @@ prepare_build() {
478
431
if [[ ! " ${logging} " = false ]]; then
479
432
[[ " ${customized_logpath} " = false ]] && logging=" ${out_dir} /${iso_filename% .iso} .log"
480
433
mkdir -p " $( dirname " ${logging} " ) " && touch " ${logging} "
481
- msg_warn " Re-run sudo ${0} ${ARGUMENT[*]} --nodepend --nolog --nocolor 2>&1 | tee ${logging} "
482
- sudo " ${0} " " ${ARGUMENT[@]} " --nolog --nocolor --nodepend 2>&1 | tee " ${logging} "
434
+ msg_warn " Re-run sudo ${0} ${ARGUMENT[*]} --nodepend --nolog --nocolor --rerun 2>&1 | tee ${logging} "
435
+ sudo " ${0} " " ${ARGUMENT[@]} " --nolog --nocolor --nodepend --rerun 2>&1 | tee " ${logging} "
483
436
exit " ${?} "
484
437
fi
485
438
@@ -549,18 +502,20 @@ make_packages_repo() {
549
502
readarray -t _pkglist_install < <( " ${tools_dir} /pkglist.sh" " ${pkglist_args[@]} " )
550
503
551
504
# Package check
552
- # readarray -t _pkglist < <("${tools_dir}/pkglist.sh" "${pkglist_args[@]}")
553
- # readarray -t repopkgs < <(pacman-conf -c "${build_pacman_conf}" -l | xargs -I{} pacman -Sql --config "${build_pacman_conf}" --color=never {} && pacman -Sg)
554
- # local _pkg
555
- # for _pkg in "${_pkglist[@]}"; do
556
- # msg_info "Checking ${_pkg}..."
557
- # if printf "%s\n" "${repopkgs[@]}" | grep -qx "${_pkg}"; then
558
- # _pkglist_install+=("${_pkg}")
559
- # else
560
- # msg_info "${_pkg} was not found. Install it with yay from AUR"
561
- # norepopkg+=("${_pkg}")
562
- # fi
563
- # done
505
+ if [[ " ${legacy_mode} " = true ]]; then
506
+ readarray -t _pkglist < <( " ${tools_dir} /pkglist.sh" " ${pkglist_args[@]} " )
507
+ readarray -t repopkgs < <( pacman-conf -c " ${build_pacman_conf} " -l | xargs -I{} pacman -Sql --config " ${build_pacman_conf} " --color=never {} && pacman -Sg)
508
+ local _pkg
509
+ for _pkg in " ${_pkglist[@]} " ; do
510
+ msg_info " Checking ${_pkg} ..."
511
+ if printf " %s\n" " ${repopkgs[@]} " | grep -qx " ${_pkg} " ; then
512
+ _pkglist_install+=(" ${_pkg} " )
513
+ else
514
+ msg_info " ${_pkg} was not found. Install it with yay from AUR"
515
+ norepopkg+=(" ${_pkg} " )
516
+ fi
517
+ done
518
+ fi
564
519
565
520
# Create a list of packages to be finally installed as packages.list directly under the working directory.
566
521
echo -e " # The list of packages that is installed in live cd.\n#\n" > " ${build_dir} /packages.list"
@@ -704,9 +659,10 @@ make_setup_mkinitcpio() {
704
659
cp " ${script_path} /system/initcpio/install/${_hook} " " ${airootfs_dir} /etc/initcpio/install"
705
660
done
706
661
662
+ sed -i " s|%COWSPACE%|${cowspace} |g" " ${airootfs_dir} /etc/initcpio/hooks/archiso"
707
663
sed -i " s|/usr/lib/initcpio/|/etc/initcpio/|g" " ${airootfs_dir} /etc/initcpio/install/archiso_shutdown"
708
664
cp " ${script_path} /system/initcpio/install/archiso_kms" " ${airootfs_dir} /etc/initcpio/install"
709
- cp " ${script_path} /system/initcpio/archiso_shutdown" " ${airootfs_dir} /etc/initcpio"
665
+ cp " ${script_path} /system/initcpio/script/ archiso_shutdown" " ${airootfs_dir} /etc/initcpio"
710
666
cp " ${script_path} /mkinitcpio/mkinitcpio-archiso.conf" " ${airootfs_dir} /etc/mkinitcpio-archiso.conf"
711
667
[[ " ${boot_splash} " = true ]] && cp " ${script_path} /mkinitcpio/mkinitcpio-archiso-plymouth.conf" " ${airootfs_dir} /etc/mkinitcpio-archiso.conf"
712
668
@@ -1005,9 +961,9 @@ make_alteriso_info(){
1005
961
make_overisofs () {
1006
962
local _over_isofs_list _isofs
1007
963
_over_isofs_list=(" ${channel_dir} /over_isofs.any" " ${channel_dir} /over_isofs.${arch} " )
1008
- for_module ' _over_isofs_list+=("${module_dir}/{}/over_isofs.any""${module_dir}/{}/over_isofs.${arch}")'
964
+ for_module ' _over_isofs_list+=("${module_dir}/{}/over_isofs.any" "${module_dir}/{}/over_isofs.${arch}")'
1009
965
for _isofs in " ${_over_isofs_list[@]} " ; do
1010
- [[ -d " ${_isofs} " ]] && cp -af " ${_isofs} " /* " ${isofs_dir} "
966
+ [[ -d " ${_isofs} " ]] && [[ -n " $( find " ${_isofs} " -mindepth 1 -maxdepth 2 ) " ]] && cp -af " ${_isofs} " /* " ${isofs_dir} "
1011
967
done
1012
968
1013
969
return 0
@@ -1048,7 +1004,7 @@ make_iso() {
1048
1004
1049
1005
1050
1006
# Parse options
1051
- ARGUMENT=(" ${DEFAULT_ARGUMENT[@]} " " ${@ } " ) OPTS=(" a:" " b" " c:" " d" " e" " g:" " h" " j" " k:" " l:" " o:" " p:" " r" " t:" " u:" " w:" " x" ) 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:" " add-module:" " nogitversion" )
1007
+ ARGUMENT=(" ${DEFAULT_ARGUMENT[@]} " " ${@ } " ) OPTS=(" a:" " b" " c:" " d" " e" " g:" " h" " j" " k:" " l:" " o:" " p:" " r" " t:" " u:" " w:" " x" ) 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:" " add-module:" " nogitversion" " cowspace: " " rerun " " depend " " loopmod " )
1052
1008
GETOPT=(-o " $( printf " %s," " ${OPTS[@]} " ) " -l " $( printf " %s," " ${OPTL[@]} " ) " -- " ${ARGUMENT[@]} " )
1053
1009
getopt -Q " ${GETOPT[@]} " || exit 1 # 引数エラー判定
1054
1010
readarray -t OPT < <( getopt " ${GETOPT[@]} " ) # 配列に代入
@@ -1141,15 +1097,19 @@ while true; do
1141
1097
--noaur ) noaur=true && shift 1 ;;
1142
1098
--nochkver ) nochkver=true && shift 1 ;;
1143
1099
--noefi ) noefi=true && shift 1 ;;
1144
- --channellist ) show_channel_list && exit 0 ;;
1145
- --config ) source " ${2} " && shift 2 ;;
1100
+ --channellist ) show_channel_list && exit 0 ;;
1101
+ --config ) source " ${2} " ; shift 2 ;;
1146
1102
--pacman-debug ) pacman_debug=true && shift 1 ;;
1147
1103
--nosigcheck ) nosigcheck=true && shift 1 ;;
1148
1104
--normwork ) normwork=true && shift 1 ;;
1149
1105
--log ) logging=true && shift 1 ;;
1150
1106
--nolog ) logging=false && shift 1 ;;
1151
1107
--nopkgbuild ) nopkgbuild=true && shift 1 ;;
1152
1108
--nogitversion ) gitversion=false && shift 1 ;;
1109
+ --cowspace ) cowspace=" ${2} " && shift 2 ;;
1110
+ --rerun ) rerun=true && shift 1 ;;
1111
+ --depend ) nodepend=false && shift 1 ;;
1112
+ --loopmod ) noloopmod=false && shift 1 ;;
1153
1113
-- ) shift 1 && break ;;
1154
1114
* )
1155
1115
msg_error " Argument exception error '${1} '"
@@ -1162,7 +1122,7 @@ done
1162
1122
if (( ! "${EUID} " == 0 )) ; then
1163
1123
msg_warn " This script must be run as root." >&2
1164
1124
msg_warn " Re-run 'sudo ${0} ${ARGUMENT[*]} '"
1165
- sudo " ${0} " " ${ARGUMENT[@]} "
1125
+ sudo " ${0} " " ${ARGUMENT[@]} " --rerun
1166
1126
exit " ${?} "
1167
1127
fi
1168
1128
0 commit comments