#!/usr/bin/perl

# DiskDrake
# Copyright (C) 1999 MandrakeSoft (pixel@linux-mandrake.com)
#
# 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, 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.

# DiskDrake uses resize_fat which is a perl rewrite of the work of Andrew
# Clausen (libresize).
# DiskDrake is also based upon the libfdisk and the install from Red Hat Software


use lib qw(/usr/lib/libDrakX);
use common qw(:common :functional);
use diskdrake;
use interactive_gtk;
use detect_devices;
use fsedit;
use fs;
use log;
use c;

local $_ = join '', @ARGV;

/-h/ and die "usage: diskdrake [--expert] [--testing]\n";

$::expert = /-expert/;
$::testing = /-testing/;
$::isStandalone = 1;

if ($>) {
    $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}


#if ($ARGV[0] eq '-l') {
#    $@ and print "Error\n";
#    $::expert = 1;
#    print diskdrake::get_info($_, $hds->[0]) foreach fsedit::get_fstab($hds->[0]);
#    exit !$@;
#}
my $in = interactive_gtk->new;
my $hds =
    catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) }
    sub {
	my ($err) = $@ =~ /(.*) at /;
	$@ =~ /overlapping/ and $in->ask_warn('', $@), return 1;
	$in->ask_okcancel(_("Error"),
[_("I can't read your partition table, it's too corrupted for me :(
I'll try to go on blanking bad partitions"), $err]);
    };

$SIG{__DIE__} = sub { chomp (my $m = $_[0]); log::l("ERROR: $m") };
my $fstab = [ fsedit::get_fstab(@$hds) ];
 
fs::get_mntpoints_from_fstab($fstab);
fs::check_mounted($fstab);
diskdrake::main($hds, {}, $in);

$in->exit(0);
n>
<option value='topic/MDK-2006_0-update'>topic/MDK-2006_0-update</option>
<option value='topic/MDK92-branch'>topic/MDK92-branch</option>
<option value='topic/MDKC_1_0'>topic/MDKC_1_0</option>
<option value='topic/PCMCIA_CS_DISTRO'>topic/PCMCIA_CS_DISTRO</option>
<option value='topic/R9_0-64bit-branch'>topic/R9_0-64bit-branch</option>
<option value='topic/R9_1_HP-branch'>topic/R9_1_HP-branch</option>
<option value='topic/a'>topic/a</option>
<option value='topic/before_matchbox_wm'>topic/before_matchbox_wm</option>
<option value='topic/dietlibc'>topic/dietlibc</option>
<option value='topic/firewall'>topic/firewall</option>
<option value='topic/gdk-pixbuf-0-branch'>topic/gdk-pixbuf-0-branch</option>
<option value='topic/gi-ppc'>topic/gi-ppc</option>
<option value='topic/ia64-8_1'>topic/ia64-8_1</option>
<option value='topic/mandrakesoft'>topic/mandrakesoft</option>
<option value='topic/mlcd4'>topic/mlcd4</option>
<option value='topic/ppp'>topic/ppp</option>
<option value='topic/rp-pppoe'>topic/rp-pppoe</option>
<option value='topic/switching_to_urpmi'>topic/switching_to_urpmi</option>
<option value='topic/unlabeled-1.1.1'>topic/unlabeled-1.1.1</option>
<option value='topic/v_webmin_0_87'>topic/v_webmin_0_87</option>
<option value='topic/x86_64-branch'>topic/x86_64-branch</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Mageia Installer and base platform for many utilities</td><td class='sub right'>Thierry Vignaud [tv]</td></tr></table>
<table class='tabs'><tr><td>
<a href='/software/drakx-backup-do-not-use/?h=topic/MDK-10-update'>summary</a><a href='/software/drakx-backup-do-not-use/refs/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>refs</a><a href='/software/drakx-backup-do-not-use/log/?h=topic/MDK-10-update'>log</a><a href='/software/drakx-backup-do-not-use/tree/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>tree</a><a class='active' href='/software/drakx-backup-do-not-use/commit/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>commit</a><a href='/software/drakx-backup-do-not-use/diff/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>diff</a><a href='/software/drakx-backup-do-not-use/stats/?h=topic/MDK-10-update'>stats</a></td><td class='form'><form class='right' method='get' action='/software/drakx-backup-do-not-use/log/'>
<input type='hidden' name='h' value='topic/MDK-10-update'/><input type='hidden' name='id' value='21f753634113afa55eda54a495017c5eef8fc462'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='topic/MDK-10-update'/><input type='hidden' name='id' value='21f753634113afa55eda54a495017c5eef8fc462'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Pascal Rigaux &lt;pixel@mandriva.com&gt;</td><td class='right'>2000-07-20 00:28:02 +0000</td></tr>
<tr><th>committer</th><td>Pascal Rigaux &lt;pixel@mandriva.com&gt;</td><td class='right'>2000-07-20 00:28:02 +0000</td></tr>
<tr><th>commit</th><td colspan='2' class='sha1'><a href='/software/drakx-backup-do-not-use/commit/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>21f753634113afa55eda54a495017c5eef8fc462</a> (<a href='/software/drakx-backup-do-not-use/patch/?id=21f753634113afa55eda54a495017c5eef8fc462'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='sha1'><a href='/software/drakx-backup-do-not-use/tree/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462'>e017dc86e92d288b17aa7a94479af392da8940f1</a></td></tr>
<tr><th>parent</th><td colspan='2' class='sha1'><a href='/software/drakx-backup-do-not-use/commit/?h=topic/MDK-10-update&amp;id=60225ecd25a9879c5484e4d65f2e1c05388010b3'>60225ecd25a9879c5484e4d65f2e1c05388010b3</a> (<a href='/software/drakx-backup-do-not-use/diff/?h=topic/MDK-10-update&amp;id=21f753634113afa55eda54a495017c5eef8fc462&amp;id2=60225ecd25a9879c5484e4d65f2e1c05388010b3'>diff</a>)</td></tr><tr><th>download</th><td colspan='2' class='sha1'><a href='/software/drakx-backup-do-not-use/snapshot/drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar'>drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar</a><br/><a href='/software/drakx-backup-do-not-use/snapshot/drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.gz'>drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.gz</a><br/><a href='/software/drakx-backup-do-not-use/snapshot/drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.bz2'>drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.bz2</a><br/><a href='/software/drakx-backup-do-not-use/snapshot/drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.xz'>drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.tar.xz</a><br/><a href='/software/drakx-backup-do-not-use/snapshot/drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.zip'>drakx-backup-do-not-use-21f753634113afa55eda54a495017c5eef8fc462.zip</a><br/></td></tr></table>
<div class='commit-subject'>