- use find_executable() to find scripts

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2020-12-06 16:38:07 +01:00
committed by Thilo Graf
parent cf67ca4cb6
commit d04169be69
2 changed files with 11 additions and 10 deletions

View File

@@ -141,10 +141,10 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SETTINGS_BACKUP));
hintBox->paint();
const char backup_sh[] = TARGET_PREFIX "/bin/backup.sh";
std::string backup_sh = find_executable("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(3, backup_sh, g_settings.backup_dir.c_str(), fname.c_str());
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, backup_sh.c_str(), g_settings.backup_dir.c_str());
my_system(3, backup_sh.c_str(), g_settings.backup_dir.c_str(), fname.c_str());
hintBox->hide();
delete hintBox;
@@ -165,10 +165,10 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
int result = ShowMsg(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo);
if(result == CMsgBox::mbrYes)
{
const char restore_sh[] = TARGET_PREFIX "/bin/restore.sh";
std::string restore_sh = find_executable("restore.sh");
std::string restore_file = fileBrowser.getSelectedFile()->Name;
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, restore_sh, restore_file.c_str());
my_system(2, restore_sh, restore_file.c_str());
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, restore_sh.c_str(), restore_file.c_str());
my_system(2, restore_sh.c_str(), restore_file.c_str());
}
}
return res;

View File

@@ -654,7 +654,8 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
ofgwrite will copy this tarball to new rootfs.
It's untared at first start of new image.
*/
my_system(3, TARGET_PREFIX "/bin/backup.sh", "/tmp", "backup_flash"); // file ending is set by backup script;
std::string backup_sh = find_executable("backup.sh");
my_system(3, backup_sh.c_str(), "/tmp", "backup_flash"); // file ending is set by backup script;
hintBox.hide();
}
@@ -766,10 +767,10 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
}
else // not image, install
{
const char install_sh[] = TARGET_PREFIX "/bin/install.sh";
dprintf(DEBUG_NORMAL, "[update] calling %s %s %s\n",install_sh, g_settings.update_dir.c_str(), filename.c_str() );
std::string install_sh = find_executable("install.sh");
dprintf(DEBUG_NORMAL, "[update] calling %s %s %s\n", install_sh.c_str(), g_settings.update_dir.c_str(), filename.c_str() );
#ifndef DRYRUN
my_system(3, install_sh, g_settings.update_dir.c_str(), filename.c_str());
my_system(3, install_sh.c_str(), g_settings.update_dir.c_str(), filename.c_str());
#endif
showGlobalStatus(100);
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_READY);