Skip to content

Commit

Permalink
Adjust code logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Apr 9, 2023
1 parent e61fb0b commit d99fced
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
20 changes: 10 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}
Expand Down
32 changes: 16 additions & 16 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit d99fced

Please sign in to comment.