More commands to execute()
This commit is contained in:
@@ -362,14 +362,13 @@ getImageBuilder() {
|
|||||||
|
|
||||||
if [[ -f "$IB_ARCHIVE" ]]; then
|
if [[ -f "$IB_ARCHIVE" ]]; then
|
||||||
if askOk "$IB_ARCHIVE exists. Re-download?"; then
|
if askOk "$IB_ARCHIVE exists. Re-download?"; then
|
||||||
rm -f "$IB_ARCHIVE"
|
execute rm -f "$IB_ARCHIVE"
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading Image Builder archive using $DL_TOOL"
|
echo "Downloading Image Builder archive using $DL_TOOL"
|
||||||
debug "$DL_TOOL -o $IB_ARCHIVE $url"
|
|
||||||
execute "$DL_TOOL" "-o" "$IB_ARCHIVE" "$url"
|
execute "$DL_TOOL" "-o" "$IB_ARCHIVE" "$url"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +378,7 @@ getImageBuilderChecksum() {
|
|||||||
|
|
||||||
if [[ -f $IB_SHA256_FILE ]]; then
|
if [[ -f $IB_SHA256_FILE ]]; then
|
||||||
if askOk "$IB_SHA256_FILE exists. Re-download?"; then
|
if askOk "$IB_SHA256_FILE exists. Re-download?"; then
|
||||||
rm -f "$IB_SHA256_FILE"
|
execute rm -f "$IB_SHA256_FILE"
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -488,16 +487,13 @@ flashImage() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "gunzip -qfk $img_gz"
|
execute gunzip -qfk "$img_gz"
|
||||||
gunzip -qfk "$img_gz"
|
|
||||||
|
|
||||||
echo "Unmounting target device $dev partitions"
|
echo "Unmounting target device $dev partitions"
|
||||||
partitions=( "$dev"?* )
|
partitions=( "$dev"?* )
|
||||||
debug "umount ${partitions[*]}"
|
execute sudo umount "${partitions[@]}"
|
||||||
sudo umount "${partitions[@]}"
|
|
||||||
|
|
||||||
debug "sudo dd if=$img of=$dev bs=2M conv=fsync"
|
if execute sudo dd if="$img" of="$dev" bs=2M conv=fsync; then
|
||||||
if sudo dd if="$img" of="$dev" bs=2M conv=fsync; then
|
|
||||||
sync
|
sync
|
||||||
echo "Image flashed sucessfully!"
|
echo "Image flashed sucessfully!"
|
||||||
else
|
else
|
||||||
@@ -568,17 +564,17 @@ fromSource() {
|
|||||||
local branch="openwrt-${RELEASE%.*}"
|
local branch="openwrt-${RELEASE%.*}"
|
||||||
local tag="v$RELEASE"
|
local tag="v$RELEASE"
|
||||||
local r
|
local r
|
||||||
read -r -p "Use HEAD of $branch branch (y, recommended) or $tag tag (n)?" r
|
read -r -p "Use HEAD of $branch branch (y, recommended) or $tag tag (n)? (Y/n)" r
|
||||||
r=${r,,}
|
r=${r,,}
|
||||||
if [[ "$r" =~ ^(yes|y)$ ]]; then
|
if [[ "$r" =~ ^(no|n)$ ]]; then
|
||||||
execute "${wt_cmd[@]}" "origin/$branch"
|
|
||||||
else
|
|
||||||
execute "${wt_cmd[@]}" "$tag"
|
execute "${wt_cmd[@]}" "$tag"
|
||||||
|
else
|
||||||
|
execute "${wt_cmd[@]}" "origin/$branch"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
debug "Passing '$RELEASE' commit-ish to git worktree"
|
debug "Passing '$RELEASE' commit-ish to git worktree"
|
||||||
execute "${wt_cmd[@]}" "origin/$RELEASE"
|
execute "${wt_cmd[@]}" "$RELEASE"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -654,14 +650,10 @@ fromSource() {
|
|||||||
|
|
||||||
# Make image
|
# Make image
|
||||||
(( DEBUG )) && make_opts+=("V=s")
|
(( DEBUG )) && make_opts+=("V=s")
|
||||||
debug "make ${make_opts[*]} defconfig"
|
execute make "${make_opts[@]}" defconfig
|
||||||
make "${make_opts[@]}" defconfig
|
execute make "${make_opts[@]}" targetclean
|
||||||
debug "make ${make_opts[*]} targetclean"
|
execute make "${make_opts[@]}" download
|
||||||
make "${make_opts[@]}" targetclean
|
execute make "${make_opts[@]}" "-j$(nproc)" world
|
||||||
debug "make ${make_opts[*]} download"
|
|
||||||
make "${make_opts[@]}" download
|
|
||||||
debug "make ${make_opts[*]} -j$(nproc) world"
|
|
||||||
make "${make_opts[@]}" -j"$(nproc)" world
|
|
||||||
|
|
||||||
popd || return 1
|
popd || return 1
|
||||||
|
|
||||||
@@ -687,8 +679,7 @@ extract() {
|
|||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
declare archive="$1"
|
declare archive="$1"
|
||||||
declare out_dir="$2"
|
declare out_dir="$2"
|
||||||
debug "tar -xf $archive -C $out_dir --strip-components 1"
|
if ! execute tar -xf "$archive" -C "$out_dir" --strip-components 1; then
|
||||||
if ! tar -xf "$archive" -C "$out_dir" --strip-components 1; then
|
|
||||||
echo "Extraction failed"
|
echo "Extraction failed"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user