diff options
author | Francis Rowe <info@gluglug.org.uk> | 2015-08-29 22:02:55 +0100 |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-08-29 22:02:55 +0100 |
commit | 6763e8d21f048c064ef33fe99656b6e8a3043867 (patch) | |
tree | baa554c2f6aec48de8b8f56a79a3b483756d54ee | |
parent | 67c8330aad941b769e6a2887f02a865eb01a858a (diff) | |
download | librebootfr-6763e8d21f048c064ef33fe99656b6e8a3043867.tar.gz librebootfr-6763e8d21f048c064ef33fe99656b6e8a3043867.zip |
download script: add --noconfirm and -y option for downloading
-rwxr-xr-x | download | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -25,12 +25,19 @@ set -u -e download=./resources/scripts/helpers/download programmes=$(ls ${download}/) +noconfirm="0" if [ $# -lt 1 ]; then printf "ERROR: download script: no argmunt given.\n" exit 1 fi + +if [ "${1}" = "--noconfirm" ] || [ "${1}" = "-y" ]; then + noconfirm="1" + shift 1 +fi + case ${@} in all) ;; @@ -58,14 +65,16 @@ esac for programme in ${programmes}; do - if [ -d "${programme}/" ]; then - printf "A ${programme}/ directory already exists, delete it? [yN]: " - read answer - if [ "${answer}" = "y" ]; then - rm -Rf "${programme}/" && printf "Old ${programme} directory deleted.\n\n" - else - printf "${programme} directory not deleted, and therefore not replaced.\n" - continue + if [ "${noconfirm}" = "0" ]; then + if [ -d "${programme}/" ]; then + printf "A ${programme}/ directory already exists, delete it? [yN]: " + read answer + if [ "${answer}" = "y" ]; then + rm -Rf "${programme}/" && printf "Old ${programme} directory deleted.\n\n" + else + printf "${programme} directory not deleted, and therefore not replaced.\n" + continue + fi fi fi |