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

commit e01c5b9aab0d3e5a10b188b5fdda17ec82199edc
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Fri Feb 29 19:20:06 2008 +0100

rewrite rc.S in C
this allows us to display a nice dialog splash till we detect hardware
before the first dialog.
(such a hw detect is necessary because of usb keyboards - the first
dialog already requires a working keyboard to select language)

diff --git a/Makefile b/Makefile
index 71478dd..0bf7620 100644
--- a/Makefile
+++ b/Makefile
@@ -145,8 +145,6 @@ misc: merge install-setup
ifneq ($(DEBUG),false)
sed -i 's|/bin/setup|/usr/bin/gdb /bin/setup|' $(MDIR)/etc/inittab
endif
-       cp etc/rc.S $(MDIR)/etc/rc.d/
-       chmod +x $(MDIR)/etc/rc.d/rc.S
cp bin/bootstrap $(MDIR)/bin/

devices: compile
diff --git a/etc/inittab b/etc/inittab
index 3a17a1a..6ae6939 100644
--- a/etc/inittab
+++ b/etc/inittab
@@ -1,7 +1,4 @@
# /etc/inittab for frugalware setup
-# Boot-time system configuration/initialization script.
-# This is run first except when booting in single-user mode.
-::sysinit:/etc/rc.d/rc.S

# Login /bin/sh invocations on selected ttys.
#
diff --git a/etc/rc.S b/etc/rc.S
index 4266acd..c5db039 100755
--- a/etc/rc.S
+++ b/etc/rc.S
@@ -1,6 +1,7 @@
#!/bin/sh

clear
+echo -n "loading modules..."
mount -t proc none /proc
mount -t sysfs none /sys
mount -t tmpfs none /tmp
@@ -13,8 +14,12 @@ modprobe BusLogic 2>/dev/null
modprobe -q ehci-hcd >/dev/null 2>&1
modprobe -q ohci-hcd >/dev/null 2>&1
modprobe -q uhci-hcd >/dev/null 2>&1
-
+echo " done."
+
+echo -n "activating hardware detection..."
/etc/rc.d/rc.udev
+echo " done."
+
setterm -blank 0

for i in `seq 1 4`
diff --git a/src/plugins/Makefile b/src/plugins/Makefile
index 2f1f2ed..8aeeebb 100644
--- a/src/plugins/Makefile
+++ b/src/plugins/Makefile
@@ -41,7 +41,7 @@ CFLAGS += $(shell pkg-config --cflags glib-2.0)
LDFLAGS += $(shell pkg-config --libs glib-2.0)

PLUGINS=asklang dolangsh greet layout loadsource configsource partdisk \
-       formatdisk select install postconf restart
+       formatdisk select install postconf restart hotplug

all: $(addsuffix .so,$(PLUGINS))

diff --git a/src/plugins/hotplug.c b/src/plugins/hotplug.c
new file mode 100644
index 0000000..c4b23bb
--- /dev/null
+++ b/src/plugins/hotplug.c
@@ -0,0 +1,91 @@
+/*
+ *  hotplug.c for Frugalware setup
+ *
+ *  Copyright (c) 2008 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#ifdef DIALOG
+    #include <dialog.h>
+#endif
+#ifdef GTK
+    #include <gtk/gtk.h>
+#endif
+
+#include <setup.h>
+#include <util.h>
+#include "common.h"
+
+plugin_t plugin =
+{
+       "hotplug",
+       desc,
+       00,
+       run,
+       NULL // dlopen handle
+};
+
+plugin_t *info()
+{
+       return &plugin;
+}
+
+char *desc()
+{
+       return _("Detecting hardware");
+}
+
+int run(GList **config)
+{
+       dialog_vars.backtitle=gen_backtitle(_("Detecting hardware"));
+       dlg_put_backtitle();
+       dlg_clear();
+       dialog_msgbox(_("Please wait"), _("Activating hardware detection..."),
+               0, 0, 0);
+       // TODO: this is ugly
+       fw_system("mount -t proc none /proc");
+       fw_system("mount -t sysfs none /sys");
+       fw_system("mount -t tmpfs none /tmp");
+       fw_system("cat /proc/mounts >/etc/mtab");
+       fw_system("modprobe isofs");
+       fw_system("modprobe ntfs");
+       fw_system("modprobe BusLogic");
+
+       // try to load all the hub modules
+       fw_system("modprobe -q ehci-hcd");
+       fw_system("modprobe -q ohci-hcd");
+       fw_system("modprobe -q uhci-hcd");
+
+       // the real hw detect
+       fw_system("/etc/rc.d/rc.udev");
+
+       fw_system("setterm -blank 0");
+
+       // no utf8 for now
+       fw_system("kbd_mode -a /dev/tty1");
+       fw_system("echo -n -e '\033%@' > /dev/tty1");
+       fw_system("kbd_mode -a /dev/tty2");
+       fw_system("echo -n -e '\033%@' > /dev/tty2");
+       fw_system("kbd_mode -a /dev/tty3");
+       fw_system("echo -n -e '\033%@' > /dev/tty3");
+       fw_system("kbd_mode -a /dev/tty4");
+       fw_system("echo -n -e '\033%@' > /dev/tty4");
+
+       return(0);
+}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to