From d07ddbc5b98f739bebc8fd7ecdf2a6a6fe5d8375 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 2 Nov 2009 15:46:37 -0800 Subject: use top-level pid for progress indicator --- scripts/install/install-functions | 14 ++++++++------ scripts/install/install-image | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/scripts/install/install-functions b/scripts/install/install-functions index 3bdc1fde..29707dff 100755 --- a/scripts/install/install-functions +++ b/scripts/install/install-functions @@ -43,18 +43,20 @@ VYATTA_CFG_DIR=${vyatta_sysconfdir}/config # the floppy config dir FD_CFG_DIR=/media/floppy/config -# Process ID for progress_indicator -SPID=$$ - +# PROGRESS_PID can be exported by top-level script progress_indicator () { + local spid=$PROGRESS_PID + if [ -z "$spid" ]; then + spid=$$ + fi case "$1" in start) - $vyatta_bindir/progress-indicator $SPID & + $vyatta_bindir/progress-indicator $spid & ;; *) - if ! rm /tmp/pi.$SPID 2>/dev/null; then + if ! rm /tmp/pi.$spid 2>/dev/null; then sleep 1 - rm /tmp/pi.$SPID 2>/dev/null + rm /tmp/pi.$spid 2>/dev/null fi sleep 1 echo -n -e "\b" diff --git a/scripts/install/install-image b/scripts/install/install-image index 0bf31a00..6ed0f732 100755 --- a/scripts/install/install-image +++ b/scripts/install/install-image @@ -5,6 +5,8 @@ source /opt/vyatta/sbin/install-functions # export INSTALL_LOG for the scripts invoked export INSTALL_LOG=/tmp/install-$$.log +# export PROGRESS_PID for the scripts invoked +export PROGRESS_PID=$$ # file for get-partition output PART_FILE='' @@ -114,12 +116,30 @@ fi trap sig_handler INT KILL trap exit_handler EXIT +cat <