mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-15 19:06:17 +00:00
add spinner to builds
This commit is contained in:
12
lib/build.sh
12
lib/build.sh
@@ -375,7 +375,7 @@ do_build() {
|
|||||||
do_build "${dep}" || return 1
|
do_build "${dep}" || return 1
|
||||||
done
|
done
|
||||||
get_build_conf "${build}" || return 1
|
get_build_conf "${build}" || return 1
|
||||||
echo_info "building ${build}"
|
echo_info -n "building ${build} "
|
||||||
pushd "$extracted_dir" >/dev/null || return 1
|
pushd "$extracted_dir" >/dev/null || return 1
|
||||||
# check for any patches
|
# check for any patches
|
||||||
for patch in "${PATCHES_DIR}/${build}"/*.patch; do
|
for patch in "${PATCHES_DIR}/${build}"/*.patch; do
|
||||||
@@ -383,9 +383,15 @@ do_build() {
|
|||||||
echo_if_fail patch -p1 -i "${patch}" || return 1
|
echo_if_fail patch -p1 -i "${patch}" || return 1
|
||||||
done
|
done
|
||||||
export LOGNAME="${build}"
|
export LOGNAME="${build}"
|
||||||
local timeBefore=$EPOCHSECONDS
|
local timeBefore=${EPOCHSECONDS}
|
||||||
echo_if_fail build_"${build}"
|
echo_if_fail build_"${build}" &
|
||||||
|
local buildPid=$!
|
||||||
|
spinner &
|
||||||
|
local spinPid=$!
|
||||||
|
wait ${buildPid}
|
||||||
retval=$?
|
retval=$?
|
||||||
|
kill ${spinPid}
|
||||||
|
spinner reset
|
||||||
popd >/dev/null || return 1
|
popd >/dev/null || return 1
|
||||||
test ${retval} -eq 0 || return ${retval}
|
test ${retval} -eq 0 || return ${retval}
|
||||||
echo_pass "built ${build} in $((EPOCHSECONDS - timeBefore)) seconds"
|
echo_pass "built ${build} in $((EPOCHSECONDS - timeBefore)) seconds"
|
||||||
|
|||||||
@@ -142,16 +142,23 @@ docker_build_image() {
|
|||||||
echo "RUN ${pkg_mgr_upgrade}"
|
echo "RUN ${pkg_mgr_upgrade}"
|
||||||
printf "RUN ${pkg_install} %s\n" "${req_pkgs[@]}"
|
printf "RUN ${pkg_install} %s\n" "${req_pkgs[@]}"
|
||||||
fi
|
fi
|
||||||
|
# pipx
|
||||||
echo 'RUN pipx install virtualenv'
|
echo 'RUN pipx install virtualenv'
|
||||||
echo 'RUN pipx ensurepath'
|
echo 'RUN pipx ensurepath'
|
||||||
|
# rust
|
||||||
echo 'ENV CARGO_HOME="/root/.cargo"'
|
echo 'ENV CARGO_HOME="/root/.cargo"'
|
||||||
echo 'ENV RUSTUP_HOME="/root/.rustup"'
|
echo 'ENV RUSTUP_HOME="/root/.rustup"'
|
||||||
echo 'ENV PATH="/root/.cargo/bin:$PATH"'
|
echo 'ENV PATH="/root/.cargo/bin:$PATH"'
|
||||||
local rustupVersion='1.28.2'
|
local rustupVersion='1.28.2'
|
||||||
local rustcVersion='1.88.0'
|
local rustcVersion='1.88.0'
|
||||||
|
local rustupTarball="${DOCKER_DIR}/rustup.tar.gz"
|
||||||
|
if [[ ! -f ${rustupTarball} ]]; then
|
||||||
|
wget https://github.com/rust-lang/rustup/archive/refs/tags/${rustupVersion}.tar.gz -O "${rustupTarball}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "ADD ./rustup.tar.gz /tmp/"
|
||||||
local cargoInst=''
|
local cargoInst=''
|
||||||
cargoInst+="cd tmp && wget https://github.com/rust-lang/rustup/archive/refs/tags/${rustupVersion}.tar.gz -O rustup.tar.gz"
|
cargoInst+="cd /tmp/rustup-${rustupVersion}"
|
||||||
cargoInst+=" && tar -xf rustup.tar.gz && cd rustup-${rustupVersion}"
|
|
||||||
cargoInst+=" && bash rustup-init.sh -y --default-toolchain=${rustcVersion}"
|
cargoInst+=" && bash rustup-init.sh -y --default-toolchain=${rustcVersion}"
|
||||||
cargoInst+=" && rm -rf /tmp/*"
|
cargoInst+=" && rm -rf /tmp/*"
|
||||||
echo "RUN ${cargoInst}"
|
echo "RUN ${cargoInst}"
|
||||||
@@ -169,7 +176,7 @@ docker_build_image() {
|
|||||||
--platform "${PLATFORM}" \
|
--platform "${PLATFORM}" \
|
||||||
-t "${image_tag}" \
|
-t "${image_tag}" \
|
||||||
-f "${dockerfile}" \
|
-f "${dockerfile}" \
|
||||||
. || return 1
|
"${DOCKER_DIR}" || return 1
|
||||||
|
|
||||||
# if a docker registry is defined, push to it
|
# if a docker registry is defined, push to it
|
||||||
if [[ ${DOCKER_REGISTRY} != '' ]]; then
|
if [[ ${DOCKER_REGISTRY} != '' ]]; then
|
||||||
|
|||||||
36
lib/utils.sh
36
lib/utils.sh
@@ -10,10 +10,18 @@ YELLOW='\e[0;33m'
|
|||||||
NC='\e[0m'
|
NC='\e[0m'
|
||||||
|
|
||||||
# echo wrappers
|
# echo wrappers
|
||||||
echo_fail() { echo -e "${RED}FAIL${NC}:" "$@"; }
|
echo_wrapper() {
|
||||||
echo_info() { echo -e "${CYAN}INFO${NC}:" "$@"; }
|
local args
|
||||||
echo_pass() { echo -e "${GREEN}PASS${NC}:" "$@"; }
|
if [[ $1 == '-n' ]]; then
|
||||||
echo_warn() { echo -e "${YELLOW}WARN${NC}:" "$@"; }
|
args=("$1")
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
echo -e "${args[@]}" "${color}${word}${NC}" "$@"
|
||||||
|
}
|
||||||
|
echo_fail() { color="${RED}" word="FAIL" echo_wrapper "$@"; }
|
||||||
|
echo_info() { color="${CYAN}" word="INFO" echo_wrapper "$@"; }
|
||||||
|
echo_pass() { color="${GREEN}" word="PASS" echo_wrapper "$@"; }
|
||||||
|
echo_warn() { color="${YELLOW}" word="WARN" echo_wrapper "$@"; }
|
||||||
echo_exit() {
|
echo_exit() {
|
||||||
echo_fail "$@"
|
echo_fail "$@"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -269,3 +277,23 @@ bash_sort() {
|
|||||||
|
|
||||||
printf '%s\n' "${arr[@]}"
|
printf '%s\n' "${arr[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spinner() {
|
||||||
|
if [[ $1 == 'reset' ]]; then
|
||||||
|
echo -ne ' \n'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local spinChars=(
|
||||||
|
"-"
|
||||||
|
'\'
|
||||||
|
"|"
|
||||||
|
"/"
|
||||||
|
)
|
||||||
|
while true; do
|
||||||
|
for ((ind = 0; ind < "${#spinChars[@]}"; ind++)); do
|
||||||
|
echo -ne "${spinChars[${ind}]}" '\b\b'
|
||||||
|
sleep .25
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user