Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=setup.git;a=commitdiff;h=46598a5661e36f8ec8f2cafdbfdd756ccafa29bc

commit 46598a5661e36f8ec8f2cafdbfdd756ccafa29bc
Author: James Buren <[email protected]>
Date:   Fri Mar 9 05:04:26 2012 -0600

initial draft of checkdisk module

diff --git a/src/plugins/checkdisk.c b/src/plugins/checkdisk.c
new file mode 100644
index 0000000..7759b25
--- /dev/null
+++ b/src/plugins/checkdisk.c
@@ -0,0 +1,108 @@
+/*
+ *  skel.c for Frugalware setup
+ *
+ *  Copyright (c) 2005 by Miklos Vajna <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ */
+
+#include <stdio.h>
+#include <dialog.h>
+#include <parted/parted.h>
+
+#include <setup.h>
+#include <util.h>
+#include <string.h>
+#include <limits.h>
+#include "common.h"
+
+plugin_t plugin =
+{
+       "checkdisk",
+       desc,
+       45,
+       run,
+       NULL // dlopen handle
+};
+
+plugin_t *info()
+{
+       return &plugin;
+}
+
+char *desc()
+{
+       return _("Basic sanity checks on the hard drive the root partition is 
on.");
+}
+
+static
+int starts_on_sector_2048(const char *path)
+{
+       PedDevice *device = 0;
+       PedDisk *disk = 0;
+       PedPartition *partition;
+       int rv = 0;
+
+       device = ped_device_get(path);
+
+       if(!device)
+               goto bail;
+
+       disk = ped_disk_new(device);
+
+       if(!disk)
+               goto bail;
+
+       if(strcmp(disk->type->name,"msdos") && strcmp(disk->type->name,"gpt"))
+       {
+               rv = 1;
+               goto bail;
+       }
+
+       for( partition = ped_disk_next_partition(disk,0) ; partition && 
partition->num != 1 ; partition = ped_disk_next_partition(disk,partition) )
+               ;
+
+       if(!partition || partition->geom.start != 2048)
+               goto bail;
+
+       rv = 1;
+
+       bail:
+
+       if(disk)
+               ped_disk_destroy(disk);
+
+       if(device)
+               ped_device_destroy(device);
+
+       return rv;
+}
+
+int run(GList **config)
+{
+
+
+
+       // sample: gets the string titled "stuff" from the config list
+       //printf("%s\n", (char*)data_get(*config, "stuff"));
+
+       // sample: adds a "content" string titled "stuff" to the config list
+       //data_put(config, "stuff", "content");
+
+
+
+       return(0);
+}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to