int kickstartFromHD(char *kssrc) {
int rc;
- char *p, *np = NULL, *tmpstr, *ksdev, *kspath;
+ char *ksdev, *kspath;
logMessage(INFO, "getting kickstart file from harddrive");
+ parseDeviceAndDir(kssrc, &ksdev, &kspath);
- /* format is hd:[device]:/path/to/ks.cfg */
- /* split up pieces */
- tmpstr = strdup(kssrc);
- p = strchr(tmpstr, ':');
- if (p)
- np = strchr(p+1, ':');
-
- /* no second colon, assume its the old format of */
- /* hd:[device]/path/to/ks.cfg */
- /* this format is bad however because some devices have '/' in them! */
- if (!np)
- np = strchr(p+1, '/');
-
- if (!p || !np) {
+ if (!ksdev || !kspath) {
logMessage(WARNING, "Format of command line is ks=hd:[device]:/path/to/ks.cfg");
- free(tmpstr);
return 1;
}
- *np = ' ';
- ksdev = p+1;
- kspath = np+1;
-
logMessage(INFO, "Loading ks from device %s on path %s", ksdev, kspath);
if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
if (rc == 3) {
@@ -414,49 +397,47 @@ int kickstartFromHD(char *kssrc) {
newtWinMessage(_("Error"), _("OK"),
_("Cannot find kickstart file on hard drive."));
}
+
+ free(ksdev);
+ free(kspath);
return 1;
}