Skip to content
Snippets Groups Projects
Commit c4990d6b authored by Bob Mottram's avatar Bob Mottram
Browse files

Show progress bar during installation

parent 2b98db61
No related branches found
No related tags found
No related merge requests found
......@@ -149,11 +149,6 @@ function run_setup_command {
# run in a separate process
./$installer_script &
# Do the initial setup which includes email
#touch /root/.running_install_command
#/usr/local/bin/freedombone -c "$CONFIGURATION_FILE"
#rm /root/.running_install_command
}
function before_setup_runs {
......@@ -295,6 +290,23 @@ function remove_apps_from_webadmin {
fi
}
function update_progress_bar {
if [ ! -f /root/.running_install_command ]; then
return
fi
if [ ! -f /root/.install_counter ]; then
return
fi
max_counter=50
installing_page="$webadmin_install_dir/setup_installing.html"
progress_counter=$(cat /root/.install_counter)
progress_percent=$((progress_counter * max_counter / 100))
if [ $progress_percent -gt 100 ]; then
progress_percent=100
fi
sed -i "s|<div class=\"w3-container|<div class=\"w3-container w3-round w3-blue\" style=\"width:$progress_percent%\">$progress_percent%</div>|g" "$installing_page"
}
if [ -f /root/.finished_install_command ]; then
rm /root/.finished_install_command
fi
......@@ -320,6 +332,7 @@ do
sleep 2
else
if [ -f "$setup_file" ]; then
update_progress_bar
before_setup_runs
after_setup_has_finished
sleep 1
......
......@@ -27,15 +27,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function increment_install_progress {
if [ ! -f /root/.running_install_command ]; then
return
fi
install_comment=$"1"
if [ ! "$install_counter" ]; then
install_counter=0
fi
if [ ! "$install_comment" ]; then
echo "$install_comment" > /root/.install_comment
fi
if [ $install_counter -lt 10000 ]; then
install_counter=$((install_counter + 1))
echo -n "$install_counter" > /root/.install_counter
fi
}
......
......@@ -67,5 +67,9 @@
<p>This may take some time. We thank you for your patience.</p>
</div>
<div class="w3-light-grey w3-round">
<div class="w3-container w3-round w3-blue" style="width:0%">0%</div>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment