From 05ec41c5eb2aa34dfb5f170ada6e83edfefa1eeb Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Wed, 15 Aug 2018 20:07:15 +0100
Subject: [PATCH] Ensure correct index file gets copied after webadmin setup

---
 src/freedombone-installer      | 10 ++++++----
 src/freedombone-utils-webadmin |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/freedombone-installer b/src/freedombone-installer
index 15126ee82..c82291c1b 100755
--- a/src/freedombone-installer
+++ b/src/freedombone-installer
@@ -443,24 +443,26 @@ function enable_webadmin_login {
 
 function remove_initial_setup_page {
     if [ -f "$webadmin_install_dir/index.prev" ]; then
+        curr_language=$(web_admin_get_language_subdir)
+
         # Replace the installing screen with the main index page when done
         # It should reload by itself
         if [ -f "$webadmin_install_dir/setup_installing.html" ]; then
-            cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/setup_installing.html"
+            cp "$webadmin_install_dir/${curr_language}/index.html" "$webadmin_install_dir/setup_installing.html"
         fi
 
         # Replace the setup confirm screen with the main index
         if [ -f "$webadmin_install_dir/setup_confirm.html" ]; then
-            cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/setup_confirm.html"
+            cp "$webadmin_install_dir/${curr_language}/index.html" "$webadmin_install_dir/setup_confirm.html"
         fi
 
         # Replace the setup domain screen with the main index
         if [ -f "$webadmin_install_dir/setup_domain.html" ]; then
-            cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/setup_domain.html"
+            cp "$webadmin_install_dir/${curr_language}/index.html" "$webadmin_install_dir/setup_domain.html"
         fi
 
         # Show the web admin index page (not the initial setup page)
-        cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/index.html"
+        cp "$webadmin_install_dir/${curr_language}/index.html" "$webadmin_install_dir/index.html"
         rm "$webadmin_install_dir/index.prev"
     fi
 
diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin
index 35c3aa592..0ba50870e 100755
--- a/src/freedombone-utils-webadmin
+++ b/src/freedombone-utils-webadmin
@@ -625,7 +625,7 @@ function image_install_web_admin {
     mkdir -p "$rootdir$webadmin_install_dir"
     cp -r "$rootdir/usr/share/${PROJECT_NAME}/webadmin"/* "$rootdir$webadmin_install_dir"
     cp "$rootdir/usr/share/${PROJECT_NAME}/webadmin/${language_subdir}"/*.html "$rootdir$webadmin_install_dir"
-    cp "$rootdir$webadmin_install_dir"/index.html "$rootdir$webadmin_install_dir"/index.prev
+    cp "$rootdir$webadmin_install_dir/${language_subdir}"/index.html "$rootdir$webadmin_install_dir"/index.prev
     if [[ "$ONION_ONLY" != 'no' ]]; then
         web_admin_onion_only
     fi
@@ -808,7 +808,7 @@ function install_web_admin {
             cp -r "/usr/share/${PROJECT_NAME}/webadmin"/* "$webadmin_install_dir"
             cp "/usr/share/${PROJECT_NAME}/webadmin/${language_subdir}"/*.html "$webadmin_install_dir"
 
-            cp "$webadmin_install_dir"/index.html "$webadmin_install_dir"/index.prev
+            cp "$webadmin_install_dir/${language_subdir}"/index.html "$webadmin_install_dir"/index.prev
 
             if [ -f "$webadmin_install_dir/.setupscreenactive" ]; then
                 if [ -f "$webadmin_install_dir/setup.prev" ]; then
-- 
GitLab