summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2009-06-09 19:02:47 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2009-06-09 19:02:47 +0000
commit2c3b23124276e4ad878bcb632ba45d0d88f783bb (patch)
tree820d4ee498b973073e585af947f7821aeb9b61dd /bin
parenta30c2bbc0d53a3981227019bdfea777fcf35f881 (diff)
downloadptxdist-2c3b23124276e4ad878bcb632ba45d0d88f783bb.tar.gz
ptxdist-2c3b23124276e4ad878bcb632ba45d0d88f783bb.tar.xz
[ptxdist] simplify error handling in parser and main
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@10668 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ptxdist86
1 files changed, 47 insertions, 39 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index c185f5fff..22332d5bf 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1589,7 +1589,7 @@ parse_second()
#
# use args from first stage parser, prepared for us
#
- set -- "${PTXDIST_ARGS_SECOND[@]}"
+ set -- "${PTXDIST_ARGS_SECOND[@]}"
if [ $# -eq 0 ]; then
usage
@@ -1624,14 +1624,14 @@ parse_second()
local cmd_post=".post"
fi
ptxd_make_log "${STATEDIR}/${1}.${cmd}${cmd_post}"
- exit ${?}
+ exit
;;
######## *config, *setup, toolchain
menuconfig|oldconfig|allmodconfig|allyesconfig|allnoconfig)
do_config "${cmd}" "${@}"
- exit ${?}
+ exit
;;
platformconfig)
@@ -1650,12 +1650,12 @@ parse_second()
kernelconfig)
do_config menuconfig kernel
- exit ${?}
+ exit
;;
u_boot_config)
do_config menuconfig u-boot-v2
- exit ${?}
+ exit
;;
boardsetup)
@@ -1664,18 +1664,18 @@ parse_second()
mkdir -- "${HOME}/.ptxdist"
fi
do_config menuconfig board
- exit ${?}
+ exit
;;
setup)
do_config menuconfig user
- exit ${?}
+ exit
;;
select|ptx)
do_select ptxconfig "${1}"
- exit ${?}
+ exit
;;
platform)
@@ -1694,17 +1694,17 @@ parse_second()
collection)
do_select collectionconfig "${1}"
- exit ${?}
+ exit
;;
toolchain)
do_select_toolchain "${1}"
- exit ${?}
+ exit
;;
migrate)
do_migrate
- exit ${?}
+ exit
;;
######## the rest of it
@@ -1717,7 +1717,7 @@ parse_second()
bash)
check_premake || return
"${@}"
- return
+ exit
;;
clean)
check_config || return
@@ -1793,7 +1793,7 @@ parse_second()
;;
go|images)
do_${cmd}
- exit $?
+ exit
;;
make)
check_premake || return
@@ -1822,7 +1822,7 @@ parse_second()
# exit 1
# fi
newpacket "${1}"
- exit ${?}
+ exit
;;
print)
check_config || return
@@ -2246,28 +2246,36 @@ setup_export() {
# main()
########################################################################
-setup_topdir || ptxd_bailout "fatal error"
-setup_traps || ptxd_bailout "fatal error"
-setup_libs_early || ptxd_bailout "fatal error"
-# --- libs are available from here ---
-setup_config || ptxd_bailout "fatal error"
-# --- errexit feature may be active ---
-parse_first || ptxd_bailout "fatal error"
-# --- vars to config files are setup ---
-setup_platform || ptxd_bailout "fatal error"
-# --- platformdir and other *dirs are available from here ---
-# --- all variables are defined now ---
-setup_libs || ptxd_bailout "fatal error"
-setup_path || ptxd_bailout "fatal error"
-# --- path is now set ---
-setup_logfile || ptxd_bailout "fatal error"
-# -- logfile is ready
-setup_export || ptxd_bailout "fatal error"
-# -- all important vars are exported
-
-check_uid
-check_path
-
-parse_second
-
-exit 1
+main() {
+ check_uid &&
+ check_path &&
+
+ setup_topdir &&
+ setup_traps &&
+ setup_libs_early &&
+ # --- libs are available from here ---
+
+ setup_config &&
+ # --- errexit feature may be active ---
+
+ parse_first &&
+ # --- vars to config files are setup ---
+
+ setup_platform &&
+ # --- platformdir and other *dirs are available from here ---
+ # --- all variables are defined now ---
+
+ setup_libs &&
+ setup_path &&
+ # --- path is now set ---
+
+ setup_logfile &&
+ # -- logfile is ready
+
+ setup_export &&
+ # -- all important vars are exported
+
+ parse_second
+}
+
+main "${@}" || { echo "PTXdist: fatal error ... cannot start, sorry!"; exit; }