Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   Move all kickstart functions into kickstart.c. (http://www.linux-archive.org/ubuntu-user/479054-move-all-kickstart-functions-into-kickstart-c.html)

Chris Lumens 01-20-2011 05:20 PM

Move all kickstart functions into kickstart.c.
 
Running the commands will now require operating on PyObjects, and I don't
want to expose that outside of kickstart.c.
---
loader/cdinstall.c | 6 -
loader/cdinstall.h | 2 -
loader/driverdisk.c | 75 +---------
loader/driverdisk.h | 3 +-
loader/hdinstall.c | 55 -------
loader/hdinstall.h | 2 -
loader/kbd.c | 11 --
loader/kbd.h | 2 -
loader/kickstart.c | 436 ++++++++++++++++++++++++++++++++++++++++++++++++++ +
loader/lang.c | 11 --
loader/lang.h | 3 -
loader/net.c | 166 -------------------
loader/net.h | 2 -
loader/nfsinstall.c | 45 ------
loader/nfsinstall.h | 2 -
loader/urlinstall.c | 55 -------
loader/urlinstall.h | 2 -
17 files changed, 438 insertions(+), 440 deletions(-)

diff --git a/loader/cdinstall.c b/loader/cdinstall.c
index 07afdd9..161def7 100644
--- a/loader/cdinstall.c
+++ b/loader/cdinstall.c
@@ -374,12 +374,6 @@ int loadCdromImages(struct loaderData_s *loaderData) {
return 1;
}

-void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv) {
-
- logMessage(INFO, "kickstartFromCD");
- loaderData->method = METHOD_CDROM;
-}
-
int kickstartFromCD(char *kssrc) {
int rc, i;
char *p, *kspath;
diff --git a/loader/cdinstall.h b/loader/cdinstall.h
index 8182705..6666b03 100644
--- a/loader/cdinstall.h
+++ b/loader/cdinstall.h
@@ -25,8 +25,6 @@
int findInstallCD(struct loaderData_s *loaderData);
int promptForCdrom(struct loaderData_s *loaderData);
int loadCdromImages(struct loaderData_s *loaderData);
-void setKickstartCD(struct loaderData_s * loaderData, int argc,
- char ** argv);

int kickstartFromCD(char *kssrc);
#endif
diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index 3faebb8..f78b565 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -709,80 +709,7 @@ void getDDFromSource(struct loaderData_s * loaderData, char * src, GTree *module

}

-static void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree *moduleState);
-
-void useKickstartDD(struct loaderData_s * loaderData,
- int argc, char ** argv) {
- char * dev = NULL;
- char * biospart = NULL, * p = NULL;
- gchar *fstype = NULL, *src = NULL;
- gint usebiosdev = 0;
- gchar **remaining = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksDDOptions[] = {
- /* The --type option is deprecated and now has no effect. */
- { "type", 0, 0, G_OPTION_ARG_STRING, &fstype, NULL, NULL },
- { "source", 0, 0, G_OPTION_ARG_STRING, &src, NULL, NULL },
- { "biospart", 0, 0, G_OPTION_ARG_INT, &usebiosdev, NULL, NULL },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
- NULL, NULL },
- { NULL },
- };
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksDDOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("The following invalid argument was specified for "
- "the kickstart driver disk command: %s"),
- optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- g_strfreev(remaining);
- return;
- }
-
- g_option_context_free(optCon);
-
- if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
- dev = remaining[0];
- }
-
- if (!dev && !src) {
- logMessage(ERROR, "bad arguments to kickstart driver disk command");
- return;
- }
-
- if (usebiosdev != 0) {
- p = strchr(dev,'p');
- if (!p){
- logMessage(ERROR, "Bad argument for biospart");
- return;
- }
- *p = '';
-
- biospart = getBiosDisk(dev);
- if (biospart == NULL) {
- logMessage(ERROR, "Unable to locate BIOS dev %s",dev);
- return;
- }
- dev = malloc(strlen(biospart) + strlen(p + 1) + 2);
- sprintf(dev, "%s%s", biospart, p + 1);
- }
-
- if (dev) {
- getDDFromDev(loaderData, dev, NULL);
- } else {
- getDDFromSource(loaderData, src, NULL);
- }
-
- g_strfreev(remaining);
- return;
-}
-
-static void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree* moduleState) {
+void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree* moduleState) {
if (doPwMount(dev, "/tmp/drivers", "auto", "ro", NULL)) {
logMessage(ERROR, "unable to mount driver disk %s", dev);
return;
diff --git a/loader/driverdisk.h b/loader/driverdisk.h
index 4dc8685..302a8c4 100644
--- a/loader/driverdisk.h
+++ b/loader/driverdisk.h
@@ -39,10 +39,9 @@ int loadDriverDisks(int class, struct loaderData_s *loaderData, GTree *moduleSta
int getRemovableDevices(char *** devNames);

int chooseManualDriver(int class, struct loaderData_s *loaderData);
-void useKickstartDD(struct loaderData_s * loaderData, int argc,
- char ** argv);

void getDDFromSource(struct loaderData_s * loaderData, char * src, GTree *moduleState);
+void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree *moduleState);

int loadDriverDiskFromPartition(struct loaderData_s *loaderData, char* device);

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index 39633d3..c321afb 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -325,61 +325,6 @@ int promptForHardDrive(struct loaderData_s *loaderData) {
return LOADER_OK;
}

-void setKickstartHD(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- char *p;
- gchar *biospart = NULL, *partition = NULL, *dir = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksHDOptions[] = {
- { "biospart", 0, 0, G_OPTION_ARG_STRING, &biospart, NULL, NULL },
- { "partition", 0, 0, G_OPTION_ARG_STRING, &partition, NULL, NULL },
- { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromHD");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksHDOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to HD kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (biospart) {
- char * dev;
-
- p = strchr(biospart,'p');
- if(!p){
- logMessage(ERROR, "Bad argument for --biospart");
- return;
- }
- *p = '';
- dev = getBiosDisk(biospart);
- if (dev == NULL) {
- logMessage(ERROR, "Unable to location BIOS partition %s", biospart);
- return;
- }
- partition = malloc(strlen(dev) + strlen(p + 1) + 2);
- sprintf(partition, "%s%s", dev, p + 1);
- }
-
- loaderData->method = METHOD_HD;
- checked_asprintf(&loaderData->instRepo, "hd:%s:%s", partition, dir);
-
- logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
- dir);
-}
-
int kickstartFromHD(char *kssrc) {
int rc;
char *ksdev, *kspath;
diff --git a/loader/hdinstall.h b/loader/hdinstall.h
index 80931e6..6654c45 100644
--- a/loader/hdinstall.h
+++ b/loader/hdinstall.h
@@ -22,8 +22,6 @@

#include "method.h"

-void setKickstartHD(struct loaderData_s * loaderData, int argc,
- char ** argv);
int promptForHardDrive(struct loaderData_s *loaderData);
int loadHdImages(struct loaderData_s *loaderData);
int kickstartFromHD(char *kssrc);
diff --git a/loader/kbd.c b/loader/kbd.c
index 34cb29f..c484cbd 100644
--- a/loader/kbd.c
+++ b/loader/kbd.c
@@ -150,14 +150,3 @@ int chooseKeyboard(struct loaderData_s * loaderData, char ** kbdtypep) {

return rc;
}
-
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- if (argc < 2) {
- logMessage(ERROR, "no argument passed to keyboard kickstart command");
- return;
- }
-
- loaderData->kbd = argv[1];
- loaderData->kbd_set = 1;
-}
diff --git a/loader/kbd.h b/loader/kbd.h
index 26c7111..c19018f 100644
--- a/loader/kbd.h
+++ b/loader/kbd.h
@@ -21,7 +21,5 @@
#define H_KBD

int chooseKeyboard(struct loaderData_s * loaderData, char ** kbdtypep);
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
- char ** argv);

#endif
diff --git a/loader/kickstart.c b/loader/kickstart.c
index 61fafa8..9e35a50 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -26,6 +26,7 @@
#include <Python.h>

#include <alloca.h>
+#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -52,6 +53,7 @@
#include "cdinstall.h"
#include "hdinstall.h"

+#include "../pyanaconda/isys/eddsupport.h"
#include "../pyanaconda/isys/imount.h"
#include "../pyanaconda/isys/isys.h"
#include "../pyanaconda/isys/log.h"
@@ -85,6 +87,21 @@ static void setUpdates(struct loaderData_s * loaderData, int argc,
char ** argv);
static void setVnc(struct loaderData_s * loaderData, int argc,
char ** argv);
+static void useKickstartDD(struct loaderData_s * loaderData,
+ int argc, char ** argv);
+static void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv);
+static void setKickstartHD(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+ char ** argv);

struct ksCommandNames ksTable[] = {
{ "cdrom", setKickstartCD },
@@ -580,6 +597,425 @@ static void setMediaCheck(struct loaderData_s * loaderData, int argc,
return;
}

+static void useKickstartDD(struct loaderData_s * loaderData,
+ int argc, char ** argv) {
+ char * dev = NULL;
+ char * biospart = NULL, * p = NULL;
+ gchar *fstype = NULL, *src = NULL;
+ gint usebiosdev = 0;
+ gchar **remaining = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksDDOptions[] = {
+ /* The --type option is deprecated and now has no effect. */
+ { "type", 0, 0, G_OPTION_ARG_STRING, &fstype, NULL, NULL },
+ { "source", 0, 0, G_OPTION_ARG_STRING, &src, NULL, NULL },
+ { "biospart", 0, 0, G_OPTION_ARG_INT, &usebiosdev, NULL, NULL },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
+ NULL, NULL },
+ { NULL },
+ };
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksDDOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("The following invalid argument was specified for "
+ "the kickstart driver disk command: %s"),
+ optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ g_strfreev(remaining);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
+ dev = remaining[0];
+ }
+
+ if (!dev && !src) {
+ logMessage(ERROR, "bad arguments to kickstart driver disk command");
+ return;
+ }
+
+ if (usebiosdev != 0) {
+ p = strchr(dev,'p');
+ if (!p){
+ logMessage(ERROR, "Bad argument for biospart");
+ return;
+ }
+ *p = '';
+
+ biospart = getBiosDisk(dev);
+ if (biospart == NULL) {
+ logMessage(ERROR, "Unable to locate BIOS dev %s",dev);
+ return;
+ }
+ dev = malloc(strlen(biospart) + strlen(p + 1) + 2);
+ sprintf(dev, "%s%s", biospart, p + 1);
+ }
+
+ if (dev) {
+ getDDFromDev(loaderData, dev, NULL);
+ } else {
+ getDDFromSource(loaderData, src, NULL);
+ }
+
+ g_strfreev(remaining);
+ return;
+}
+
+static void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ if (argc < 2) {
+ logMessage(ERROR, "no argument passed to keyboard kickstart command");
+ return;
+ }
+
+ loaderData->kbd = argv[1];
+ loaderData->kbd_set = 1;
+}
+
+static void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ if (argc < 2) {
+ logMessage(ERROR, "no argument passed to lang kickstart command");
+ return;
+ }
+
+ loaderData->lang = argv[1];
+ loaderData->lang_set = 1;
+}
+
+static void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ iface_t iface;
+ gchar *bootProto = NULL, *device = NULL, *class = NULL, *ethtool = NULL;
+ gchar *essid = NULL, *wepkey = NULL, *onboot = NULL, *gateway = NULL;
+ gint mtu = 1500, dhcpTimeout = -1;
+ gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ struct in_addr addr;
+#ifdef ENABLE_IPV6
+ struct in6_addr addr6;
+#endif
+ int rc;
+ GOptionEntry ksOptions[] = {
+ { "bootproto", 0, 0, G_OPTION_ARG_STRING, &bootProto, NULL, NULL },
+ { "device", 0, 0, G_OPTION_ARG_STRING, &device, NULL, NULL },
+ { "dhcpclass", 0, 0, G_OPTION_ARG_STRING, &class, NULL, NULL },
+ { "gateway", 'g', 0, G_OPTION_ARG_STRING, &gateway,
+ NULL, NULL },
+ { "ip", 'i', 0, G_OPTION_ARG_STRING, &loaderData->ipv4, NULL, NULL },
+#ifdef ENABLE_IPV6
+ { "ipv6", 0, 0, G_OPTION_ARG_STRING, &loaderData->ipv6, NULL, NULL },
+#endif
+ { "mtu", 0, 0, G_OPTION_ARG_INT, &mtu, NULL, NULL },
+ { "nameserver", 'n', 0, G_OPTION_ARG_STRING, &loaderData->dns,
+ NULL, NULL },
+ { "netmask", 'm', 0, G_OPTION_ARG_STRING, &loaderData->netmask,
+ NULL, NULL },
+ { "noipv4", 0, 0, G_OPTION_ARG_NONE, &noipv4, NULL, NULL },
+ { "noipv6", 0, 0, G_OPTION_ARG_NONE, &noipv6, NULL, NULL },
+ { "nodns", 0, 0, G_OPTION_ARG_NONE, &noDns, NULL, NULL },
+ { "hostname", 'h', 0, G_OPTION_ARG_STRING, &loaderData->hostname,
+ NULL, NULL },
+ { "ethtool", 0, 0, G_OPTION_ARG_STRING, &ethtool, NULL, NULL },
+ { "essid", 0, 0, G_OPTION_ARG_STRING, &essid, NULL, NULL },
+ { "wepkey", 0, 0, G_OPTION_ARG_STRING, &wepkey, NULL, NULL },
+ { "onboot", 0, 0, G_OPTION_ARG_STRING, &onboot, NULL, NULL },
+ { "notksdevice", 0, 0, G_OPTION_ARG_NONE, &noksdev, NULL, NULL },
+ { "dhcptimeout", 0, 0, G_OPTION_ARG_INT, &dhcpTimeout, NULL, NULL },
+ { NULL },
+ };
+
+ iface_init_iface_t(&iface);
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to kickstart network command: %s"),
+ optErr->message);
+ g_error_free(optErr);
+ }
+
+ g_option_context_free(optCon);
+
+ /* if they've specified dhcp/bootp use dhcp for the interface */
+ if (bootProto && (!strncmp(bootProto, "dhcp", 4) ||
+ !strncmp(bootProto, "bootp", 4))) {
+ loaderData->ipv4 = strdup("dhcp");
+ loaderData->ipinfo_set = 1;
+ } else if (loaderData->ipv4) {
+ /* JKFIXME: this assumes a bit... */
+ loaderData->ipinfo_set = 1;
+ }
+
+ /* now make sure the specified bootproto is valid */
+ if (bootProto && strcmp(bootProto, "dhcp") && strcmp(bootProto, "bootp") &&
+ strcmp(bootProto, "static") && strcmp(bootProto, "query")) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad bootproto %s specified in network command"),
+ bootProto);
+ }
+
+ /* --gateway is common for ipv4 and ipv6, same as in loader UI */
+ if (gateway) {
+ if ((rc = inet_pton(AF_INET, gateway, &addr)) == 1) {
+ loaderData->gateway = strdup(gateway);
+ } else if (rc == 0) {
+#ifdef ENABLE_IPV6
+ if ((rc = inet_pton(AF_INET6, gateway, &addr6)) == 1) {
+ loaderData->gateway6 = strdup(gateway);
+ } else if (rc == 0) {
+#endif
+ logMessage(WARNING,
+ "invalid address in kickstart --gateway");
+#ifdef ENABLE_IPV6
+ } else {
+ logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
+ strerror(errno));
+ }
+#endif
+ } else {
+ logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
+ strerror(errno));
+ }
+ }
+
+ if (!noksdev) {
+ if (device) {
+ /* If --device=MAC was given, translate into a device name now. */
+ if (index(device, ':') != NULL)
+ loaderData->netDev = iface_mac2device(device);
+ else
+ loaderData->netDev = strdup(device);
+
+ loaderData->netDev_set = 1;
+ }
+
+ if (class) {
+ loaderData->netCls = strdup(class);
+ loaderData->netCls_set = 1;
+ }
+
+ if (ethtool) {
+ if (loaderData->ethtool)
+ free(loaderData->ethtool);
+ loaderData->ethtool = strdup(ethtool);
+ free(ethtool);
+ }
+
+ if (essid) {
+ if (loaderData->essid)
+ free(loaderData->essid);
+ loaderData->essid = strdup(essid);
+ free(essid);
+ }
+
+ if (wepkey) {
+ if (loaderData->wepkey)
+ free(loaderData->wepkey);
+ loaderData->wepkey = strdup(wepkey);
+ free(wepkey);
+ }
+
+ if (mtu) {
+ loaderData->mtu = mtu;
+ }
+
+ if (noipv4)
+ flags |= LOADER_FLAGS_NOIPV4;
+
+#ifdef ENABLE_IPV6
+ if (noipv6)
+ flags |= LOADER_FLAGS_NOIPV6;
+
+ if (loaderData->ipv6) {
+ loaderData->ipv6info_set = 1;
+ }
+#endif
+ }
+
+ if (noDns) {
+ loaderData->noDns = 1;
+ }
+
+ /* Make sure the network is always up if there's a network line in the
+ * kickstart file, as %post/%pre scripts might require that.
+ */
+ if (loaderData->method != METHOD_NFS && loaderData->method != METHOD_URL) {
+ if (kickstartNetworkUp(loaderData, &iface))
+ logMessage(ERROR, "unable to bring up network");
+ }
+}
+
+static void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv) {
+ logMessage(INFO, "kickstartFromCD");
+ loaderData->method = METHOD_CDROM;
+}
+
+static void setKickstartHD(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ char *p;
+ gchar *biospart = NULL, *partition = NULL, *dir = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksHDOptions[] = {
+ { "biospart", 0, 0, G_OPTION_ARG_STRING, &biospart, NULL, NULL },
+ { "partition", 0, 0, G_OPTION_ARG_STRING, &partition, NULL, NULL },
+ { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromHD");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksHDOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to HD kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (biospart) {
+ char * dev;
+
+ p = strchr(biospart,'p');
+ if(!p){
+ logMessage(ERROR, "Bad argument for --biospart");
+ return;
+ }
+ *p = '';
+ dev = getBiosDisk(biospart);
+ if (dev == NULL) {
+ logMessage(ERROR, "Unable to location BIOS partition %s", biospart);
+ return;
+ }
+ partition = malloc(strlen(dev) + strlen(p + 1) + 2);
+ sprintf(partition, "%s%s", dev, p + 1);
+ }
+
+ loaderData->method = METHOD_HD;
+ checked_asprintf(&loaderData->instRepo, "hd:%s:%s", partition, dir);
+
+ logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
+ dir);
+}
+
+static void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ gchar *host = NULL, *dir = NULL, *mountOpts = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksNfsOptions[] = {
+ { "server", 0, 0, G_OPTION_ARG_STRING, &host, NULL, NULL },
+ { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
+ { "opts", 0, 0, G_OPTION_ARG_STRING, &mountOpts, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromNfs");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksNfsOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to NFS kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (!host || !dir) {
+ logMessage(ERROR, "host and directory for nfs kickstart not specified");
+ return;
+ }
+
+ logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
+ host, dir, mountOpts);
+
+ loaderData->method = METHOD_NFS;
+ if (mountOpts) {
+ checked_asprintf(&loaderData->instRepo, "nfs:%s:%s:%s", host, mountOpts, dir);
+ } else {
+ checked_asprintf(&loaderData->instRepo, "nfs:%s:%s", host, dir);
+ }
+}
+
+static void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ gchar *url = NULL, *proxy = NULL;
+ gboolean noverifyssl = FALSE;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksUrlOptions[] = {
+ { "url", 0, 0, G_OPTION_ARG_STRING, &url, NULL, NULL },
+ { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, NULL, NULL },
+ { "noverifyssl", 0, 0, G_OPTION_ARG_NONE, &noverifyssl, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromUrl");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksUrlOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to URL kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (!url) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Must supply a --url argument to Url kickstart method."));
+ return;
+ }
+
+ /* determine install type */
+ if (strncmp(url, "http", 4) && strncmp(url, "ftp://", 6)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Unknown Url method %s"), url);
+ return;
+ }
+
+ loaderData->instRepo = strdup(url);
+ loaderData->instRepo_noverifyssl = noverifyssl;
+ loaderData->method = METHOD_URL;
+
+ if (proxy) {
+ splitProxyParam(proxy, &loaderData->proxyUser,
+ &loaderData->proxyPassword,
+ &loaderData->proxy);
+ }
+ logMessage(INFO, "results of url ks, url %s", url);
+}
+
int runKickstart(struct loaderData_s * loaderData, const char *file) {
PyObject *versionMod, *parserMod = NULL;
PyObject *handler, *parser;
diff --git a/loader/lang.c b/loader/lang.c
index 4f230dc..a84c2ec 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -380,14 +380,3 @@ int chooseLanguage(char ** lang) {

return setupLanguage(choice, 0);
}
-
-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- if (argc < 2) {
- logMessage(ERROR, "no argument passed to lang kickstart command");
- return;
- }
-
- loaderData->lang = argv[1];
- loaderData->lang_set = 1;
-}
diff --git a/loader/lang.h b/loader/lang.h
index 965f5a0..d4b61dd 100644
--- a/loader/lang.h
+++ b/loader/lang.h
@@ -35,7 +35,4 @@ char * translateString(char * str);
int setLanguage (char * key, int forced);
int getLangInfo(struct langInfo **langs);

-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
- char ** argv);
-
#endif /* _LANG_H_ */
diff --git a/loader/net.c b/loader/net.c
index b0d6f46..22ed892 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1603,172 +1603,6 @@ int writeEnabledNetInfo(iface_t *iface) {
return 0;
}

-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- iface_t iface;
- gchar *bootProto = NULL, *device = NULL, *class = NULL, *ethtool = NULL;
- gchar *essid = NULL, *wepkey = NULL, *onboot = NULL, *gateway = NULL;
- gint mtu = 1500, dhcpTimeout = -1;
- gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- struct in_addr addr;
-#ifdef ENABLE_IPV6
- struct in6_addr addr6;
-#endif
- int rc;
- GOptionEntry ksOptions[] = {
- { "bootproto", 0, 0, G_OPTION_ARG_STRING, &bootProto, NULL, NULL },
- { "device", 0, 0, G_OPTION_ARG_STRING, &device, NULL, NULL },
- { "dhcpclass", 0, 0, G_OPTION_ARG_STRING, &class, NULL, NULL },
- { "gateway", 'g', 0, G_OPTION_ARG_STRING, &gateway,
- NULL, NULL },
- { "ip", 'i', 0, G_OPTION_ARG_STRING, &loaderData->ipv4, NULL, NULL },
-#ifdef ENABLE_IPV6
- { "ipv6", 0, 0, G_OPTION_ARG_STRING, &loaderData->ipv6, NULL, NULL },
-#endif
- { "mtu", 0, 0, G_OPTION_ARG_INT, &mtu, NULL, NULL },
- { "nameserver", 'n', 0, G_OPTION_ARG_STRING, &loaderData->dns,
- NULL, NULL },
- { "netmask", 'm', 0, G_OPTION_ARG_STRING, &loaderData->netmask,
- NULL, NULL },
- { "noipv4", 0, 0, G_OPTION_ARG_NONE, &noipv4, NULL, NULL },
- { "noipv6", 0, 0, G_OPTION_ARG_NONE, &noipv6, NULL, NULL },
- { "nodns", 0, 0, G_OPTION_ARG_NONE, &noDns, NULL, NULL },
- { "hostname", 'h', 0, G_OPTION_ARG_STRING, &loaderData->hostname,
- NULL, NULL },
- { "ethtool", 0, 0, G_OPTION_ARG_STRING, &ethtool, NULL, NULL },
- { "essid", 0, 0, G_OPTION_ARG_STRING, &essid, NULL, NULL },
- { "wepkey", 0, 0, G_OPTION_ARG_STRING, &wepkey, NULL, NULL },
- { "onboot", 0, 0, G_OPTION_ARG_STRING, &onboot, NULL, NULL },
- { "notksdevice", 0, 0, G_OPTION_ARG_NONE, &noksdev, NULL, NULL },
- { "dhcptimeout", 0, 0, G_OPTION_ARG_INT, &dhcpTimeout, NULL, NULL },
- { NULL },
- };
-
- iface_init_iface_t(&iface);
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to kickstart network command: %s"),
- optErr->message);
- g_error_free(optErr);
- }
-
- g_option_context_free(optCon);
-
- /* if they've specified dhcp/bootp use dhcp for the interface */
- if (bootProto && (!strncmp(bootProto, "dhcp", 4) ||
- !strncmp(bootProto, "bootp", 4))) {
- loaderData->ipv4 = strdup("dhcp");
- loaderData->ipinfo_set = 1;
- } else if (loaderData->ipv4) {
- /* JKFIXME: this assumes a bit... */
- loaderData->ipinfo_set = 1;
- }
-
- /* now make sure the specified bootproto is valid */
- if (bootProto && strcmp(bootProto, "dhcp") && strcmp(bootProto, "bootp") &&
- strcmp(bootProto, "static") && strcmp(bootProto, "query")) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad bootproto %s specified in network command"),
- bootProto);
- }
-
- /* --gateway is common for ipv4 and ipv6, same as in loader UI */
- if (gateway) {
- if ((rc = inet_pton(AF_INET, gateway, &addr)) == 1) {
- loaderData->gateway = strdup(gateway);
- } else if (rc == 0) {
-#ifdef ENABLE_IPV6
- if ((rc = inet_pton(AF_INET6, gateway, &addr6)) == 1) {
- loaderData->gateway6 = strdup(gateway);
- } else if (rc == 0) {
-#endif
- logMessage(WARNING,
- "invalid address in kickstart --gateway");
-#ifdef ENABLE_IPV6
- } else {
- logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
- strerror(errno));
- }
-#endif
- } else {
- logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
- strerror(errno));
- }
- }
-
- if (!noksdev) {
- if (device) {
- /* If --device=MAC was given, translate into a device name now. */
- if (index(device, ':') != NULL)
- loaderData->netDev = iface_mac2device(device);
- else
- loaderData->netDev = strdup(device);
-
- loaderData->netDev_set = 1;
- }
-
- if (class) {
- loaderData->netCls = strdup(class);
- loaderData->netCls_set = 1;
- }
-
- if (ethtool) {
- if (loaderData->ethtool)
- free(loaderData->ethtool);
- loaderData->ethtool = strdup(ethtool);
- free(ethtool);
- }
-
- if (essid) {
- if (loaderData->essid)
- free(loaderData->essid);
- loaderData->essid = strdup(essid);
- free(essid);
- }
-
- if (wepkey) {
- if (loaderData->wepkey)
- free(loaderData->wepkey);
- loaderData->wepkey = strdup(wepkey);
- free(wepkey);
- }
-
- if (mtu) {
- loaderData->mtu = mtu;
- }
-
- if (noipv4)
- flags |= LOADER_FLAGS_NOIPV4;
-
-#ifdef ENABLE_IPV6
- if (noipv6)
- flags |= LOADER_FLAGS_NOIPV6;
-
- if (loaderData->ipv6) {
- loaderData->ipv6info_set = 1;
- }
-#endif
- }
-
- if (noDns) {
- loaderData->noDns = 1;
- }
-
- /* Make sure the network is always up if there's a network line in the
- * kickstart file, as %post/%pre scripts might require that.
- */
- if (loaderData->method != METHOD_NFS && loaderData->method != METHOD_URL) {
- if (kickstartNetworkUp(loaderData, &iface))
- logMessage(ERROR, "unable to bring up network");
- }
-}
-
/* if multiple interfaces get one to use from user. */
/* NOTE - uses kickstart data available in loaderData */
int chooseNetworkInterface(struct loaderData_s * loaderData) {
diff --git a/loader/net.h b/loader/net.h
index a6a4ec5..96c1ffb 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -69,8 +69,6 @@ int writeEnabledNetInfo(iface_t * iface);
int chooseNetworkInterface(struct loaderData_s * loaderData);
void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData);
int setupWireless(iface_t * iface);
-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartNetworkUp(struct loaderData_s * loaderData,
iface_t * iface);
void splitHostname (char *str, char **host, char **port);
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 7ce0433..ee0465d 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -254,51 +254,6 @@ int loadNfsImages(struct loaderData_s *loaderData) {
return 1;
}

-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- gchar *host = NULL, *dir = NULL, *mountOpts = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksNfsOptions[] = {
- { "server", 0, 0, G_OPTION_ARG_STRING, &host, NULL, NULL },
- { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
- { "opts", 0, 0, G_OPTION_ARG_STRING, &mountOpts, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromNfs");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksNfsOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to NFS kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (!host || !dir) {
- logMessage(ERROR, "host and directory for nfs kickstart not specified");
- return;
- }
-
- logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
- host, dir, mountOpts);
-
- loaderData->method = METHOD_NFS;
- if (mountOpts) {
- checked_asprintf(&loaderData->instRepo, "nfs:%s:%s:%s", host, mountOpts, dir);
- } else {
- checked_asprintf(&loaderData->instRepo, "nfs:%s:%s", host, dir);
- }
-}
-
int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) {
char * host = NULL, *path = NULL, * file = NULL, * opts = NULL;
char * chk = NULL, *ip = NULL;
diff --git a/loader/nfsinstall.h b/loader/nfsinstall.h
index f2865ad..ace38b1 100644
--- a/loader/nfsinstall.h
+++ b/loader/nfsinstall.h
@@ -22,8 +22,6 @@

#include "method.h"

-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartFromNfs(char * url, struct loaderData_s * loaderData);
int promptForNfs(struct loaderData_s *loaderData);
int loadNfsImages(struct loaderData_s *loaderData);
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 80285cd..d20748e 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -256,59 +256,4 @@ int kickstartFromUrl(char * url, struct loaderData_s * loaderData) {
return getFileFromUrl(url, "/tmp/ks.cfg", loaderData);
}

-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- gchar *url = NULL, *proxy = NULL;
- gboolean noverifyssl = FALSE;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksUrlOptions[] = {
- { "url", 0, 0, G_OPTION_ARG_STRING, &url, NULL, NULL },
- { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, NULL, NULL },
- { "noverifyssl", 0, 0, G_OPTION_ARG_NONE, &noverifyssl, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromUrl");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksUrlOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to URL kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (!url) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Must supply a --url argument to Url kickstart method."));
- return;
- }
-
- /* determine install type */
- if (strncmp(url, "http", 4) && strncmp(url, "ftp://", 6)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Unknown Url method %s"), url);
- return;
- }
-
- loaderData->instRepo = strdup(url);
- loaderData->instRepo_noverifyssl = noverifyssl;
- loaderData->method = METHOD_URL;
-
- if (proxy) {
- splitProxyParam(proxy, &loaderData->proxyUser,
- &loaderData->proxyPassword,
- &loaderData->proxy);
- }
- logMessage(INFO, "results of url ks, url %s", url);
-}
-
/* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/loader/urlinstall.h b/loader/urlinstall.h
index 432d3f7..ba83b75 100644
--- a/loader/urlinstall.h
+++ b/loader/urlinstall.h
@@ -23,8 +23,6 @@
#include "method.h"
#include "urls.h"

-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartFromUrl(char * url, struct loaderData_s * loaderData);
int getFileFromUrl(char * url, char * dest, struct loaderData_s * loaderData);
int promptForUrl(struct loaderData_s *loaderData);
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

David Cantrell 01-24-2011 11:41 PM

Move all kickstart functions into kickstart.c.
 
Ack. Nice to have this centralized.

On Thu, 20 Jan 2011, Chris Lumens wrote:


Running the commands will now require operating on PyObjects, and I don't
want to expose that outside of kickstart.c.
---
loader/cdinstall.c | 6 -
loader/cdinstall.h | 2 -
loader/driverdisk.c | 75 +---------
loader/driverdisk.h | 3 +-
loader/hdinstall.c | 55 -------
loader/hdinstall.h | 2 -
loader/kbd.c | 11 --
loader/kbd.h | 2 -
loader/kickstart.c | 436 ++++++++++++++++++++++++++++++++++++++++++++++++++ +
loader/lang.c | 11 --
loader/lang.h | 3 -
loader/net.c | 166 -------------------
loader/net.h | 2 -
loader/nfsinstall.c | 45 ------
loader/nfsinstall.h | 2 -
loader/urlinstall.c | 55 -------
loader/urlinstall.h | 2 -
17 files changed, 438 insertions(+), 440 deletions(-)

diff --git a/loader/cdinstall.c b/loader/cdinstall.c
index 07afdd9..161def7 100644
--- a/loader/cdinstall.c
+++ b/loader/cdinstall.c
@@ -374,12 +374,6 @@ int loadCdromImages(struct loaderData_s *loaderData) {
return 1;
}

-void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv) {
-
- logMessage(INFO, "kickstartFromCD");
- loaderData->method = METHOD_CDROM;
-}
-
int kickstartFromCD(char *kssrc) {
int rc, i;
char *p, *kspath;
diff --git a/loader/cdinstall.h b/loader/cdinstall.h
index 8182705..6666b03 100644
--- a/loader/cdinstall.h
+++ b/loader/cdinstall.h
@@ -25,8 +25,6 @@
int findInstallCD(struct loaderData_s *loaderData);
int promptForCdrom(struct loaderData_s *loaderData);
int loadCdromImages(struct loaderData_s *loaderData);
-void setKickstartCD(struct loaderData_s * loaderData, int argc,
- char ** argv);

int kickstartFromCD(char *kssrc);
#endif
diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index 3faebb8..f78b565 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -709,80 +709,7 @@ void getDDFromSource(struct loaderData_s * loaderData, char * src, GTree *module

}

-static void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree *moduleState);
-
-void useKickstartDD(struct loaderData_s * loaderData,
- int argc, char ** argv) {
- char * dev = NULL;
- char * biospart = NULL, * p = NULL;
- gchar *fstype = NULL, *src = NULL;
- gint usebiosdev = 0;
- gchar **remaining = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksDDOptions[] = {
- /* The --type option is deprecated and now has no effect. */
- { "type", 0, 0, G_OPTION_ARG_STRING, &fstype, NULL, NULL },
- { "source", 0, 0, G_OPTION_ARG_STRING, &src, NULL, NULL },
- { "biospart", 0, 0, G_OPTION_ARG_INT, &usebiosdev, NULL, NULL },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
- NULL, NULL },
- { NULL },
- };
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksDDOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("The following invalid argument was specified for "
- "the kickstart driver disk command: %s"),
- optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- g_strfreev(remaining);
- return;
- }
-
- g_option_context_free(optCon);
-
- if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
- dev = remaining[0];
- }
-
- if (!dev && !src) {
- logMessage(ERROR, "bad arguments to kickstart driver disk command");
- return;
- }
-
- if (usebiosdev != 0) {
- p = strchr(dev,'p');
- if (!p){
- logMessage(ERROR, "Bad argument for biospart");
- return;
- }
- *p = '';
-
- biospart = getBiosDisk(dev);
- if (biospart == NULL) {
- logMessage(ERROR, "Unable to locate BIOS dev %s",dev);
- return;
- }
- dev = malloc(strlen(biospart) + strlen(p + 1) + 2);
- sprintf(dev, "%s%s", biospart, p + 1);
- }
-
- if (dev) {
- getDDFromDev(loaderData, dev, NULL);
- } else {
- getDDFromSource(loaderData, src, NULL);
- }
-
- g_strfreev(remaining);
- return;
-}
-
-static void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree* moduleState) {
+void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree* moduleState) {
if (doPwMount(dev, "/tmp/drivers", "auto", "ro", NULL)) {
logMessage(ERROR, "unable to mount driver disk %s", dev);
return;
diff --git a/loader/driverdisk.h b/loader/driverdisk.h
index 4dc8685..302a8c4 100644
--- a/loader/driverdisk.h
+++ b/loader/driverdisk.h
@@ -39,10 +39,9 @@ int loadDriverDisks(int class, struct loaderData_s *loaderData, GTree *moduleSta
int getRemovableDevices(char *** devNames);

int chooseManualDriver(int class, struct loaderData_s *loaderData);
-void useKickstartDD(struct loaderData_s * loaderData, int argc,
- char ** argv);

void getDDFromSource(struct loaderData_s * loaderData, char * src, GTree *moduleState);
+void getDDFromDev(struct loaderData_s * loaderData, char * dev, GTree *moduleState);

int loadDriverDiskFromPartition(struct loaderData_s *loaderData, char* device);

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index 39633d3..c321afb 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -325,61 +325,6 @@ int promptForHardDrive(struct loaderData_s *loaderData) {
return LOADER_OK;
}

-void setKickstartHD(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- char *p;
- gchar *biospart = NULL, *partition = NULL, *dir = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksHDOptions[] = {
- { "biospart", 0, 0, G_OPTION_ARG_STRING, &biospart, NULL, NULL },
- { "partition", 0, 0, G_OPTION_ARG_STRING, &partition, NULL, NULL },
- { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromHD");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksHDOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to HD kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (biospart) {
- char * dev;
-
- p = strchr(biospart,'p');
- if(!p){
- logMessage(ERROR, "Bad argument for --biospart");
- return;
- }
- *p = '';
- dev = getBiosDisk(biospart);
- if (dev == NULL) {
- logMessage(ERROR, "Unable to location BIOS partition %s", biospart);
- return;
- }
- partition = malloc(strlen(dev) + strlen(p + 1) + 2);
- sprintf(partition, "%s%s", dev, p + 1);
- }
-
- loaderData->method = METHOD_HD;
- checked_asprintf(&loaderData->instRepo, "hd:%s:%s", partition, dir);
-
- logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
- dir);
-}
-
int kickstartFromHD(char *kssrc) {
int rc;
char *ksdev, *kspath;
diff --git a/loader/hdinstall.h b/loader/hdinstall.h
index 80931e6..6654c45 100644
--- a/loader/hdinstall.h
+++ b/loader/hdinstall.h
@@ -22,8 +22,6 @@

#include "method.h"

-void setKickstartHD(struct loaderData_s * loaderData, int argc,
- char ** argv);
int promptForHardDrive(struct loaderData_s *loaderData);
int loadHdImages(struct loaderData_s *loaderData);
int kickstartFromHD(char *kssrc);
diff --git a/loader/kbd.c b/loader/kbd.c
index 34cb29f..c484cbd 100644
--- a/loader/kbd.c
+++ b/loader/kbd.c
@@ -150,14 +150,3 @@ int chooseKeyboard(struct loaderData_s * loaderData, char ** kbdtypep) {

return rc;
}
-
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- if (argc < 2) {
- logMessage(ERROR, "no argument passed to keyboard kickstart command");
- return;
- }
-
- loaderData->kbd = argv[1];
- loaderData->kbd_set = 1;
-}
diff --git a/loader/kbd.h b/loader/kbd.h
index 26c7111..c19018f 100644
--- a/loader/kbd.h
+++ b/loader/kbd.h
@@ -21,7 +21,5 @@
#define H_KBD

int chooseKeyboard(struct loaderData_s * loaderData, char ** kbdtypep);
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
- char ** argv);

#endif
diff --git a/loader/kickstart.c b/loader/kickstart.c
index 61fafa8..9e35a50 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -26,6 +26,7 @@
#include <Python.h>

#include <alloca.h>
+#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -52,6 +53,7 @@
#include "cdinstall.h"
#include "hdinstall.h"

+#include "../pyanaconda/isys/eddsupport.h"
#include "../pyanaconda/isys/imount.h"
#include "../pyanaconda/isys/isys.h"
#include "../pyanaconda/isys/log.h"
@@ -85,6 +87,21 @@ static void setUpdates(struct loaderData_s * loaderData, int argc,
char ** argv);
static void setVnc(struct loaderData_s * loaderData, int argc,
char ** argv);
+static void useKickstartDD(struct loaderData_s * loaderData,
+ int argc, char ** argv);
+static void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv);
+static void setKickstartHD(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+ char ** argv);
+static void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+ char ** argv);

struct ksCommandNames ksTable[] = {
{ "cdrom", setKickstartCD },
@@ -580,6 +597,425 @@ static void setMediaCheck(struct loaderData_s * loaderData, int argc,
return;
}

+static void useKickstartDD(struct loaderData_s * loaderData,
+ int argc, char ** argv) {
+ char * dev = NULL;
+ char * biospart = NULL, * p = NULL;
+ gchar *fstype = NULL, *src = NULL;
+ gint usebiosdev = 0;
+ gchar **remaining = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksDDOptions[] = {
+ /* The --type option is deprecated and now has no effect. */
+ { "type", 0, 0, G_OPTION_ARG_STRING, &fstype, NULL, NULL },
+ { "source", 0, 0, G_OPTION_ARG_STRING, &src, NULL, NULL },
+ { "biospart", 0, 0, G_OPTION_ARG_INT, &usebiosdev, NULL, NULL },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
+ NULL, NULL },
+ { NULL },
+ };
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksDDOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("The following invalid argument was specified for "
+ "the kickstart driver disk command: %s"),
+ optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ g_strfreev(remaining);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
+ dev = remaining[0];
+ }
+
+ if (!dev && !src) {
+ logMessage(ERROR, "bad arguments to kickstart driver disk command");
+ return;
+ }
+
+ if (usebiosdev != 0) {
+ p = strchr(dev,'p');
+ if (!p){
+ logMessage(ERROR, "Bad argument for biospart");
+ return;
+ }
+ *p = '';
+
+ biospart = getBiosDisk(dev);
+ if (biospart == NULL) {
+ logMessage(ERROR, "Unable to locate BIOS dev %s",dev);
+ return;
+ }
+ dev = malloc(strlen(biospart) + strlen(p + 1) + 2);
+ sprintf(dev, "%s%s", biospart, p + 1);
+ }
+
+ if (dev) {
+ getDDFromDev(loaderData, dev, NULL);
+ } else {
+ getDDFromSource(loaderData, src, NULL);
+ }
+
+ g_strfreev(remaining);
+ return;
+}
+
+static void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ if (argc < 2) {
+ logMessage(ERROR, "no argument passed to keyboard kickstart command");
+ return;
+ }
+
+ loaderData->kbd = argv[1];
+ loaderData->kbd_set = 1;
+}
+
+static void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ if (argc < 2) {
+ logMessage(ERROR, "no argument passed to lang kickstart command");
+ return;
+ }
+
+ loaderData->lang = argv[1];
+ loaderData->lang_set = 1;
+}
+
+static void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ iface_t iface;
+ gchar *bootProto = NULL, *device = NULL, *class = NULL, *ethtool = NULL;
+ gchar *essid = NULL, *wepkey = NULL, *onboot = NULL, *gateway = NULL;
+ gint mtu = 1500, dhcpTimeout = -1;
+ gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ struct in_addr addr;
+#ifdef ENABLE_IPV6
+ struct in6_addr addr6;
+#endif
+ int rc;
+ GOptionEntry ksOptions[] = {
+ { "bootproto", 0, 0, G_OPTION_ARG_STRING, &bootProto, NULL, NULL },
+ { "device", 0, 0, G_OPTION_ARG_STRING, &device, NULL, NULL },
+ { "dhcpclass", 0, 0, G_OPTION_ARG_STRING, &class, NULL, NULL },
+ { "gateway", 'g', 0, G_OPTION_ARG_STRING, &gateway,
+ NULL, NULL },
+ { "ip", 'i', 0, G_OPTION_ARG_STRING, &loaderData->ipv4, NULL, NULL },
+#ifdef ENABLE_IPV6
+ { "ipv6", 0, 0, G_OPTION_ARG_STRING, &loaderData->ipv6, NULL, NULL },
+#endif
+ { "mtu", 0, 0, G_OPTION_ARG_INT, &mtu, NULL, NULL },
+ { "nameserver", 'n', 0, G_OPTION_ARG_STRING, &loaderData->dns,
+ NULL, NULL },
+ { "netmask", 'm', 0, G_OPTION_ARG_STRING, &loaderData->netmask,
+ NULL, NULL },
+ { "noipv4", 0, 0, G_OPTION_ARG_NONE, &noipv4, NULL, NULL },
+ { "noipv6", 0, 0, G_OPTION_ARG_NONE, &noipv6, NULL, NULL },
+ { "nodns", 0, 0, G_OPTION_ARG_NONE, &noDns, NULL, NULL },
+ { "hostname", 'h', 0, G_OPTION_ARG_STRING, &loaderData->hostname,
+ NULL, NULL },
+ { "ethtool", 0, 0, G_OPTION_ARG_STRING, &ethtool, NULL, NULL },
+ { "essid", 0, 0, G_OPTION_ARG_STRING, &essid, NULL, NULL },
+ { "wepkey", 0, 0, G_OPTION_ARG_STRING, &wepkey, NULL, NULL },
+ { "onboot", 0, 0, G_OPTION_ARG_STRING, &onboot, NULL, NULL },
+ { "notksdevice", 0, 0, G_OPTION_ARG_NONE, &noksdev, NULL, NULL },
+ { "dhcptimeout", 0, 0, G_OPTION_ARG_INT, &dhcpTimeout, NULL, NULL },
+ { NULL },
+ };
+
+ iface_init_iface_t(&iface);
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to kickstart network command: %s"),
+ optErr->message);
+ g_error_free(optErr);
+ }
+
+ g_option_context_free(optCon);
+
+ /* if they've specified dhcp/bootp use dhcp for the interface */
+ if (bootProto && (!strncmp(bootProto, "dhcp", 4) ||
+ !strncmp(bootProto, "bootp", 4))) {
+ loaderData->ipv4 = strdup("dhcp");
+ loaderData->ipinfo_set = 1;
+ } else if (loaderData->ipv4) {
+ /* JKFIXME: this assumes a bit... */
+ loaderData->ipinfo_set = 1;
+ }
+
+ /* now make sure the specified bootproto is valid */
+ if (bootProto && strcmp(bootProto, "dhcp") && strcmp(bootProto, "bootp") &&
+ strcmp(bootProto, "static") && strcmp(bootProto, "query")) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad bootproto %s specified in network command"),
+ bootProto);
+ }
+
+ /* --gateway is common for ipv4 and ipv6, same as in loader UI */
+ if (gateway) {
+ if ((rc = inet_pton(AF_INET, gateway, &addr)) == 1) {
+ loaderData->gateway = strdup(gateway);
+ } else if (rc == 0) {
+#ifdef ENABLE_IPV6
+ if ((rc = inet_pton(AF_INET6, gateway, &addr6)) == 1) {
+ loaderData->gateway6 = strdup(gateway);
+ } else if (rc == 0) {
+#endif
+ logMessage(WARNING,
+ "invalid address in kickstart --gateway");
+#ifdef ENABLE_IPV6
+ } else {
+ logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
+ strerror(errno));
+ }
+#endif
+ } else {
+ logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
+ strerror(errno));
+ }
+ }
+
+ if (!noksdev) {
+ if (device) {
+ /* If --device=MAC was given, translate into a device name now. */
+ if (index(device, ':') != NULL)
+ loaderData->netDev = iface_mac2device(device);
+ else
+ loaderData->netDev = strdup(device);
+
+ loaderData->netDev_set = 1;
+ }
+
+ if (class) {
+ loaderData->netCls = strdup(class);
+ loaderData->netCls_set = 1;
+ }
+
+ if (ethtool) {
+ if (loaderData->ethtool)
+ free(loaderData->ethtool);
+ loaderData->ethtool = strdup(ethtool);
+ free(ethtool);
+ }
+
+ if (essid) {
+ if (loaderData->essid)
+ free(loaderData->essid);
+ loaderData->essid = strdup(essid);
+ free(essid);
+ }
+
+ if (wepkey) {
+ if (loaderData->wepkey)
+ free(loaderData->wepkey);
+ loaderData->wepkey = strdup(wepkey);
+ free(wepkey);
+ }
+
+ if (mtu) {
+ loaderData->mtu = mtu;
+ }
+
+ if (noipv4)
+ flags |= LOADER_FLAGS_NOIPV4;
+
+#ifdef ENABLE_IPV6
+ if (noipv6)
+ flags |= LOADER_FLAGS_NOIPV6;
+
+ if (loaderData->ipv6) {
+ loaderData->ipv6info_set = 1;
+ }
+#endif
+ }
+
+ if (noDns) {
+ loaderData->noDns = 1;
+ }
+
+ /* Make sure the network is always up if there's a network line in the
+ * kickstart file, as %post/%pre scripts might require that.
+ */
+ if (loaderData->method != METHOD_NFS && loaderData->method != METHOD_URL) {
+ if (kickstartNetworkUp(loaderData, &iface))
+ logMessage(ERROR, "unable to bring up network");
+ }
+}
+
+static void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv) {
+ logMessage(INFO, "kickstartFromCD");
+ loaderData->method = METHOD_CDROM;
+}
+
+static void setKickstartHD(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ char *p;
+ gchar *biospart = NULL, *partition = NULL, *dir = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksHDOptions[] = {
+ { "biospart", 0, 0, G_OPTION_ARG_STRING, &biospart, NULL, NULL },
+ { "partition", 0, 0, G_OPTION_ARG_STRING, &partition, NULL, NULL },
+ { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromHD");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksHDOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to HD kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (biospart) {
+ char * dev;
+
+ p = strchr(biospart,'p');
+ if(!p){
+ logMessage(ERROR, "Bad argument for --biospart");
+ return;
+ }
+ *p = '';
+ dev = getBiosDisk(biospart);
+ if (dev == NULL) {
+ logMessage(ERROR, "Unable to location BIOS partition %s", biospart);
+ return;
+ }
+ partition = malloc(strlen(dev) + strlen(p + 1) + 2);
+ sprintf(partition, "%s%s", dev, p + 1);
+ }
+
+ loaderData->method = METHOD_HD;
+ checked_asprintf(&loaderData->instRepo, "hd:%s:%s", partition, dir);
+
+ logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
+ dir);
+}
+
+static void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ gchar *host = NULL, *dir = NULL, *mountOpts = NULL;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksNfsOptions[] = {
+ { "server", 0, 0, G_OPTION_ARG_STRING, &host, NULL, NULL },
+ { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
+ { "opts", 0, 0, G_OPTION_ARG_STRING, &mountOpts, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromNfs");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksNfsOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to NFS kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (!host || !dir) {
+ logMessage(ERROR, "host and directory for nfs kickstart not specified");
+ return;
+ }
+
+ logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
+ host, dir, mountOpts);
+
+ loaderData->method = METHOD_NFS;
+ if (mountOpts) {
+ checked_asprintf(&loaderData->instRepo, "nfs:%s:%s:%s", host, mountOpts, dir);
+ } else {
+ checked_asprintf(&loaderData->instRepo, "nfs:%s:%s", host, dir);
+ }
+}
+
+static void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+ char ** argv) {
+ gchar *url = NULL, *proxy = NULL;
+ gboolean noverifyssl = FALSE;
+ GOptionContext *optCon = g_option_context_new(NULL);
+ GError *optErr = NULL;
+ GOptionEntry ksUrlOptions[] = {
+ { "url", 0, 0, G_OPTION_ARG_STRING, &url, NULL, NULL },
+ { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, NULL, NULL },
+ { "noverifyssl", 0, 0, G_OPTION_ARG_NONE, &noverifyssl, NULL, NULL },
+ { NULL },
+ };
+
+ logMessage(INFO, "kickstartFromUrl");
+
+ g_option_context_set_help_enabled(optCon, FALSE);
+ g_option_context_add_main_entries(optCon, ksUrlOptions, NULL);
+
+ if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+ startNewt();
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to URL kickstart method "
+ "command: %s"), optErr->message);
+ g_error_free(optErr);
+ g_option_context_free(optCon);
+ return;
+ }
+
+ g_option_context_free(optCon);
+
+ if (!url) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Must supply a --url argument to Url kickstart method."));
+ return;
+ }
+
+ /* determine install type */
+ if (strncmp(url, "http", 4) && strncmp(url, "ftp://", 6)) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Unknown Url method %s"), url);
+ return;
+ }
+
+ loaderData->instRepo = strdup(url);
+ loaderData->instRepo_noverifyssl = noverifyssl;
+ loaderData->method = METHOD_URL;
+
+ if (proxy) {
+ splitProxyParam(proxy, &loaderData->proxyUser,
+ &loaderData->proxyPassword,
+ &loaderData->proxy);
+ }
+ logMessage(INFO, "results of url ks, url %s", url);
+}
+
int runKickstart(struct loaderData_s * loaderData, const char *file) {
PyObject *versionMod, *parserMod = NULL;
PyObject *handler, *parser;
diff --git a/loader/lang.c b/loader/lang.c
index 4f230dc..a84c2ec 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -380,14 +380,3 @@ int chooseLanguage(char ** lang) {

return setupLanguage(choice, 0);
}
-
-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- if (argc < 2) {
- logMessage(ERROR, "no argument passed to lang kickstart command");
- return;
- }
-
- loaderData->lang = argv[1];
- loaderData->lang_set = 1;
-}
diff --git a/loader/lang.h b/loader/lang.h
index 965f5a0..d4b61dd 100644
--- a/loader/lang.h
+++ b/loader/lang.h
@@ -35,7 +35,4 @@ char * translateString(char * str);
int setLanguage (char * key, int forced);
int getLangInfo(struct langInfo **langs);

-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
- char ** argv);
-
#endif /* _LANG_H_ */
diff --git a/loader/net.c b/loader/net.c
index b0d6f46..22ed892 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1603,172 +1603,6 @@ int writeEnabledNetInfo(iface_t *iface) {
return 0;
}

-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- iface_t iface;
- gchar *bootProto = NULL, *device = NULL, *class = NULL, *ethtool = NULL;
- gchar *essid = NULL, *wepkey = NULL, *onboot = NULL, *gateway = NULL;
- gint mtu = 1500, dhcpTimeout = -1;
- gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- struct in_addr addr;
-#ifdef ENABLE_IPV6
- struct in6_addr addr6;
-#endif
- int rc;
- GOptionEntry ksOptions[] = {
- { "bootproto", 0, 0, G_OPTION_ARG_STRING, &bootProto, NULL, NULL },
- { "device", 0, 0, G_OPTION_ARG_STRING, &device, NULL, NULL },
- { "dhcpclass", 0, 0, G_OPTION_ARG_STRING, &class, NULL, NULL },
- { "gateway", 'g', 0, G_OPTION_ARG_STRING, &gateway,
- NULL, NULL },
- { "ip", 'i', 0, G_OPTION_ARG_STRING, &loaderData->ipv4, NULL, NULL },
-#ifdef ENABLE_IPV6
- { "ipv6", 0, 0, G_OPTION_ARG_STRING, &loaderData->ipv6, NULL, NULL },
-#endif
- { "mtu", 0, 0, G_OPTION_ARG_INT, &mtu, NULL, NULL },
- { "nameserver", 'n', 0, G_OPTION_ARG_STRING, &loaderData->dns,
- NULL, NULL },
- { "netmask", 'm', 0, G_OPTION_ARG_STRING, &loaderData->netmask,
- NULL, NULL },
- { "noipv4", 0, 0, G_OPTION_ARG_NONE, &noipv4, NULL, NULL },
- { "noipv6", 0, 0, G_OPTION_ARG_NONE, &noipv6, NULL, NULL },
- { "nodns", 0, 0, G_OPTION_ARG_NONE, &noDns, NULL, NULL },
- { "hostname", 'h', 0, G_OPTION_ARG_STRING, &loaderData->hostname,
- NULL, NULL },
- { "ethtool", 0, 0, G_OPTION_ARG_STRING, &ethtool, NULL, NULL },
- { "essid", 0, 0, G_OPTION_ARG_STRING, &essid, NULL, NULL },
- { "wepkey", 0, 0, G_OPTION_ARG_STRING, &wepkey, NULL, NULL },
- { "onboot", 0, 0, G_OPTION_ARG_STRING, &onboot, NULL, NULL },
- { "notksdevice", 0, 0, G_OPTION_ARG_NONE, &noksdev, NULL, NULL },
- { "dhcptimeout", 0, 0, G_OPTION_ARG_INT, &dhcpTimeout, NULL, NULL },
- { NULL },
- };
-
- iface_init_iface_t(&iface);
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to kickstart network command: %s"),
- optErr->message);
- g_error_free(optErr);
- }
-
- g_option_context_free(optCon);
-
- /* if they've specified dhcp/bootp use dhcp for the interface */
- if (bootProto && (!strncmp(bootProto, "dhcp", 4) ||
- !strncmp(bootProto, "bootp", 4))) {
- loaderData->ipv4 = strdup("dhcp");
- loaderData->ipinfo_set = 1;
- } else if (loaderData->ipv4) {
- /* JKFIXME: this assumes a bit... */
- loaderData->ipinfo_set = 1;
- }
-
- /* now make sure the specified bootproto is valid */
- if (bootProto && strcmp(bootProto, "dhcp") && strcmp(bootProto, "bootp") &&
- strcmp(bootProto, "static") && strcmp(bootProto, "query")) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad bootproto %s specified in network command"),
- bootProto);
- }
-
- /* --gateway is common for ipv4 and ipv6, same as in loader UI */
- if (gateway) {
- if ((rc = inet_pton(AF_INET, gateway, &addr)) == 1) {
- loaderData->gateway = strdup(gateway);
- } else if (rc == 0) {
-#ifdef ENABLE_IPV6
- if ((rc = inet_pton(AF_INET6, gateway, &addr6)) == 1) {
- loaderData->gateway6 = strdup(gateway);
- } else if (rc == 0) {
-#endif
- logMessage(WARNING,
- "invalid address in kickstart --gateway");
-#ifdef ENABLE_IPV6
- } else {
- logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
- strerror(errno));
- }
-#endif
- } else {
- logMessage(ERROR, "%s (%d): %s", __func__, __LINE__,
- strerror(errno));
- }
- }
-
- if (!noksdev) {
- if (device) {
- /* If --device=MAC was given, translate into a device name now. */
- if (index(device, ':') != NULL)
- loaderData->netDev = iface_mac2device(device);
- else
- loaderData->netDev = strdup(device);
-
- loaderData->netDev_set = 1;
- }
-
- if (class) {
- loaderData->netCls = strdup(class);
- loaderData->netCls_set = 1;
- }
-
- if (ethtool) {
- if (loaderData->ethtool)
- free(loaderData->ethtool);
- loaderData->ethtool = strdup(ethtool);
- free(ethtool);
- }
-
- if (essid) {
- if (loaderData->essid)
- free(loaderData->essid);
- loaderData->essid = strdup(essid);
- free(essid);
- }
-
- if (wepkey) {
- if (loaderData->wepkey)
- free(loaderData->wepkey);
- loaderData->wepkey = strdup(wepkey);
- free(wepkey);
- }
-
- if (mtu) {
- loaderData->mtu = mtu;
- }
-
- if (noipv4)
- flags |= LOADER_FLAGS_NOIPV4;
-
-#ifdef ENABLE_IPV6
- if (noipv6)
- flags |= LOADER_FLAGS_NOIPV6;
-
- if (loaderData->ipv6) {
- loaderData->ipv6info_set = 1;
- }
-#endif
- }
-
- if (noDns) {
- loaderData->noDns = 1;
- }
-
- /* Make sure the network is always up if there's a network line in the
- * kickstart file, as %post/%pre scripts might require that.
- */
- if (loaderData->method != METHOD_NFS && loaderData->method != METHOD_URL) {
- if (kickstartNetworkUp(loaderData, &iface))
- logMessage(ERROR, "unable to bring up network");
- }
-}
-
/* if multiple interfaces get one to use from user. */
/* NOTE - uses kickstart data available in loaderData */
int chooseNetworkInterface(struct loaderData_s * loaderData) {
diff --git a/loader/net.h b/loader/net.h
index a6a4ec5..96c1ffb 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -69,8 +69,6 @@ int writeEnabledNetInfo(iface_t * iface);
int chooseNetworkInterface(struct loaderData_s * loaderData);
void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData);
int setupWireless(iface_t * iface);
-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartNetworkUp(struct loaderData_s * loaderData,
iface_t * iface);
void splitHostname (char *str, char **host, char **port);
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 7ce0433..ee0465d 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -254,51 +254,6 @@ int loadNfsImages(struct loaderData_s *loaderData) {
return 1;
}

-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- gchar *host = NULL, *dir = NULL, *mountOpts = NULL;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksNfsOptions[] = {
- { "server", 0, 0, G_OPTION_ARG_STRING, &host, NULL, NULL },
- { "dir", 0, 0, G_OPTION_ARG_STRING, &dir, NULL, NULL },
- { "opts", 0, 0, G_OPTION_ARG_STRING, &mountOpts, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromNfs");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksNfsOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to NFS kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (!host || !dir) {
- logMessage(ERROR, "host and directory for nfs kickstart not specified");
- return;
- }
-
- logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
- host, dir, mountOpts);
-
- loaderData->method = METHOD_NFS;
- if (mountOpts) {
- checked_asprintf(&loaderData->instRepo, "nfs:%s:%s:%s", host, mountOpts, dir);
- } else {
- checked_asprintf(&loaderData->instRepo, "nfs:%s:%s", host, dir);
- }
-}
-
int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) {
char * host = NULL, *path = NULL, * file = NULL, * opts = NULL;
char * chk = NULL, *ip = NULL;
diff --git a/loader/nfsinstall.h b/loader/nfsinstall.h
index f2865ad..ace38b1 100644
--- a/loader/nfsinstall.h
+++ b/loader/nfsinstall.h
@@ -22,8 +22,6 @@

#include "method.h"

-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartFromNfs(char * url, struct loaderData_s * loaderData);
int promptForNfs(struct loaderData_s *loaderData);
int loadNfsImages(struct loaderData_s *loaderData);
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 80285cd..d20748e 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -256,59 +256,4 @@ int kickstartFromUrl(char * url, struct loaderData_s * loaderData) {
return getFileFromUrl(url, "/tmp/ks.cfg", loaderData);
}

-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
- char ** argv) {
- gchar *url = NULL, *proxy = NULL;
- gboolean noverifyssl = FALSE;
- GOptionContext *optCon = g_option_context_new(NULL);
- GError *optErr = NULL;
- GOptionEntry ksUrlOptions[] = {
- { "url", 0, 0, G_OPTION_ARG_STRING, &url, NULL, NULL },
- { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, NULL, NULL },
- { "noverifyssl", 0, 0, G_OPTION_ARG_NONE, &noverifyssl, NULL, NULL },
- { NULL },
- };
-
- logMessage(INFO, "kickstartFromUrl");
-
- g_option_context_set_help_enabled(optCon, FALSE);
- g_option_context_add_main_entries(optCon, ksUrlOptions, NULL);
-
- if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
- startNewt();
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to URL kickstart method "
- "command: %s"), optErr->message);
- g_error_free(optErr);
- g_option_context_free(optCon);
- return;
- }
-
- g_option_context_free(optCon);
-
- if (!url) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Must supply a --url argument to Url kickstart method."));
- return;
- }
-
- /* determine install type */
- if (strncmp(url, "http", 4) && strncmp(url, "ftp://", 6)) {
- newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Unknown Url method %s"), url);
- return;
- }
-
- loaderData->instRepo = strdup(url);
- loaderData->instRepo_noverifyssl = noverifyssl;
- loaderData->method = METHOD_URL;
-
- if (proxy) {
- splitProxyParam(proxy, &loaderData->proxyUser,
- &loaderData->proxyPassword,
- &loaderData->proxy);
- }
- logMessage(INFO, "results of url ks, url %s", url);
-}
-
/* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/loader/urlinstall.h b/loader/urlinstall.h
index 432d3f7..ba83b75 100644
--- a/loader/urlinstall.h
+++ b/loader/urlinstall.h
@@ -23,8 +23,6 @@
#include "method.h"
#include "urls.h"

-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
- char ** argv);
int kickstartFromUrl(char * url, struct loaderData_s * loaderData);
int getFileFromUrl(char * url, char * dest, struct loaderData_s * loaderData);
int promptForUrl(struct loaderData_s *loaderData);



--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Honolulu, HI | UTC-10

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 10:56 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.