summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-12 19:39:30 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-12 19:39:30 +0100
commite4a5db7f3500b3706a479133b8d7b1465a570da5 (patch)
treeac5346fc29701e6a7ba50184bb6f69eff62c7cdc /src
parent119bc8fb89b78528a792335460ac200bf14d5804 (diff)
cleaner handling of exit code and running state in run_background + installpkg exit code fix
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-misc.sh8
-rw-r--r--src/core/libs/lib-software.sh10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh
index 06136cb..8236c0b 100644
--- a/src/core/libs/lib-misc.sh
+++ b/src/core/libs/lib-misc.sh
@@ -2,7 +2,7 @@
# run a process in the background, and log it's stdout and stderr to a specific logfile
-# You are supposed to clean up the retcode yourself!
+# returncode is stored in $<identifier>_exitcode
# $1 identifier
# $2 command (will be eval'ed)
# $3 logfile
@@ -13,13 +13,13 @@ run_background ()
[ -z "$3" ] && die_error "run_background needs a logfile to redirect output to!"
( \
- touch /tmp/$1-running
+ touch /home/arch/fifa/runtime/$1-running
echo "$1 progress ..." > $3; \
echo >> $3; \
eval "$2" >>$3 2>&1
- echo $? > /tmp/.$1-retcode
+ read $1_exitcode <<< $?
echo >> $3
- rm -f /tmp/$1-running
+ rm -f /home/arch/fifa/runtime/$1-running
) &
sleep 2
diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh
index 83ea100..04f4498 100644
--- a/src/core/libs/lib-software.sh
+++ b/src/core/libs/lib-software.sh
@@ -14,7 +14,8 @@ run_mkinitcpio()
target_special_fs off
# alert the user to fatal errors
- [ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ] && show_warning "MKINITCPIO FAILED - SYSTEM MAY NOT BOOT" "/tmp/mkinitcpio.log" text
+ [ $mkinitcpio_exitcode -ne 0 ] && show_warning "MKINITCPIO FAILED - SYSTEM MAY NOT BOOT" "/tmp/mkinitcpio.log" text
+ return $mkinitcpio_exitcode
}
@@ -28,23 +29,22 @@ installpkg() {
wait_for pacman-installpkg
+
local _result=''
- if [ $(cat /tmp/.pacman-retcode) -ne 0 ]; then
+ if [ ${pacman-installpkg_exitcode} -ne 0 ]; then
_result="Installation Failed (see errors below)"
echo -e "\nPackage Installation FAILED." >>/tmp/pacman.log
else
_result="Installation Complete"
echo -e "\nPackage Installation Complete." >>/tmp/pacman.log
fi
- rm /tmp/.pacman-retcode
show_warning "$_result" "/tmp/pacman.log" text || return 1
target_special_fs off
-
sync
- return 0
+ return ${pacman-installpkg_exitcode}
}