/usr/share/ltsp/plugins/ltsp-build-client/ALTLinux/000-progress is in ltsp-server 5.4.2-6+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | case "$MODE" in
commandline)
add_option "progress" "`eval_gettext "Enable progress reporting"`" "advanced" "false"
add_option "timestamp" "`eval_gettext "Print stage times (seconds)"`" "advanced" "false"
add_option "progressbar" "`eval_gettext "Draw progress bar"`" "advanced" "false"
;;
configure)
progress_timestamp()
{
local p s
s="$hook"
if [ "x$2" != "xstage" ]; then
p=$(basename "$filename")
s="$s ${p:4}"
fi
echo "progress: $(($(date +%s) - $start_time)) $s"
}
progress_ext()
{
local n plugin
plugin="$(basename "$filename")"
n=${plugin:0:3}
if [ "x$n" = "x000" -o "x$n" = "x999" ]; then
plugin=""
fi
case "$1" in
[[:digit:]]*)
PROGRESS_VALUE=$1
echo "progress: $PROGRESS_VALUE $hook:$plugin"
;;
plugin)
echo "progress: $PROGRESS_VALUE $hook:$plugin"
;;
stage)
echo "progress: $PROGRESS_VALUE $hook:$plugin"
;;
done)
echo
echo "$(basename "$0") done"
echo
echo "progress: 1000 done"
;;
init)
echo "progress: 0 configure"
;;
esac
}
progress_norm()
{
local n plugin
plugin="$(basename "$filename")"
n=${plugin:0:3}
if [ "x$n" = "x000" -o "x$n" = "x999" ]; then
plugin=" "
fi
case "$1" in
[[:digit:]]*)
PROGRESS_VALUE=$((($1+5)/10))
printf "\r%-16s %-24s %3d%%" "$hook:" "$plugin" $PROGRESS_VALUE
;;
plugin)
printf "\r%-16s %-24s %3d%%" "$hook:" "$plugin" $PROGRESS_VALUE
;;
stage)
printf "\r%-16s %-24s %3d%%" "$hook:" "$plugin" $PROGRESS_VALUE
;;
done)
echo
echo "$(basename "$0") done"
echo
;;
init)
echo
printf "\r%-16s %-24s %3d%%" "$hook:" "$plugin" 0
;;
esac
}
progressbar_init()
{
local KDIALOG
if KDIALOG=$(kdialog --geometry 600x10 --progressbar "ltsp-build-client" 1000 2>/dev/null); then
KDIALOG_CLIENT=$(dcopclient $KDIALOG)
KDIALOG_OBJECT=$(dcopobject $KDIALOG)
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT showCancelButton true
return 0
else
return 1
fi
}
progressbar()
{
if [ -n "$KDIALOG_CLIENT" -a "x$(dcop $KDIALOG_CLIENT $KDIALOG_OBJECT wasCancelled)" = "xtrue" ]; then
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT close
echo >&2
exit 255
fi
case "$1" in
[[:digit:]]*)
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT setProgress $1
;;
plugin)
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT setLabel "$hook: $(basename "$filename")"
;;
stage)
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT setLabel "$hook"
;;
done)
dcop $KDIALOG_CLIENT $KDIALOG_OBJECT close
;;
init)
progressbar_init || PROGRESS=true
;;
esac
}
PROGRESS=true
if [ -n "$option_progress_value" ]; then
exec 2>/dev/null
[ -t 1 ] && PROGRESS=progress_norm || PROGRESS=progress_ext
$PROGRESS 0
elif [ -n "$option_timestamp_value" ]; then
PROGRESS=progress_timestamp
elif [ -n "$option_progressbar_value" ]; then
progressbar_init && PROGRESS=progressbar
fi
$PROGRESS stage
;;
*)
$PROGRESS stage
;;
esac
|