Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bsdinstall/partedit/partedit.c
Show All 21 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <libgen.h> | |||||
#include <libutil.h> | |||||
#include <inttypes.h> | |||||
#include <errno.h> | |||||
#include <fstab.h> | |||||
#include <libgeom.h> | |||||
#include <dialog.h> | #include <dialog.h> | ||||
#include <dlg_keys.h> | #include <dlg_keys.h> | ||||
#include <errno.h> | |||||
#include <fstab.h> | |||||
#include <inttypes.h> | |||||
#include <libgeom.h> | |||||
#include <libutil.h> | |||||
#include <stdlib.h> | |||||
#include "diskeditor.h" | #include "diskeditor.h" | ||||
#include "partedit.h" | #include "partedit.h" | ||||
struct pmetadata_head part_metadata; | struct pmetadata_head part_metadata; | ||||
static int sade_mode = 0; | static int sade_mode = 0; | ||||
static int apply_changes(struct gmesh *mesh); | static int apply_changes(struct gmesh *mesh); | ||||
Show All 19 Lines | sigint_handler(int sig) | ||||
exit(1); | exit(1); | ||||
} | } | ||||
int | int | ||||
main(int argc, const char **argv) | main(int argc, const char **argv) | ||||
{ | { | ||||
struct partition_metadata *md; | struct partition_metadata *md; | ||||
const char *prompt; | const char *progname, *prompt; | ||||
struct partedit_item *items = NULL; | struct partedit_item *items = NULL; | ||||
struct gmesh mesh; | struct gmesh mesh; | ||||
int i, op, nitems, nscroll; | int i, op, nitems, nscroll; | ||||
int error; | int error; | ||||
if (strcmp(basename(argv[0]), "sade") == 0) | progname = getprogname(); | ||||
if (strcmp(progname, "sade") == 0) | |||||
sade_mode = 1; | sade_mode = 1; | ||||
TAILQ_INIT(&part_metadata); | TAILQ_INIT(&part_metadata); | ||||
init_fstab_metadata(); | init_fstab_metadata(); | ||||
init_dialog(stdin, stdout); | init_dialog(stdin, stdout); | ||||
if (!sade_mode) | if (!sade_mode) | ||||
dialog_vars.backtitle = __DECONST(char *, "FreeBSD Installer"); | dialog_vars.backtitle = __DECONST(char *, "FreeBSD Installer"); | ||||
dialog_vars.item_help = TRUE; | dialog_vars.item_help = TRUE; | ||||
nscroll = i = 0; | nscroll = i = 0; | ||||
/* Revert changes on SIGINT */ | /* Revert changes on SIGINT */ | ||||
signal(SIGINT, sigint_handler); | signal(SIGINT, sigint_handler); | ||||
if (strcmp(basename(argv[0]), "autopart") == 0) { /* Guided */ | if (strcmp(progname, "autopart") == 0) { /* Guided */ | ||||
prompt = "Please review the disk setup. When complete, press " | prompt = "Please review the disk setup. When complete, press " | ||||
"the Finish button."; | "the Finish button."; | ||||
/* Experimental ZFS autopartition support */ | /* Experimental ZFS autopartition support */ | ||||
if (argc > 1 && strcmp(argv[1], "zfs") == 0) { | if (argc > 1 && strcmp(argv[1], "zfs") == 0) { | ||||
part_wizard("zfs"); | part_wizard("zfs"); | ||||
} else { | } else { | ||||
part_wizard("ufs"); | part_wizard("ufs"); | ||||
} | } | ||||
} else if (strcmp(basename(argv[0]), "scriptedpart") == 0) { | } else if (strcmp(progname, "scriptedpart") == 0) { | ||||
error = scripted_editor(argc, argv); | error = scripted_editor(argc, argv); | ||||
prompt = NULL; | prompt = NULL; | ||||
if (error != 0) { | if (error != 0) { | ||||
end_dialog(); | end_dialog(); | ||||
return (error); | return (error); | ||||
} | } | ||||
} else { | } else { | ||||
prompt = "Create partitions for FreeBSD. No changes will be " | prompt = "Create partitions for FreeBSD. No changes will be " | ||||
▲ Show 20 Lines • Show All 449 Lines • Show Last 20 Lines |