diff options
-rwxr-xr-x | build-initramfs.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/build-initramfs.sh b/build-initramfs.sh index 4966d0d4..303e3186 100755 --- a/build-initramfs.sh +++ b/build-initramfs.sh @@ -131,6 +131,7 @@ bootstrap() { echo " Commit: ${_ref[commit]}" echo " Path: ${_ref[path]}" + # handlers deal with errors on their own handler_${_ref[handler]} \ "${_ref[path]}" \ "${_ref[url]}" \ @@ -141,13 +142,19 @@ bootstrap() { shopt -s nullglob pushd "${_ref[path]}" for patch in "${_repo_dir}/patches/${_ref[path]##*/}/"*.patch; do - patch -p1 < "$patch" + if ! patch -p1 < "$patch"; then + echo "Applying '$patch' failed, expecting errors. Continuing..." + fi done popd done } handler_git() { + if ! hash git 2>/dev/null; then + echo "'git' binary not found, please install it and try again." + exit 1 + fi local path="$1" local url="$2" local branch="$3" @@ -190,11 +197,16 @@ handler_git() { } handler_http() { + if ! hash curl tar 2>/dev/null; then + echo "'curl'/'tar' binaries not found, please install them and try again." + exit 1 + fi local path="$1" local url="$2" mkdir --parents "$path" + set -o pipefail curl \ --location \ --max-redirs 5 \ @@ -208,6 +220,10 @@ handler_http() { --gzip \ --directory "$path" \ --strip-components 1 + if [ $? -ne 0 ]; then + echo "Failed to download/extract '$url' to '$path'." + exit 1 + fi } |