[16000] | 1 | #ifndef EXTENSIONS_H |
---|
| 2 | #define EXTENSIONS_H |
---|
| 3 | |
---|
[28733] | 4 | //flag 0: inputbox |
---|
| 5 | //flag 1: auto |
---|
| 6 | void screenfeed(int flag) |
---|
[16000] | 7 | { |
---|
| 8 | char* tmpstr = NULL, *line = NULL, *lastline = NULL; |
---|
| 9 | char* pos = NULL; |
---|
| 10 | |
---|
[31100] | 11 | tmpstr = readsys(getconfig("feed", NULL), 4); //line4 |
---|
[16000] | 12 | tmpstr = string_replace("src/gz secret http://", "", tmpstr, 1); |
---|
| 13 | |
---|
| 14 | if(tmpstr != NULL) |
---|
| 15 | pos = strchr(tmpstr, '/'); |
---|
| 16 | if(pos != NULL) |
---|
| 17 | pos[0] = '\0'; |
---|
| 18 | |
---|
| 19 | if(tmpstr == NULL || ostrcmp(tmpstr, "") == 0 || ostrcmp(tmpstr, "\n") == 0) |
---|
| 20 | tmpstr = ostrcat(tmpstr, "000.000.000.000", 1, 0); |
---|
| 21 | |
---|
[28733] | 22 | if(flag == 1) |
---|
| 23 | lastline = ostrcat("999.999.999.999", NULL, 0, 0); |
---|
| 24 | else |
---|
| 25 | lastline = numinput(_("Feed"), tmpstr, "000.000.000.000", 1); |
---|
| 26 | |
---|
[19415] | 27 | //for devs, who have secret feed not in mind |
---|
[19426] | 28 | if(ostrcmp("999.999.999.999", lastline) == 0) |
---|
[19415] | 29 | { |
---|
| 30 | free(lastline); lastline = NULL; |
---|
| 31 | lastline = ostrcat("097.074.032.010", NULL, 0, 0); |
---|
| 32 | } |
---|
| 33 | |
---|
[16000] | 34 | if(lastline != NULL) |
---|
| 35 | { |
---|
| 36 | free(tmpstr); tmpstr = NULL; |
---|
| 37 | tmpstr = fixip(lastline, 1); |
---|
| 38 | free(lastline); lastline = tmpstr; |
---|
| 39 | |
---|
| 40 | tmpstr = readsys(getconfig("feed", NULL), 1); //line1 |
---|
| 41 | if(tmpstr == NULL || (tmpstr != NULL && strlen(tmpstr) == 0)) |
---|
| 42 | line = ostrcat(line, "#", 1, 0); |
---|
| 43 | else |
---|
| 44 | line = ostrcat(line, tmpstr, 1, 0); |
---|
| 45 | free(tmpstr); tmpstr = NULL; |
---|
| 46 | |
---|
| 47 | if(line[strlen(line) - 1] != '\n') |
---|
| 48 | line = ostrcat(line, "\n", 1, 0); |
---|
| 49 | |
---|
| 50 | tmpstr = readsys(getconfig("feed", NULL), 2); //line2 |
---|
| 51 | if(tmpstr == NULL || (tmpstr != NULL && strlen(tmpstr) == 0)) |
---|
| 52 | line = ostrcat(line, "#\n", 1, 0); |
---|
| 53 | else |
---|
| 54 | line = ostrcat(line, tmpstr, 1, 0); |
---|
| 55 | free(tmpstr); tmpstr = NULL; |
---|
[31100] | 56 | ///// |
---|
| 57 | if(line[strlen(line) - 1] != '\n') |
---|
| 58 | line = ostrcat(line, "\n", 1, 0); |
---|
[16000] | 59 | |
---|
[31100] | 60 | tmpstr = readsys(getconfig("feed", NULL), 3); //line3 |
---|
| 61 | if(tmpstr == NULL || (tmpstr != NULL && strlen(tmpstr) == 0)) |
---|
| 62 | line = ostrcat(line, "#\n", 1, 0); |
---|
| 63 | else |
---|
| 64 | line = ostrcat(line, tmpstr, 1, 0); |
---|
| 65 | free(tmpstr); tmpstr = NULL; |
---|
| 66 | ///// |
---|
[16000] | 67 | if(line[strlen(line) - 1] == '\n') |
---|
| 68 | tmpstr = ostrcat(line, "src/gz secret http://", 0, 0); |
---|
| 69 | else |
---|
| 70 | tmpstr = ostrcat(line, "\nsrc/gz secret http://", 0, 0); |
---|
| 71 | |
---|
| 72 | if(strlen(lastline) == 0) |
---|
| 73 | { |
---|
| 74 | free(tmpstr); |
---|
| 75 | tmpstr = ostrcat(line, NULL, 0, 0); |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | tmpstr = ostrcat(tmpstr, lastline, 1, 0); |
---|
[31102] | 79 | // tmpstr = ostrcat(tmpstr, "/svn/tpk/sh4", 1, 0); |
---|
[31326] | 80 | #ifdef SH4 |
---|
[31102] | 81 | tmpstr = ostrcat(tmpstr, "/svn/tpk/nightly-sh4-secret", 1, 0); |
---|
[31326] | 82 | #else |
---|
| 83 | tmpstr = ostrcat(tmpstr, "/svn/tpk/nightly-mipsel-secret", 1, 0); |
---|
| 84 | #endif |
---|
[16000] | 85 | writesys(getconfig("feed", NULL), tmpstr, 0); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | free(tmpstr); |
---|
| 89 | free(line); |
---|
| 90 | free(lastline); |
---|
| 91 | } |
---|
| 92 | |
---|
[23401] | 93 | //flag 0: install ok |
---|
| 94 | //flag 1: install err |
---|
| 95 | //flag 2: remove ok |
---|
| 96 | //flag 3: remove err |
---|
| 97 | char* gettpklog(char* installpath, int flag) |
---|
| 98 | { |
---|
| 99 | char* tmpstr = NULL; |
---|
| 100 | |
---|
| 101 | if(flag == 0 || flag == 1) |
---|
| 102 | tmpstr = ostrcat(tmpstr, _("Installation start"), 1, 0); |
---|
| 103 | else |
---|
| 104 | tmpstr = ostrcat(tmpstr, _("Remove start"), 1, 0); |
---|
| 105 | tmpstr = ostrcat(tmpstr, "\n\n", 1, 0); |
---|
| 106 | |
---|
| 107 | tmpstr = ostrcat(tmpstr, readfiletomem(TPKLOG, 0), 1, 1); |
---|
| 108 | |
---|
| 109 | tmpstr = ostrcat(tmpstr, "\n\n", 1, 0); |
---|
| 110 | |
---|
| 111 | if(installpath != NULL) |
---|
| 112 | { |
---|
| 113 | tmpstr = ostrcat(tmpstr, _("New free space (KB): "), 1, 0); |
---|
| 114 | tmpstr = ostrcat(tmpstr, ollutoa(getfreespace(installpath) / 1024), 1, 1); |
---|
| 115 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | if(flag == 0) |
---|
[23408] | 119 | tmpstr = ostrcat(tmpstr, _("Install success"), 1, 0); |
---|
[23401] | 120 | if(flag == 1) |
---|
[23408] | 121 | tmpstr = ostrcat(tmpstr, _("Install error"), 1, 0); |
---|
[23401] | 122 | if(flag == 2) |
---|
[23408] | 123 | tmpstr = ostrcat(tmpstr, _("Remove success"), 1, 0); |
---|
[23401] | 124 | if(flag == 3) |
---|
[23408] | 125 | tmpstr = ostrcat(tmpstr, _("Remove error"), 1, 0); |
---|
[23401] | 126 | |
---|
| 127 | if(installpath == NULL || ostrcmp("/var/swap", installpath) == 0) |
---|
| 128 | sync(); |
---|
| 129 | |
---|
| 130 | return tmpstr; |
---|
| 131 | } |
---|
| 132 | |
---|
[23288] | 133 | char* getinstallpath(char* path, char* size) |
---|
[23283] | 134 | { |
---|
[23289] | 135 | int count = 0, isize = 0; |
---|
[23283] | 136 | char* tmpstr = NULL; |
---|
| 137 | struct menulist* mlist = NULL, *mbox = NULL, *tmpmlist = NULL; |
---|
| 138 | |
---|
[23289] | 139 | if(size != NULL) isize = atoi(size); |
---|
[23283] | 140 | |
---|
[30206] | 141 | if(path == NULL || path[0] == '*' || ostrstr(path, "mnt") != NULL) |
---|
| 142 | { |
---|
| 143 | if(tpkchecksize(NULL, "/mnt/swapextensions", isize) == 0) |
---|
[23290] | 144 | { |
---|
[30206] | 145 | tmpmlist = addmenulist(&mlist, _("Install to MNT"), NULL, NULL, 0, 0); |
---|
| 146 | changemenulistparam(tmpmlist, "/mnt/swapextensions", NULL, NULL, NULL); |
---|
| 147 | free(tmpstr); tmpstr = NULL; |
---|
| 148 | tmpstr = ostrcat("/mnt/swapextensions", NULL, 0, 0); |
---|
| 149 | count++; |
---|
[23290] | 150 | } |
---|
[30206] | 151 | } |
---|
[23283] | 152 | |
---|
[23765] | 153 | if(path == NULL || path[0] == '*' || ostrstr(path, "var") != NULL) |
---|
[23288] | 154 | { |
---|
[23290] | 155 | if(tpkchecksize(NULL, "/var", isize) == 0) |
---|
| 156 | { |
---|
[25932] | 157 | tmpmlist = addmenulist(&mlist, _("Install to FLASH"), NULL, NULL, 0, 0); |
---|
[23290] | 158 | changemenulistparam(tmpmlist, "/var", NULL, NULL, NULL); |
---|
| 159 | free(tmpstr); tmpstr = NULL; |
---|
| 160 | tmpstr = ostrcat("/var", NULL, 0, 0); |
---|
| 161 | count++; |
---|
| 162 | } |
---|
[23288] | 163 | } |
---|
[23283] | 164 | |
---|
[23765] | 165 | if(path == NULL || path[0] == '*' || ostrstr(path, "swap") != NULL) |
---|
[23288] | 166 | { |
---|
[27930] | 167 | if(file_exist("/tmp/.swapextensionsdev") == 1 || file_exist("/var/swap")) |
---|
[23290] | 168 | { |
---|
[23392] | 169 | if(tpkchecksize(NULL, "/var/swap", isize) == 0) |
---|
| 170 | { |
---|
[25932] | 171 | tmpmlist = addmenulist(&mlist, _("Install to SWAP"), NULL, NULL, 0, 0); |
---|
[23392] | 172 | changemenulistparam(tmpmlist, "/var/swap", NULL, NULL, NULL); |
---|
| 173 | free(tmpstr); tmpstr = NULL; |
---|
| 174 | tmpstr = ostrcat("/var/swap", NULL, 0, 0); |
---|
| 175 | count++; |
---|
| 176 | } |
---|
[23290] | 177 | } |
---|
[23288] | 178 | } |
---|
[23283] | 179 | |
---|
[23948] | 180 | //if(count > 1) // if only 1 installpath, don't show choicebox |
---|
| 181 | if(count > 0) // show always choicebox |
---|
[23288] | 182 | { |
---|
| 183 | free(tmpstr); tmpstr = NULL; |
---|
[27740] | 184 | mbox = menulistbox(mlist, "tpkinstallinfo", _("Choice Install Medium"), NULL, NULL, NULL, 0, 0); |
---|
[23288] | 185 | if(mbox != NULL) |
---|
| 186 | tmpstr = ostrcat(mbox->param, NULL, 0, 0); |
---|
| 187 | } |
---|
[23772] | 188 | else if(count == 0) |
---|
[23720] | 189 | { |
---|
[23290] | 190 | textbox(_("Tpk Install Info"), _("Can't install Package. Package to big."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
[23720] | 191 | free(tmpstr); tmpstr = NULL; |
---|
| 192 | } |
---|
[23288] | 193 | |
---|
[23283] | 194 | freemenulist(mlist, 0); mlist = NULL; |
---|
| 195 | return tmpstr; |
---|
| 196 | } |
---|
| 197 | |
---|
[22605] | 198 | void screenextensions(int mode, char* path, char* defentry, int first) |
---|
[16000] | 199 | { |
---|
[23288] | 200 | char* tmpstr = NULL, *tmpinfo = NULL, *installpath = NULL; |
---|
[16000] | 201 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
| 202 | struct menulist* mlist1 = NULL, *mbox1 = NULL; |
---|
[17644] | 203 | struct skin* load = getscreen("loading"); |
---|
| 204 | |
---|
[17604] | 205 | status.hangtime = 99999; |
---|
[21635] | 206 | unlink(TPKLOG); |
---|
[16000] | 207 | |
---|
| 208 | if(mode == 0) |
---|
| 209 | { |
---|
[16511] | 210 | drawscreen(load, 0, 0); |
---|
[16454] | 211 | |
---|
[23152] | 212 | if(first == 1) tpkgetindex(0); |
---|
[21483] | 213 | tpklist(); |
---|
[16000] | 214 | |
---|
[16984] | 215 | clearscreen(load); |
---|
| 216 | |
---|
[25921] | 217 | mbox = tpkmenulist(mlist, NULL, _("Tpk Install - select section"), NULL, NULL, 1, defentry, 0); |
---|
[16000] | 218 | |
---|
| 219 | if(mbox != NULL) |
---|
| 220 | { |
---|
| 221 | debug(130, "section: %s", mbox->name); |
---|
[25921] | 222 | mbox1 = tpkmenulist(mlist1, "tpkinstall", _("Tpk Install - select file"), "/tmp/tpk", mbox->name, 2, NULL, 1); |
---|
[16000] | 223 | |
---|
[21506] | 224 | if(mbox1 != NULL && mbox1->param != NULL && mbox1->param1 != NULL) |
---|
[16000] | 225 | { |
---|
| 226 | debug(130, "file: %s", mbox1->name); |
---|
[25233] | 227 | if(ostrstr(mbox1->name, _("It may only be a package to be installed. If they want to install another package of this section, they only remove the installed packet. Is not the plugin after reinstalling the software TitanNit in TitanNit Menu Visible then perform an update by Tpk to: ")) == NULL) |
---|
[25229] | 228 | { |
---|
| 229 | installpath = getinstallpath(mbox1->param2, mbox1->param3); |
---|
| 230 | if(installpath != NULL) |
---|
[16000] | 231 | { |
---|
[25229] | 232 | tmpinfo = ostrcat(tmpinfo, _("Installing"), 1, 0); |
---|
| 233 | tmpinfo = ostrcat(tmpinfo, " ", 1, 0); |
---|
| 234 | tmpinfo = ostrcat(tmpinfo, mbox->name, 1, 0); |
---|
| 235 | tmpinfo = ostrcat(tmpinfo, "-", 1, 0); |
---|
| 236 | tmpinfo = ostrcat(tmpinfo, mbox1->name, 1, 0); |
---|
| 237 | tmpinfo = ostrcat(tmpinfo, " ", 1, 0); |
---|
[25447] | 238 | tmpinfo = ostrcat(tmpinfo, _("starting"), 1, 0); |
---|
[25229] | 239 | tmpinfo = ostrcat(tmpinfo, " ?", 1, 0); |
---|
| 240 | |
---|
| 241 | if(textbox(_("Tpk Install Info"), _(tmpinfo), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1) |
---|
[21678] | 242 | { |
---|
[25229] | 243 | drawscreen(load, 0, 0); |
---|
| 244 | resettvpic(); |
---|
| 245 | char* log = NULL; |
---|
[30350] | 246 | int tpkret = tpkgetpackage(mbox1->param, mbox1->param1, installpath, 0, 0); |
---|
[25671] | 247 | if(tpkret == 0) |
---|
[25229] | 248 | { |
---|
| 249 | log = gettpklog(installpath, 0); |
---|
| 250 | textbox(_("Tpk Install Info - Install OK"), _(log), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 2); |
---|
| 251 | } |
---|
[25671] | 252 | else if(tpkret == 2) |
---|
| 253 | { |
---|
| 254 | textbox(_("Tpk Install Info - Install ERROR"), _("It may only be a package to be installed. If they want to install another package of this section, they only remove the installed packet. Is not the plugin after reinstalling the software TitanNit in TitanNit Menu Visible then perform an update by Tpk to: "), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 2); |
---|
| 255 | } |
---|
[25229] | 256 | else |
---|
| 257 | { |
---|
| 258 | log = gettpklog(installpath, 1); |
---|
| 259 | textbox(_("Tpk Install Info - Install ERROR"), _(log), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 2); |
---|
| 260 | } |
---|
| 261 | // textbox(_("Message"), _("Some plugins needs restart.\nIf the plugin is not active\nreboot the box."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
| 262 | loadplugin(); |
---|
| 263 | free(log), log = NULL; |
---|
| 264 | unlink(TPKLOG); |
---|
| 265 | if(file_exist("/tmp/.tpk_needs_reboot")) |
---|
| 266 | { |
---|
| 267 | textbox(_("Message"), _("TPK Install done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
[25665] | 268 | //write only config file |
---|
| 269 | writeallconfig(3); |
---|
[25672] | 270 | oshutdown(2,2); |
---|
[25229] | 271 | system("init 6"); |
---|
| 272 | } |
---|
[21678] | 273 | } |
---|
[16000] | 274 | } |
---|
| 275 | } |
---|
| 276 | } |
---|
| 277 | } |
---|
[23288] | 278 | free(installpath); installpath = NULL; |
---|
[22608] | 279 | free(tmpstr); tmpstr = NULL; |
---|
[21506] | 280 | freemenulist(mlist1, 0); mlist1 = NULL; |
---|
[22608] | 281 | if(mbox != NULL) tmpstr = ostrcat(mbox->name, NULL, 0, 0); |
---|
[21506] | 282 | freemenulist(mlist, 0); mlist = NULL; |
---|
[16000] | 283 | free(tmpinfo); tmpinfo = NULL; |
---|
[21483] | 284 | freetpk(); |
---|
[22608] | 285 | if(mbox != NULL) screenextensions(0, path, tmpstr, 0); |
---|
| 286 | free(tmpstr); tmpstr = NULL; |
---|
[16000] | 287 | } |
---|
| 288 | else if(mode == 1) |
---|
| 289 | { |
---|
[21639] | 290 | tpklistinstalled(0); |
---|
[25921] | 291 | mbox = tpkmenulist(mlist, NULL, _("Tpk Remove - select file"), NULL, NULL, 1, defentry, 2); |
---|
[16000] | 292 | |
---|
[21506] | 293 | if(mbox != NULL && mbox->param != NULL) |
---|
[16000] | 294 | { |
---|
| 295 | debug(130, "file: %s", mbox->name); |
---|
| 296 | |
---|
[17136] | 297 | tmpinfo = ostrcat(tmpinfo, _("Removeing"), 1, 0); |
---|
[17129] | 298 | tmpinfo = ostrcat(tmpinfo, " ", 1, 0); |
---|
[16000] | 299 | tmpinfo = ostrcat(tmpinfo, mbox->name, 1, 0); |
---|
| 300 | tmpinfo = ostrcat(tmpinfo, " ?", 1, 0); |
---|
| 301 | |
---|
[21603] | 302 | if(textbox(_("Tpk Remove Info"), _(tmpinfo), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0) == 1) |
---|
[16000] | 303 | { |
---|
[17644] | 304 | drawscreen(load, 0, 0); |
---|
[17671] | 305 | resettvpic(); |
---|
[16000] | 306 | char* log = NULL; |
---|
[21506] | 307 | if(tpkremove(mbox->param, 0, 0) == 0) |
---|
[16000] | 308 | { |
---|
[23401] | 309 | log = gettpklog(NULL, 2); |
---|
[21603] | 310 | textbox(_("Tpk Remove Info - Remove OK"), _(log), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 2); |
---|
[21616] | 311 | //del plugin from memory if Titanname is defined in plugin control file |
---|
[21626] | 312 | if(mbox->param1 != NULL && mbox->param1[0] != '*') delplugin(mbox->param1); |
---|
[16000] | 313 | } |
---|
| 314 | else |
---|
| 315 | { |
---|
[23401] | 316 | log = gettpklog(NULL, 3); |
---|
[21603] | 317 | textbox(_("Tpk Remove Info - Remove ERROR"), _(log), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 2); |
---|
[16000] | 318 | } |
---|
[25229] | 319 | // textbox(_("Message"), _("Some plugins needs restart.\nIf the plugin is not active\nreboot the box."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
[21483] | 320 | free(log); log = NULL; |
---|
| 321 | unlink(TPKLOG); |
---|
| 322 | if(file_exist("/tmp/.tpk_needs_reboot")) |
---|
[18439] | 323 | { |
---|
[25229] | 324 | textbox(_("Message"), _("TPK Remove done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); |
---|
[25662] | 325 | //write only config file |
---|
| 326 | writeallconfig(3); |
---|
[25672] | 327 | oshutdown(2,2); |
---|
[18439] | 328 | system("init 6"); |
---|
| 329 | } |
---|
[16000] | 330 | } |
---|
| 331 | } |
---|
[22608] | 332 | free(tmpstr); tmpstr = NULL; |
---|
[21506] | 333 | freemenulist(mlist, 0); mlist = NULL; |
---|
[22608] | 334 | if(mbox != NULL) tmpstr = ostrcat(mbox->name, NULL, 0, 0); |
---|
[16000] | 335 | free(tmpinfo); tmpinfo = NULL; |
---|
[21483] | 336 | freetpk(); |
---|
[22608] | 337 | if(mbox != NULL) screenextensions(1, path, tmpstr, 0); |
---|
| 338 | free(tmpstr); tmpstr = NULL; |
---|
[16000] | 339 | } |
---|
| 340 | else if(mode == 2) |
---|
| 341 | { |
---|
[21483] | 342 | char* text1 = "Tpk Tmp Install - select file"; |
---|
| 343 | char* text2 = "Tpk Tmp Info"; |
---|
[17307] | 344 | |
---|
[16000] | 345 | if(path == NULL) |
---|
[21483] | 346 | tmpstr = gettpktmplist("/tmp"); |
---|
[16000] | 347 | else |
---|
[17307] | 348 | { |
---|
[21483] | 349 | tmpstr = gettpktmplist(path); |
---|
| 350 | text1 = "Tpk Media Install - select file"; |
---|
| 351 | text2 = "Tpk Media Info"; |
---|
[17307] | 352 | } |
---|
[16000] | 353 | |
---|
[17307] | 354 | if(tmpstr == NULL || strlen(tmpstr) == 0) |
---|
| 355 | { |
---|
[16000] | 356 | textbox(_("Message"), _("No plugin found."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[17307] | 357 | } |
---|
| 358 | else |
---|
| 359 | { |
---|
[22605] | 360 | addmenulistall(&mlist, tmpstr, NULL, 0, defentry); |
---|
[27740] | 361 | mbox = menulistbox(mlist, NULL, text1, NULL, NULL, "/skin/plugin.png", 1, 0); |
---|
[17307] | 362 | } |
---|
[16000] | 363 | |
---|
| 364 | free(tmpstr); tmpstr = NULL; |
---|
| 365 | |
---|
| 366 | if(mbox != NULL) |
---|
| 367 | { |
---|
[23288] | 368 | installpath = getinstallpath(NULL, 0); |
---|
[27562] | 369 | debug(130, "installpath: %s", installpath); |
---|
[23288] | 370 | if(installpath != NULL) |
---|
[16000] | 371 | { |
---|
[23288] | 372 | debug(130, "file: %s", mbox->name); |
---|
| 373 | |
---|
| 374 | tmpinfo = ostrcat(tmpinfo, _("Installing"), 1, 0); |
---|
| 375 | tmpinfo = ostrcat(tmpinfo, " ", 1, 0); |
---|
| 376 | tmpinfo = ostrcat(tmpinfo, mbox->name, 1, 0); |
---|
| 377 | tmpinfo = ostrcat(tmpinfo, " ", 1, 0); |
---|
[25447] | 378 | tmpinfo = ostrcat(tmpinfo, _("starting"), 1, 0); |
---|
[23288] | 379 | tmpinfo = ostrcat(tmpinfo, " ?", 1, 0); |
---|
[27562] | 380 | debug(130, "tmpinfo: %s", tmpinfo); |
---|
[23288] | 381 | |
---|
[32035] | 382 | if(textbox(_(text2), _(tmpinfo), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1) |
---|
[21483] | 383 | { |
---|
[23288] | 384 | char* log = NULL; |
---|
| 385 | int ret = 0; |
---|
| 386 | drawscreen(load, 0, 0); |
---|
| 387 | resettvpic(); |
---|
| 388 | if(path == NULL) |
---|
| 389 | { |
---|
| 390 | tmpstr = ostrcat(tmpstr, "/tmp", 1, 0); |
---|
| 391 | tmpstr = ostrcat(tmpstr, "/", 1, 0); |
---|
| 392 | tmpstr = ostrcat(tmpstr, mbox->name, 1, 0); |
---|
[27562] | 393 | debug(130, "tmpstr: %s", tmpstr); |
---|
[24579] | 394 | ret = tpkinstall(tmpstr, installpath, 0); |
---|
[23288] | 395 | free(tmpstr); tmpstr = NULL; |
---|
| 396 | } |
---|
| 397 | else |
---|
| 398 | { |
---|
| 399 | tmpstr = ostrcat(tmpstr, path, 1, 0); |
---|
| 400 | tmpstr = ostrcat(tmpstr, "/", 1, 0); |
---|
| 401 | tmpstr = ostrcat(tmpstr, mbox->name, 1, 0); |
---|
[27562] | 402 | debug(130, "tmpstr: %s", tmpstr); |
---|
[24579] | 403 | ret = tpkinstall(tmpstr, installpath, 0); |
---|
[23288] | 404 | free(tmpstr); tmpstr = NULL; |
---|
| 405 | } |
---|
| 406 | |
---|
[25671] | 407 | if(ret == 0) |
---|
| 408 | log = gettpklog(installpath, 0); |
---|
| 409 | else if(ret == 2) |
---|
| 410 | log = ostrcat(_("It may only be a package to be installed. If they want to install another package of this section, they only remove the installed packet. Is not the plugin after reinstalling the software TitanNit in TitanNit Menu Visible then perform an update by Tpk to: "), NULL, 0, 0); |
---|
| 411 | else |
---|
| 412 | log = gettpklog(installpath, 1); |
---|
[25229] | 413 | textbox(_(text2), log, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 600, 0, 0); |
---|
[23288] | 414 | free(log); log = NULL; |
---|
| 415 | unlink(TPKLOG); |
---|
[24325] | 416 | textbox(_("Message"), _("Some plugins needs restart.\nIf the plugin is not active\nreboot the box."), "EXIT", getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
[23288] | 417 | loadplugin(); |
---|
| 418 | if(file_exist("/tmp/.tpk_needs_reboot")) |
---|
| 419 | { |
---|
[25229] | 420 | textbox(_("Message"), _("TPK Tmp Install done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[25665] | 421 | //write only config file |
---|
| 422 | writeallconfig(3); |
---|
[25672] | 423 | oshutdown(2,2); |
---|
[23288] | 424 | system("init 6"); |
---|
| 425 | } |
---|
[21483] | 426 | } |
---|
[16000] | 427 | } |
---|
| 428 | } |
---|
[23288] | 429 | free(installpath); installpath = NULL; |
---|
[22608] | 430 | free(tmpstr); tmpstr = NULL; |
---|
[21506] | 431 | freemenulist(mlist, 0); mlist = NULL; |
---|
[22608] | 432 | if(mbox != NULL) tmpstr = ostrcat(mbox->name, NULL, 0, 0); |
---|
| 433 | free(tmpinfo); tmpinfo = NULL; |
---|
| 434 | if(mbox != NULL) screenextensions(2, path, tmpstr, 0); |
---|
[16000] | 435 | free(tmpstr); tmpstr = NULL; |
---|
| 436 | } |
---|
| 437 | else if(mode == 3) |
---|
| 438 | { |
---|
[16677] | 439 | drawscreen(load, 0, 0); |
---|
[17671] | 440 | resettvpic(); |
---|
[22050] | 441 | if(first == 1) |
---|
| 442 | { |
---|
| 443 | if(tpkgetindex(0) != 0) |
---|
[22757] | 444 | textbox(_("Tpk Update Info - Update ERROR"), _("Can't get all TPK index !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[22050] | 445 | } |
---|
[21483] | 446 | writesys("/tmp/.tpk_upgrade_start", "0", 0); |
---|
[30350] | 447 | if(tpkupdate(0) != 0) |
---|
[22050] | 448 | textbox(_("Tpk Update Info - Update ERROR"), _("Can't update all packages !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[16000] | 449 | loadplugin(); |
---|
[18278] | 450 | clearscreen(load); |
---|
| 451 | drawscreen(skin, 0, 0); |
---|
[21635] | 452 | unlink(TPKLOG); |
---|
[18439] | 453 | |
---|
[21483] | 454 | if(file_exist("/tmp/.tpk_needs_reboot")) |
---|
[18439] | 455 | { |
---|
[25229] | 456 | textbox(_("Message"), _("TPK Upgrade done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[25665] | 457 | //write only config file |
---|
| 458 | writeallconfig(3); |
---|
[25672] | 459 | oshutdown(2,2); |
---|
[18439] | 460 | system("init 6"); |
---|
| 461 | } |
---|
[21483] | 462 | unlink("/tmp/.tpk_upgrade_start"); |
---|
[16000] | 463 | } |
---|
[21506] | 464 | |
---|
| 465 | if(first == 1) tpkcleantmp(0); |
---|
[17604] | 466 | status.hangtime = getconfigint("hangtime", NULL); |
---|
[16000] | 467 | } |
---|
| 468 | |
---|
[16001] | 469 | //flag 0: without message |
---|
| 470 | //flag 1: with message |
---|
[16037] | 471 | void screenextensions_check(int flag) |
---|
[16000] | 472 | { |
---|
| 473 | int treffer = 0; |
---|
| 474 | struct hdd *node = NULL; |
---|
| 475 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
| 476 | |
---|
[33139] | 477 | if(status.security >= 1) |
---|
[16000] | 478 | { |
---|
| 479 | addhddall(); |
---|
| 480 | node = hdd; |
---|
| 481 | |
---|
| 482 | while(node != NULL) |
---|
| 483 | { |
---|
| 484 | if(node->partition != 0) |
---|
| 485 | { |
---|
| 486 | tmpstr = ostrcat("/autofs/", node->device, 0, 0); |
---|
[21483] | 487 | tmpstr1 = gettpktmplist(tmpstr); |
---|
[16000] | 488 | |
---|
| 489 | if(tmpstr1 != NULL) |
---|
| 490 | { |
---|
| 491 | treffer = 1; |
---|
[22605] | 492 | screenextensions(2, tmpstr, NULL, 1); |
---|
[16000] | 493 | } |
---|
| 494 | |
---|
| 495 | free(tmpstr); tmpstr = NULL; |
---|
| 496 | free(tmpstr1); tmpstr1 = NULL; |
---|
| 497 | } |
---|
| 498 | node = node->next; |
---|
| 499 | } |
---|
| 500 | |
---|
| 501 | if(flag == 1 && treffer == 0) |
---|
[21483] | 502 | textbox(_("Tpk Install Info"), _("No plugin found."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[16000] | 503 | } |
---|
| 504 | } |
---|
| 505 | |
---|
| 506 | #endif |
---|