OSDN Git Service

[update] : Supported changing default kernel
authorhayao <shun819.mail@gmail.com>
Fri, 30 Oct 2020 12:24:22 +0000 (21:24 +0900)
committerhayao <shun819.mail@gmail.com>
Fri, 30 Oct 2020 12:24:22 +0000 (21:24 +0900)
build.sh
channels/releng/config.any
default.conf

index d27b0bd..92ba041 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -20,6 +20,7 @@ defaultconfig="${script_path}/default.conf"
 rebuild=false
 customized_username=false
 customized_password=false
+customized_kernel=false
 DEFAULT_ARGUMENT=""
 alteriso_version="3.0"
 
@@ -476,6 +477,7 @@ prepare_rebuild() {
     _save_var defaultusername
     _save_var customized_username
     _save_var customized_password
+    _save_var customized_kernel
 
     _write_rebuild_file "\n# mkalteriso Info"
     _save_var mkalteriso
@@ -510,6 +512,15 @@ prepare_build() {
         load_config "${script_path}/channels/share/config.any" "${script_path}/channels/share/config.${arch}"
         load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
 
+       # Set kernel
+        if [[ "${customized_kernel}" = false ]]; then
+            kernel="${defaultkernel}"
+        fi
+
+        # Parse files
+        eval $(bash "${script_path}/tools/locale.sh" -s -a "${arch}" get "${locale_name}")
+        eval $(bash "${script_path}/tools/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
+
         # Set username
         if [[ "${customized_username}" = false ]]; then
             username="${defaultusername}"
@@ -590,7 +601,7 @@ prepare_build() {
 
     # Check kernel for each channel
     #if [[ -f "${channel_dir}/kernel_list-${arch}" ]] && [[ -z $(cat "${channel_dir}/kernel_list-${arch}" | grep -h -v ^'#' | grep -x "${kernel}" 2> /dev/null) ]]; then
-    if [[ ! "$(bash "${script_path}/tools/kernel.sh" -c "${channel_name}" -a "${arch}" -s check "${channel_name}")" = "correct" ]]; then
+    if [[ ! "$(bash "${script_path}/tools/kernel.sh" -c "${channel_name}" -a "${arch}" -s check "${kernel}")" = "correct" ]]; then
         msg_error "This kernel is currently not supported on this channel or architecture" "1"
     fi
 
@@ -1243,12 +1254,6 @@ make_iso() {
     msg_info "The password for the live user and root is ${password}."
 }
 
-# Parse files
-parse_files() {
-    eval $(bash "${script_path}/tools/locale.sh" -s -a "${arch}" get "${locale_name}")
-    eval $(bash "${script_path}/tools/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
-}
-
 
 # Parse options
 ARGUMENT="${@}"
@@ -1298,6 +1303,7 @@ while :; do
             msg_error "This option is obsolete in AlterISO 3. To use Japanese, use \"-l ja\"." "1"
             ;;
         -k | --kernel)
+            customized_kernel=true
             kernel="${2}"
             shift 2
             ;;
@@ -1477,8 +1483,6 @@ if [[ ! "${channel_name}" = "rebuild" ]]; then
     fi
 fi
 
-parse_files
-
 set -eu
 
 prepare_env
index 0e6b9e9..9359621 100644 (file)
@@ -51,11 +51,14 @@ usershell="/bin/zsh"
 # This setting cannot be changed by an argument.
 noaur=true
 
-# kernel config
-_kernel_config_line=("core" "vmlinuz-linux" "linux")
-kernel="${_kernel_config_line[0]}"
-kernel_filename="${_kernel_config_line[1]}"
-kernel_mkinitcpio_profile="${_kernel_config_line[2]}"
+#-- kernel config --#
+# Set the kernel that live session use.
+# Please don't set anything if you want to use normal kernel.
+# See help for a list of available values.
+# This setting cannot be changed by an argument.
+
+# Kernel name
+defaultkernel="core"
 
 # Use mkalteriso written in a traditional shell script
 # instead of the C ++ version of mkalteriso.
index 7834c4d..a97f80c 100644 (file)
@@ -124,17 +124,10 @@ norescue_entry=false
 # Set the kernel that live session use.
 # Please don't set anything if you want to use normal kernel.
 # See help for a list of available values.
-# Change the default behavior of "-k" and "--kernel".
+# This setting cannot be changed by an argument.
 
 # Kernel name
-kernel="zen"
-
-# Kernel file name
-kernel_filename="vmlinuz-linux-zen"
-
-# mkinitcpio profile name (mkinitcpio -p <name>)
-kernel_mkinitcpio_profile="linux-zen"
-
+defaultkernel="zen"
 
 #-- Live environment user --#