@@ -20,6 +20,7 @@ defaultconfig="${script_path}/default.conf"
2020rebuild=false
2121customized_username=false
2222customized_password=false
23+ customized_kernel=false
2324DEFAULT_ARGUMENT=" "
2425alteriso_version=" 3.0"
2526
@@ -340,7 +341,7 @@ prepare_env() {
340341 fi
341342 cd - > /dev/null 2>&1
342343 else
343- mkalteriso=" ${script_path} /system /mkalteriso.sh"
344+ mkalteriso=" ${script_path} /tools /mkalteriso.sh"
344345 fi
345346
346347 # Load loop kernel module
@@ -476,14 +477,9 @@ prepare_rebuild() {
476477 _save_var defaultusername
477478 _save_var customized_username
478479 _save_var customized_password
480+ _save_var customized_kernel
479481
480482 _write_rebuild_file " \n# mkalteriso Info"
481- if [[ " ${shmkalteriso} " = false ]]; then
482- mkalteriso=" ${script_path} /system/mkalteriso"
483- else
484- mkalteriso=" ${script_path} /system/mkalteriso.sh"
485- fi
486-
487483 _save_var mkalteriso
488484 _save_var shmkalteriso
489485 _save_var mkalteriso_option
@@ -512,10 +508,24 @@ prepare_build() {
512508 build_pacman_conf=" ${script_path} /system/pacman-${arch} .conf"
513509 fi
514510
511+ # Set dirs
512+ airootfs_dir=" ${work_dir} /${arch} /airootfs"
513+ share_dir=" ${script_path} /channels/share"
514+ isofs_dir=" ${work_dir} /iso"
515+
515516 # If there is config for channel. load that.
516- load_config " ${script_path} /channels/share /config.any" " ${script_path} /channels/share/config.${arch} "
517+ load_config " ${share_dir} /config.any" " ${script_path} /channels/share/config.${arch} "
517518 load_config " ${channel_dir} /config.any" " ${channel_dir} /config.${arch} "
518519
520+ # Set kernel
521+ if [[ " ${customized_kernel} " = false ]]; then
522+ kernel=" ${defaultkernel} "
523+ fi
524+
525+ # Parse files
526+ eval $( bash " ${script_path} /tools/locale.sh" -s -a " ${arch} " get " ${locale_name} " )
527+ eval $( bash " ${script_path} /tools/kernel.sh" -s -c " ${channel_name} " -a " ${arch} " get " ${kernel} " )
528+
519529 # Set username
520530 if [[ " ${customized_username} " = false ]]; then
521531 username=" ${defaultusername} "
@@ -533,11 +543,6 @@ prepare_build() {
533543 cd - > /dev/null 2>&1
534544 fi
535545
536- # Set dirs
537- airootfs_dir=" ${work_dir} /${arch} /airootfs"
538- share_dir=" ${script_path} /channels/share"
539- isofs_dir=" ${work_dir} /iso"
540-
541546 # Generate iso file name.
542547 local _channel_name
543548 if [[ $( echo " ${channel_name} " | sed ' s/^.*\.\([^\.]*\)$/\1/' ) = " add" ]]; then
@@ -595,8 +600,9 @@ prepare_build() {
595600
596601
597602 # Check kernel for each channel
598- if [[ -f " ${channel_dir} /kernel_list-${arch} " ]] && [[ -z $( cat " ${channel_dir} /kernel_list-${arch} " | grep -h -v ^' #' | grep -x " ${kernel} " 2> /dev/null) ]]; then
599- msg_error " This kernel is currently not supported on this channel." " 1"
603+ # if [[ -f "${channel_dir}/kernel_list-${arch}" ]] && [[ -z $(cat "${channel_dir}/kernel_list-${arch}" | grep -h -v ^'#' | grep -x "${kernel}" 2> /dev/null) ]]; then
604+ if [[ ! " $( bash " ${script_path} /tools/kernel.sh" -c " ${channel_name} " -a " ${arch} " -s check " ${kernel} " ) " = " correct" ]]; then
605+ msg_error " This kernel is currently not supported on this channel or architecture" " 1"
600606 fi
601607
602608 # Unmount
@@ -1248,12 +1254,6 @@ make_iso() {
12481254 msg_info " The password for the live user and root is ${password} ."
12491255}
12501256
1251- # Parse files
1252- parse_files () {
1253- eval $( bash " ${script_path} /tools/locale.sh" -a " ${arch} " get " ${kernel} " )
1254- eval $( bash " ${script_path} /tools/kernel.sh" -a " ${arch} " get " ${kernel} " )
1255- }
1256-
12571257
12581258# Parse options
12591259ARGUMENT=" ${@ } "
@@ -1303,6 +1303,7 @@ while :; do
13031303 msg_error " This option is obsolete in AlterISO 3. To use Japanese, use \" -l ja\" ." " 1"
13041304 ;;
13051305 -k | --kernel)
1306+ customized_kernel=true
13061307 kernel=" ${2} "
13071308 shift 2
13081309 ;;
@@ -1430,6 +1431,9 @@ msg_debug "Use the default configuration file (${defaultconfig})."
14301431# Set rebuild config file
14311432rebuildfile=" ${work_dir} /alteriso_config"
14321433
1434+ # Debug mode
1435+ if [[ " ${bash_debug} " = true ]]; then set -x -v; fi
1436+
14331437set +eu
14341438
14351439# Check for a valid channel name
@@ -1479,8 +1483,6 @@ if [[ ! "${channel_name}" = "rebuild" ]]; then
14791483 fi
14801484fi
14811485
1482- parse_files
1483-
14841486set -eu
14851487
14861488prepare_env
0 commit comments