mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 17:41:05 +02:00
cleanup(common): Remove rarely used pv_cat_cmd
Its single use is in build_common and even then having a little progress bar for copying images isn't that interesting, they just get lost in the noise of the emerge output. Keep it simple, use cp.
This commit is contained in:
parent
6b603ae9ef
commit
1ea1e8ba9b
@ -42,7 +42,7 @@ copy_image() {
|
|||||||
local dst="${BUILD_DIR}/$2"
|
local dst="${BUILD_DIR}/$2"
|
||||||
if should_build_image $1; then
|
if should_build_image $1; then
|
||||||
echo "Creating $2 from $1..."
|
echo "Creating $2 from $1..."
|
||||||
$(pv_cat_cmd) "${src}" >"${dst}" || die "Cannot copy $1 to $2"
|
cp "${src}" "${dst}" || die "Cannot copy $1 to $2"
|
||||||
else
|
else
|
||||||
mv "${src}" "${dst}" || die "Cannot move $1 to $2"
|
mv "${src}" "${dst}" || die "Cannot move $1 to $2"
|
||||||
fi
|
fi
|
||||||
|
17
common.sh
17
common.sh
@ -14,23 +14,6 @@ fi
|
|||||||
# Ensure that any sub scripts we invoke get the max proc count.
|
# Ensure that any sub scripts we invoke get the max proc count.
|
||||||
export NUM_JOBS
|
export NUM_JOBS
|
||||||
|
|
||||||
# Returns the pv command if it's available, otherwise plain-old cat. Note that
|
|
||||||
# this function echoes the command, rather than running it, so it can be used
|
|
||||||
# as an argument to other commands (like sudo).
|
|
||||||
pv_cat_cmd() {
|
|
||||||
if type -P pv >&/dev/null; then
|
|
||||||
# Limit pv's output to 80 columns, for readability.
|
|
||||||
local term_cols=$(stty size 2>/dev/null | cut -d' ' -f2)
|
|
||||||
if [[ ${term_cols:-0} -gt 80 ]]; then
|
|
||||||
echo pv -w 80
|
|
||||||
else
|
|
||||||
echo pv
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo cat
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make sure we have the location and name of the calling script, using
|
# Make sure we have the location and name of the calling script, using
|
||||||
# the current value if it is already set.
|
# the current value if it is already set.
|
||||||
: ${SCRIPT_LOCATION:=$(dirname "$(readlink -f "$0")")}
|
: ${SCRIPT_LOCATION:=$(dirname "$(readlink -f "$0")")}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user