From 4103bae6d29b50d2dabb7af7be7676b705944da2 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 20 Mar 2022 10:46:08 +0000 Subject: added file validation --- src/get.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/get.sh') diff --git a/src/get.sh b/src/get.sh index 6c23767..778dbe6 100755 --- a/src/get.sh +++ b/src/get.sh @@ -165,38 +165,39 @@ get () { total_download=$((total_download+size)) done - # TODO tidy this ${QUIET} || { [ "${missing}" ] && - printf "${LIGHT_RED}The following packages could not be located:${RED} %s\n${RESET}" $missing + printf "${LIGHT_RED}The following packages could not be located:${RED} $missing\n${RESET}" [ "${update}" ] && - printf "${LIGHT_GREEN}The following packages will be updated:\n\t${GREEN}%s\n${RESET}" $update + printf "${LIGHT_GREEN}The following packages will be updated:\n\t${GREEN}$update\n${RESET}" [ "${install}" ] && - printf "${LIGHT_BLUE}The following packages will be installed:\n\t${BLUE}%s\n${RESET}" $install + printf "${LIGHT_BLUE}The following packages will be installed:\n\t${BLUE}$install\n${RESET}" [ ! "${install}" ] && [ ! "${update}" ] && [ "${already}" ] && - printf "${LIGHT_WHITE}The following packages are already up to date:\n\t${WHITE}%s\n${RESET}" $already + printf "${LIGHT_WHITE}The following packages are already up to date:\n\t${WHITE}$already\n${RESET}" } - [ ! "${#install}" = "0" ] && [ "${#update}" = 0 ] && printf "${LIGHT_RED}Nothing to do!\n" && return 0 + [ "${#install}" = "0" ] && [ "${#update}" = 0 ] && { + printf "${LIGHT_RED}Nothing to do!\n" + return 0 + } ${QUIET} || { [ "${SYSROOT}" = "/" ] || printf "${WHITE}To install to ${LIGHT_WHITE}${SYSROOT}${RESET}\n" printf "${WHITE}Total download size:${LIGHT_WHITE} $(format_bytes $total_download)\n" } - if prompt_question "${WHITE}Continue?"; then - download_packages $total_download ${install} ${update} - else + prompt_question "${WHITE}Continue?" && + download_packages $total_download ${install} ${update} || { ${QUIET} || printf "${RED}Action canceled by user\n" - fi + } } fetch () { - local packages=$@ \ - outputs="" + local packages=$@ + local outputs="" local total_download=0 for package in $packages; do -- cgit v1.2.1