Skip to content

Commit

Permalink
Optimized lookup version information
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Feb 10, 2022
1 parent 47d6db8 commit 2d3869d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rebuild
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ find_rebuild() {
# Get armbian release and version
armbian_rebuild_name=$(ls ${armbian_rebuild_file} 2>/dev/null | head -n 1 | awk -F "/" '{print $NF}')
[[ -n "${armbian_rebuild_name}" ]] || error_msg "The armbian original file does not exist: [ ${armbian_rebuild_file} ]"
# Find armbian version info: such as [ 22.02.0 ]
armbian_rebuild_version="$(echo ${armbian_rebuild_name} | grep -oE '2[0-9].[0-9]{1,2}[.]*[0-9]{1,2}' | head -n 1)"
armbian_rebuild_kernel="$(echo ${armbian_rebuild_name} | grep -oE '[4-5].[0-9]{1,2}.[0-9]{1,3}' | head -n 1)"
[[ -n "${armbian_rebuild_version}" && -n "${armbian_rebuild_kernel}" ]] || error_msg "Armbian Rebuild file analysis error."
[[ -z "${armbian_rebuild_version}" ]] && armbian_rebuild_version="22.02.02" && echo -e "Missing armbian version info!"
}

download_kernel() {
Expand Down Expand Up @@ -191,7 +191,7 @@ replace_kernel() {
build_header=$(ls ${kernel_path}/${kernel}/header-${kernel}-*.tar.gz 2>/dev/null | head -n 1)

# 01 For /boot five files
(cd ${tmp_armbian}/boot && rm -rf *-${armbian_rebuild_kernel}-* uInitrd zImage dtb* 2>/dev/null && sync)
(cd ${tmp_armbian}/boot && rm -rf * 2>/dev/null && sync)
tar -xzf ${build_boot} -C ${tmp_armbian}/boot && sync
[ "$(ls ${tmp_armbian}/boot/*-${kernel}-* -l 2>/dev/null | grep "^-" | wc -l)" -ge "4" ] || error_msg "boot/ 5 files is missing."

Expand Down

0 comments on commit 2d3869d

Please sign in to comment.