diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/libs/lib-misc.sh | 5 | ||||
-rw-r--r-- | src/core/libs/lib-software.sh | 4 | ||||
-rw-r--r-- | src/core/libs/lib-ui.sh | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index 327a4c5..0b77d93 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -3,6 +3,7 @@ # run a process in the background, and log it's stdout and stderr to a specific logfile # returncode is stored in $<identifier>_exitcode +# pid of the backgrounded wrapper process is stored in BACKGROUND_PID (this is _not_ the pid of $2) # $1 identifier -> WARNING: do never ever use -'s or other fancy characters here. only numbers, letters and _ please. (because $<identifier>_exitcode must be a valid bash variable!) # $2 command (will be eval'ed) # $3 logfile @@ -25,6 +26,7 @@ run_background () echo >> $3 rm -f $RUNTIME_DIR/aif-$1-running ) & + BACKGROUND_PID=$! sleep 2 } @@ -38,11 +40,10 @@ wait_for () while [ -f $RUNTIME_DIR/aif-$1-running ] do - #TODO: follow_progress dialog mode = nonblocking (so check and sleep is good), cli mode (tail -f )= blocking? (so check is probably not needed as it will be done) sleep 1 done - kill $(cat $ANSWER) #TODO: this may not work when mode = cli + kill $(cat $ANSWER) #TODO: this may not work when mode = cli (<--i wrote this before i used tail -f --pid. i don't remember what i meant with it). TODO: huh?? ANSWER? } diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 5969ab6..51a6539 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -10,7 +10,7 @@ run_mkinitcpio() target_special_fs on run_background mkinitcpio "chroot $var_TARGET_DIR /sbin/mkinitcpio -p kernel26" $TMP_MKINITCPIO_LOG - follow_progress "Rebuilding initcpio images ..." $TMP_MKINITCPIO_LOG + follow_progress "Rebuilding initcpio images ..." $TMP_MKINITCPIO_LOG $BACKGROUND_PID wait_for mkinitcpio target_special_fs off @@ -31,7 +31,7 @@ installpkg() { [ -n "$TARGET_GROUPS" ] && ALL_PACKAGES="$ALL_PACKAGES "`list_packages group "$TARGET_GROUPS" | awk '{print $2}'` ALL_PACKAGES=`echo $ALL_PACKAGES` run_background pacman_installpkg "$PACMAN_TARGET --noconfirm -S $ALL_PACKAGES" $TMP_PACMAN_LOG #TODO: There may be something wrong here. See http://projects.archlinux.org/?p=installer.git;a=commitdiff;h=f504e9ecfb9ecf1952bd8dcce7efe941e74db946 ASKDEV (Simo) - follow_progress " Installing... Please Wait " $TMP_PACMAN_LOG + follow_progress " Installing... Please Wait " $TMP_PACMAN_LOG $BACKGROUND_PID wait_for pacman_installpkg diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index 9719cbf..c438dc2 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -262,6 +262,7 @@ ask_yesno () # follow the progress of something by showing it's log, updating real-time # $1 title # $2 logfile +# $3 pid to monitor. if process stopped, stop following (only used in cli mode) follow_progress () { [ -z "$1" ] && die_error "follow_progress needs a title!" @@ -639,8 +640,8 @@ _cli_follow_progress () title=$1 logfile=$2 echo "Title: $1" - tail -f $2 - #TODO: don't block anymore when it's done + [ -n "$3" ] && tail -f $2 --pid=$3 + [ -z "$3" ] && tail -f $2 } set_keymap () |