From b5490ad9c627bf2ee6f79947ebe5558be2713608 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 12 Nov 2020 22:17:34 +0100 Subject: [PATCH] keybind-setup/settings-manager: use getBackupSuffix() function Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/30cf142d53ee613b4fcef16bd1f2b9f279ad3fde Author: vanhofen Date: 2020-11-12 (Thu, 12 Nov 2020) Origin message was: ------------------ - keybind-setup/settings-manager: use getBackupSuffix() function --- data/scripts/backup.sh | 2 +- src/gui/keybind_setup.cpp | 7 +------ src/gui/settings_manager.cpp | 8 +++----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/data/scripts/backup.sh b/data/scripts/backup.sh index 2d2098c61..95c7330ae 100644 --- a/data/scripts/backup.sh +++ b/data/scripts/backup.sh @@ -5,7 +5,7 @@ HOST=$(hostname) DATE=$(date +%Y%m%d_%H%M) USRF="/var/tuxbox/config/tobackup.conf" -BAKF="$1/${2:-settings_${HOST}_${DATE}.tar.gz}" +BAKF="$1/${2:-settings_${HOST}_${DATE}}.tar.gz" TOBACKUP="\ /etc/exports \ diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index fbff066c2..3bf8dc315 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -52,7 +52,6 @@ #include #include -#include #include #include #include @@ -125,11 +124,7 @@ int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - - std::string hostName = ""; - netGetHostname(hostName); - std::string timeStr = getNowTimeStr("_%Y%m%d_%H%M"); - std::string fname = "keys_" + hostName + timeStr + ".conf"; + std::string fname = "keys_" + getBackupSuffix() + ".conf"; CKeyboardInput * sms = new CKeyboardInput(LOCALE_EXTRA_SAVEKEYS, &fname, 45); sms->exec(NULL, ""); delete sms; diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp index 62471be7e..658e6ea5f 100644 --- a/src/gui/settings_manager.cpp +++ b/src/gui/settings_manager.cpp @@ -106,10 +106,7 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - std::string hostName = ""; - netGetHostname(hostName); - std::string timeStr = getNowTimeStr("_%Y%m%d_%H%M"); - std::string fname = "neutrino_" + hostName + timeStr + ".conf"; + std::string fname = "neutrino_" + getBackupSuffix() + ".conf"; CKeyboardInput * sms = new CKeyboardInput(LOCALE_EXTRA_SAVECONFIG, &fname, 45); sms->exec(NULL, ""); delete sms; @@ -146,8 +143,9 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey) hintBox->paint(); const char backup_sh[] = TARGET_PREFIX "/bin/backup.sh"; + std::string fname = "settings_" + getBackupSuffix(); // file ending is set by backup script; dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, backup_sh, g_settings.backup_dir.c_str()); - my_system(2, backup_sh, g_settings.backup_dir.c_str()); + my_system(3, backup_sh, g_settings.backup_dir.c_str(), fname.c_str()); hintBox->hide(); delete hintBox;