mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-02-18 10:44:44 +02:00
Mount the OPK packages in order to execute the binary included.
This commit is contained in:
parent
909fef2f3a
commit
f6c19d0aa1
@ -73,6 +73,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
isOPK = opk;
|
isOPK = opk;
|
||||||
if (opk) {
|
if (opk) {
|
||||||
|
string::size_type pos;
|
||||||
|
|
||||||
struct ParserData *pdata = opk_open(linkfile);
|
struct ParserData *pdata = opk_open(linkfile);
|
||||||
char *param;
|
char *param;
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
@ -80,7 +82,14 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = linkfile;
|
opkFile = file;
|
||||||
|
pos = file.rfind('/');
|
||||||
|
opkMount = file.substr(pos+1);
|
||||||
|
pos = opkMount.rfind('.');
|
||||||
|
opkMount = opkMount.substr(0, pos);
|
||||||
|
|
||||||
|
file = gmenu2x->getHome() + "/sections/" + opkMount;
|
||||||
|
opkMount = (string) "/mnt/" + opkMount + '/';
|
||||||
|
|
||||||
param = opk_read_param(pdata, "Name");
|
param = opk_read_param(pdata, "Name");
|
||||||
if (!param)
|
if (!param)
|
||||||
@ -131,7 +140,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
#endif /* HAVE_LIBOPK */
|
#endif /* HAVE_LIBOPK */
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
ifstream infile (linkfile, ios_base::in);
|
ifstream infile (file.c_str(), ios_base::in);
|
||||||
while (getline(infile, line, '\n')) {
|
while (getline(infile, line, '\n')) {
|
||||||
line = trim(line);
|
line = trim(line);
|
||||||
if (line=="") continue;
|
if (line=="") continue;
|
||||||
@ -426,6 +435,28 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
drawRun();
|
drawRun();
|
||||||
save();
|
save();
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBOPK
|
||||||
|
if (isOPK) {
|
||||||
|
int err;
|
||||||
|
|
||||||
|
/* To be sure... */
|
||||||
|
string cmd = "umount " + opkMount;
|
||||||
|
system(cmd.c_str());
|
||||||
|
|
||||||
|
mkdir(opkMount.c_str(), 0700);
|
||||||
|
cmd = "mount -o loop,nosuid,ro " + opkFile + ' ' + opkMount;
|
||||||
|
err = system(cmd.c_str());
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
ERROR("Unable to mount OPK\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chdir(opkMount.c_str());
|
||||||
|
exec = opkMount + exec;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Set correct working directory
|
//Set correct working directory
|
||||||
string::size_type pos = exec.rfind("/");
|
string::size_type pos = exec.rfind("/");
|
||||||
if (pos != string::npos) {
|
if (pos != string::npos) {
|
||||||
@ -485,6 +516,8 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
if (gmenu2x->confInt["outputLogs"])
|
if (gmenu2x->confInt["outputLogs"])
|
||||||
command += " &> " + cmdclean(gmenu2x->getHome()) + "/log.txt";
|
command += " &> " + cmdclean(gmenu2x->getHome()) + "/log.txt";
|
||||||
#endif
|
#endif
|
||||||
|
if (isOPK)
|
||||||
|
command += " ; umount -l " + opkMount;
|
||||||
if (dontleave) {
|
if (dontleave) {
|
||||||
system(command.c_str());
|
system(command.c_str());
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
bool dontleave;
|
bool dontleave;
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
bool isOPK;
|
bool isOPK;
|
||||||
|
std::string opkMount, opkFile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user