mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
hdd_menu: make it work with sfdisk and fdisk
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@886 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -219,6 +219,7 @@ static int check_and_umount(char * dev, char * path)
|
|||||||
int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||||
{
|
{
|
||||||
char cmd[100];
|
char cmd[100];
|
||||||
|
char cmd2[100];
|
||||||
CHintBox * hintbox;
|
CHintBox * hintbox;
|
||||||
int res;
|
int res;
|
||||||
FILE * f;
|
FILE * f;
|
||||||
@@ -260,7 +261,14 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
|||||||
progress->showStatusMessageUTF("Executing fdisk");
|
progress->showStatusMessageUTF("Executing fdisk");
|
||||||
progress->showGlobalStatus(0);
|
progress->showGlobalStatus(0);
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "/sbin/sfdisk -f -uM /dev/%s", key.c_str());
|
if (access("/sbin/sfdisk", X_OK) == 0) {
|
||||||
|
snprintf(cmd, sizeof(cmd), "/sbin/sfdisk -f -uM /dev/%s", key.c_str());
|
||||||
|
strcpy(cmd2, "0,\n;\n;\n;\ny\n");
|
||||||
|
} else {
|
||||||
|
snprintf(cmd, sizeof(cmd), "/sbin/fdisk /dev/%s", key.c_str());
|
||||||
|
strcpy(cmd2, "o\nn\np\n1\n\n\nw\n");
|
||||||
|
}
|
||||||
|
|
||||||
printf("CHDDFmtExec: executing %s\n", cmd);
|
printf("CHDDFmtExec: executing %s\n", cmd);
|
||||||
f=popen(cmd, "w");
|
f=popen(cmd, "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
@@ -271,7 +279,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
|||||||
goto _remount;
|
goto _remount;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "0,\n;\n;\n;\ny\n");
|
fprintf(f, "%s", cmd2);
|
||||||
pclose(f);
|
pclose(f);
|
||||||
//sleep(1);
|
//sleep(1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user