From 490ebb23e3a0a6cf2cfd8521f590dc24fe245d04 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Tue, 14 Aug 2018 20:19:11 +0100
Subject: [PATCH] Display version number on about screen

---
 src/freedombone-installer      | 11 +++++++++++
 src/freedombone-utils-webadmin | 10 ++++++++++
 webadmin/EN/about.html         |  9 +++++++++
 3 files changed, 30 insertions(+)

diff --git a/src/freedombone-installer b/src/freedombone-installer
index 6a018ccc9..ca1b9c5d5 100755
--- a/src/freedombone-installer
+++ b/src/freedombone-installer
@@ -32,6 +32,7 @@ PROJECT_NAME='freedombone'
 export TEXTDOMAIN=${PROJECT_NAME}-installer
 export TEXTDOMAINDIR="/usr/share/locale"
 
+VERSION=3.1
 
 INSTALL_STATE_FIRST_BOOT=0
 INSTALL_STATE_WEBADMIN_PASSWORD_CTEATED=1
@@ -93,6 +94,14 @@ backup_progress_file=/root/.backup_progress.txt
 restore_progress_file=/root/.backup_progress.txt
 format_progress_file=/root/.format_progress.txt
 
+function webadmin_update_version {
+    local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
+    webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
+    if [ -f "$webadmin_install_dir/about.html" ]; then
+        sed -i "s|\"versiontext\".*|\"versiontext\">$VERSION</p>|g" "$webadmin_install_dir/about.html"
+    fi
+}
+
 function web_admin_create_add_apps {
     appslist_add_filename="$webadmin_install_dir/apps_add.html"
 
@@ -723,6 +732,7 @@ function after_setup_has_finished {
     web_admin_create_users
     web_admin_create_installed_apps
     web_admin_create_add_apps
+    webadmin_update_version
 
     # remove default user
     if [ -d /home/fbone ]; then
@@ -1365,6 +1375,7 @@ function change_language {
                         regenerate_blocklist
                         touch "$system_monitor_file"
                         update_system_monitor
+                        webadmin_update_version
                     fi
 
                     chown -R www-data:www-data "$webadmin_install_dir/*"
diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin
index 8aa6571de..9460ffcb9 100755
--- a/src/freedombone-utils-webadmin
+++ b/src/freedombone-utils-webadmin
@@ -751,6 +751,14 @@ function webadmin_change_language {
     fi
 }
 
+function webadmin_update_version {
+    local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
+    webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
+    if [ -f "$webadmin_install_dir/about.html" ]; then
+        sed -i "s|\"versiontext\".*|\"versiontext\">$VERSION</p>|g" "$webadmin_install_dir/about.html"
+    fi
+}
+
 function install_web_admin {
     # This is intended as an admin web user interface
     # similar to Plinth or the yunohost
@@ -937,6 +945,8 @@ function install_web_admin {
     webadmin_update_system_monitor
 
     webadmin_change_language
+
+    webadmin_update_version
 }
 
 # NOTE: deliberately no exit 0
diff --git a/webadmin/EN/about.html b/webadmin/EN/about.html
index 9f825334a..d78ede400 100644
--- a/webadmin/EN/about.html
+++ b/webadmin/EN/about.html
@@ -15,6 +15,13 @@
           padding: 32px;
       }
 
+      .versiontext {
+          color: #72a7cf;
+          text-align: center;
+          font-size: 120%;
+          font-weight: bold;
+      }
+
       #iconpic {
           width: 20%;
           height: auto;
@@ -65,6 +72,8 @@
     <div class="header">
       <a href="index.html"><img id="headerpic" class="img-responsive" src="images/logo.png"></a>
 
+      <p class="versiontext">Version</p>
+
       <p class="desc">This is a server system which enables you to run internet apps such as a blog or federated social network.</p>
 
       <p class="desc">Freedombone started in 2013. It was initially based on the Beaglebone Black hardware and inspired by the FreedomBox idea of an inexpensive and simple to manage internet server for the home.</p>
-- 
GitLab