mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +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
Origin commit data
------------------
Commit: a84a7d6083
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2010-11-06 (Sat, 06 Nov 2010)
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)
|
||||
{
|
||||
char cmd[100];
|
||||
char cmd2[100];
|
||||
CHintBox * hintbox;
|
||||
int res;
|
||||
FILE * f;
|
||||
@@ -260,7 +261,14 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||
progress->showStatusMessageUTF("Executing fdisk");
|
||||
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);
|
||||
f=popen(cmd, "w");
|
||||
if (!f) {
|
||||
@@ -271,7 +279,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||
goto _remount;
|
||||
}
|
||||
|
||||
fprintf(f, "0,\n;\n;\n;\ny\n");
|
||||
fprintf(f, "%s", cmd2);
|
||||
pclose(f);
|
||||
//sleep(1);
|
||||
|
||||
|
Reference in New Issue
Block a user