Skip to content

Commit 655aad8

Browse files
committed
[update] : Supported changing default kernel
1 parent aba8033 commit 655aad8

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

build.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ defaultconfig="${script_path}/default.conf"
2020
rebuild=false
2121
customized_username=false
2222
customized_password=false
23+
customized_kernel=false
2324
DEFAULT_ARGUMENT=""
2425
alteriso_version="3.0"
2526

@@ -476,6 +477,7 @@ 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"
481483
_save_var mkalteriso
@@ -510,6 +512,15 @@ prepare_build() {
510512
load_config "${script_path}/channels/share/config.any" "${script_path}/channels/share/config.${arch}"
511513
load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
512514

515+
# Set kernel
516+
if [[ "${customized_kernel}" = false ]]; then
517+
kernel="${defaultkernel}"
518+
fi
519+
520+
# Parse files
521+
eval $(bash "${script_path}/tools/locale.sh" -s -a "${arch}" get "${locale_name}")
522+
eval $(bash "${script_path}/tools/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
523+
513524
# Set username
514525
if [[ "${customized_username}" = false ]]; then
515526
username="${defaultusername}"
@@ -590,7 +601,7 @@ prepare_build() {
590601

591602
# Check kernel for each channel
592603
#if [[ -f "${channel_dir}/kernel_list-${arch}" ]] && [[ -z $(cat "${channel_dir}/kernel_list-${arch}" | grep -h -v ^'#' | grep -x "${kernel}" 2> /dev/null) ]]; then
593-
if [[ ! "$(bash "${script_path}/tools/kernel.sh" -c "${channel_name}" -a "${arch}" -s check "${channel_name}")" = "correct" ]]; then
604+
if [[ ! "$(bash "${script_path}/tools/kernel.sh" -c "${channel_name}" -a "${arch}" -s check "${kernel}")" = "correct" ]]; then
594605
msg_error "This kernel is currently not supported on this channel or architecture" "1"
595606
fi
596607

@@ -1243,12 +1254,6 @@ make_iso() {
12431254
msg_info "The password for the live user and root is ${password}."
12441255
}
12451256

1246-
# Parse files
1247-
parse_files() {
1248-
eval $(bash "${script_path}/tools/locale.sh" -s -a "${arch}" get "${locale_name}")
1249-
eval $(bash "${script_path}/tools/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
1250-
}
1251-
12521257

12531258
# Parse options
12541259
ARGUMENT="${@}"
@@ -1298,6 +1303,7 @@ while :; do
12981303
msg_error "This option is obsolete in AlterISO 3. To use Japanese, use \"-l ja\"." "1"
12991304
;;
13001305
-k | --kernel)
1306+
customized_kernel=true
13011307
kernel="${2}"
13021308
shift 2
13031309
;;
@@ -1477,8 +1483,6 @@ if [[ ! "${channel_name}" = "rebuild" ]]; then
14771483
fi
14781484
fi
14791485

1480-
parse_files
1481-
14821486
set -eu
14831487

14841488
prepare_env

channels/releng/config.any

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,14 @@ usershell="/bin/zsh"
5151
# This setting cannot be changed by an argument.
5252
noaur=true
5353

54-
# kernel config
55-
_kernel_config_line=("core" "vmlinuz-linux" "linux")
56-
kernel="${_kernel_config_line[0]}"
57-
kernel_filename="${_kernel_config_line[1]}"
58-
kernel_mkinitcpio_profile="${_kernel_config_line[2]}"
54+
#-- kernel config --#
55+
# Set the kernel that live session use.
56+
# Please don't set anything if you want to use normal kernel.
57+
# See help for a list of available values.
58+
# This setting cannot be changed by an argument.
59+
60+
# Kernel name
61+
defaultkernel="core"
5962

6063
# Use mkalteriso written in a traditional shell script
6164
# instead of the C ++ version of mkalteriso.

default.conf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,10 @@ norescue_entry=false
124124
# Set the kernel that live session use.
125125
# Please don't set anything if you want to use normal kernel.
126126
# See help for a list of available values.
127-
# Change the default behavior of "-k" and "--kernel".
127+
# This setting cannot be changed by an argument.
128128

129129
# Kernel name
130-
kernel="zen"
131-
132-
# Kernel file name
133-
kernel_filename="vmlinuz-linux-zen"
134-
135-
# mkinitcpio profile name (mkinitcpio -p <name>)
136-
kernel_mkinitcpio_profile="linux-zen"
137-
130+
defaultkernel="zen"
138131

139132
#-- Live environment user --#
140133

0 commit comments

Comments
 (0)