diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-20 00:47:41 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-20 00:47:41 -0500 |
commit | a6ce111ab2fd71e0c13f5e165addeb18a4125f1e (patch) | |
tree | 08f04ce0748d6719189fe3db40a3b9b0277f306a /src | |
parent | 63362d52d3943f40fb96898a2b4e87e17f0adcf4 (diff) |
librefetch: improve error handling
Diffstat (limited to 'src')
-rwxr-xr-x | src/librefetch/librefetch | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index c723721..87a55cd 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -18,12 +18,12 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see <http://www.gnu.org/licenses/>. -. $(librelib conf.sh) -. libremessages +. $(librelib conf) +. $(librelib messages) +setup_traps declare -r tempdir="$(mktemp -d --tmpdir ${0##*/}.XXXXXXXXXXX)" -cleanup() { rm -rf -- "$tempdir"; } -trap cleanup EXIT +trap "rm -rf -- $(printf '%q' "$tempdir")" EXIT cmd=${0##*/} usage() { @@ -91,10 +91,15 @@ main() { local BUILDFILEDIR="${BUILDFILE%/*}" if [[ -f "${BUILDFILEDIR}/SRCBUILD" ]]; then BUILDFILE="${BUILDFILEDIR}/SRCBUILD" - srcbuild="$(modified_srcbuild "$BUILDFILE")" - else - srcbuild="$(modified_pkgbuild "$BUILDFILE")" fi + if [[ ! -f "$BUILDFILE" ]]; then + error "%s does not exist." "$BUILDFILE" + exit 1 + fi + case "$BUILDFILE" in + */SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")";; + *) srcbuild="$(modified_pkgbuild "$BUILDFILE")";; + esac makepkg="$(modified_makepkg "$(which makepkg)")" # Mode: checksums ###################################################### |