From d99fced0e8122f88c4e8410923d36874a6b63658 Mon Sep 17 00:00:00 2001 From: ophub Date: Sun, 9 Apr 2023 11:46:09 +0000 Subject: [PATCH] Adjust code logic --- action.yml | 20 ++++++++++---------- make | 32 ++++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/action.yml b/action.yml index eae5f56da3..9ca454f066 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,14 @@ inputs: description: "Select device board." required: false default: "all" + kernel_repo: + description: "Select kernel repository." + required: false + default: "ophub/kernel" + kernel_usage: + description: "Set the tags of the stable kernel." + required: false + default: "stable" openwrt_kernel: description: "Select kernel version." required: false @@ -22,14 +30,6 @@ inputs: description: "Auto use the latest kernel." required: false default: "true" - kernel_repo: - description: "Select kernel repository." - required: false - default: "https://github.com/ophub/kernel" - kernel_usage: - description: "Set the tags of the stable kernel." - required: false - default: "stable" openwrt_size: description: "Set the rootfs size(Unit: MiB)." required: false @@ -76,10 +76,10 @@ runs: echo -e "Start to make openwrt..." make_command="" [[ -n "${{ inputs.openwrt_board }}" ]] && make_command="${make_command} -b ${{ inputs.openwrt_board }}" - [[ -n "${{ inputs.openwrt_kernel }}" ]] && make_command="${make_command} -k ${{ inputs.openwrt_kernel }}" - [[ -n "${{ inputs.auto_kernel }}" ]] && make_command="${make_command} -a ${{ inputs.auto_kernel }}" [[ -n "${{ inputs.kernel_repo }}" ]] && make_command="${make_command} -r ${{ inputs.kernel_repo }}" [[ -n "${{ inputs.kernel_usage }}" ]] && make_command="${make_command} -u ${{ inputs.kernel_usage }}" + [[ -n "${{ inputs.openwrt_kernel }}" ]] && make_command="${make_command} -k ${{ inputs.openwrt_kernel }}" + [[ -n "${{ inputs.auto_kernel }}" ]] && make_command="${make_command} -a ${{ inputs.auto_kernel }}" [[ -n "${{ inputs.openwrt_size }}" ]] && make_command="${make_command} -s ${{ inputs.openwrt_size }}" [[ -n "${{ inputs.gh_token }}" ]] && make_command="${make_command} -g ${{ inputs.gh_token }}" sudo ./make ${make_command} diff --git a/make b/make index bc418c3015..4398dab960 100755 --- a/make +++ b/make @@ -131,7 +131,7 @@ init_var() { echo -e "${STEPS} Start Initializing Variables..." # If it is followed by [ : ], it means that the option requires a parameter value - get_all_ver="$(getopt "b:k:a:r:u:s:g:" "${@}")" + get_all_ver="$(getopt "b:r:u:k:a:s:g:" "${@}")" while [[ -n "${1}" ]]; do case "${1}" in @@ -143,39 +143,39 @@ init_var() { error_msg "Invalid -b parameter [ ${2} ]!" fi ;; - -k | --Kernel) + -r | --kernelRepository) if [[ -n "${2}" ]]; then - oldIFS=$IFS - IFS=_ - stable_kernel=(${2}) - IFS=$oldIFS + kernel_repo="${2}" shift else - error_msg "Invalid -k parameter [ ${2} ]!" + error_msg "Invalid -r parameter [ ${2} ]!" fi ;; - -a | --Autokernel) + -u | --kernelUsage) if [[ -n "${2}" ]]; then - auto_kernel="${2}" + kernel_usage="${2//kernel_/}" shift else - error_msg "Invalid -a parameter [ ${2} ]!" + error_msg "Invalid -u parameter [ ${2} ]!" fi ;; - -r | --kernelRepository) + -k | --Kernel) if [[ -n "${2}" ]]; then - kernel_repo="${2}" + oldIFS=$IFS + IFS=_ + stable_kernel=(${2}) + IFS=$oldIFS shift else - error_msg "Invalid -r parameter [ ${2} ]!" + error_msg "Invalid -k parameter [ ${2} ]!" fi ;; - -u | --kernelUsage) + -a | --Autokernel) if [[ -n "${2}" ]]; then - kernel_usage="${2//kernel_/}" + auto_kernel="${2}" shift else - error_msg "Invalid -u parameter [ ${2} ]!" + error_msg "Invalid -a parameter [ ${2} ]!" fi ;; -s | --Size)