diff options
author | davidovski <david@davidovski.xyz> | 2022-03-20 10:46:08 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-03-20 10:46:08 +0000 |
commit | 4103bae6d29b50d2dabb7af7be7676b705944da2 (patch) | |
tree | 863cc298e969bb8259ee3a403f7a9b2ef5d2dec1 /src/get.sh | |
parent | eac3c122678d19e090742d01e348d800d358733a (diff) |
added file validation
Diffstat (limited to 'src/get.sh')
-rwxr-xr-x | src/get.sh | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -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 |