COPKGManager: ensure cleanup /tmp/.opkg after closing packet manager

This commit is contained in:
2015-01-31 22:52:41 +01:00
parent 14d21fdeec
commit ee56b75567

View File

@@ -56,6 +56,7 @@
/* later this can be changed to just "opkg" */ /* later this can be changed to just "opkg" */
#define OPKG_CL "opkg-cl" #define OPKG_CL "opkg-cl"
#define OPKG_CL_CONFIG_OPTIONS " -V2 --tmp-dir=/tmp --cache=/tmp/.opkg " #define OPKG_CL_CONFIG_OPTIONS " -V2 --tmp-dir=/tmp --cache=/tmp/.opkg "
#define OPKG_TMP_DIR "/tmp/.opkg"
using namespace std; using namespace std;
@@ -94,11 +95,12 @@ COPKGManager::COPKGManager()
list_upgradeable_done = false; list_upgradeable_done = false;
expert_mode = false; expert_mode = false;
local_dir = &g_settings.update_dir_opkg; local_dir = &g_settings.update_dir_opkg;
CFileHelpers::createDir("/tmp/.opkg"); CFileHelpers::createDir(OPKG_TMP_DIR);
} }
COPKGManager::~COPKGManager() COPKGManager::~COPKGManager()
{ {
CFileHelpers::removeDir(OPKG_TMP_DIR);
} }
int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
@@ -108,7 +110,9 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
if (actionKey.empty()) { if (actionKey.empty()) {
if (parent) if (parent)
parent->hide(); parent->hide();
return showMenu(); int ret = showMenu();
CFileHelpers::removeDir(OPKG_TMP_DIR);
return ret;
} }
int selected = menu->getSelected() - menu_offset; int selected = menu->getSelected() - menu_offset;