summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
Diffstat (limited to 'loader2')
-rw-r--r--loader2/Makefile1
-rw-r--r--loader2/keymaps-ppcbin0 -> 12125 bytes
-rw-r--r--loader2/linuxrc.s39033
-rw-r--r--loader2/loader.c137
-rw-r--r--loader2/module-info4
-rw-r--r--loader2/shutdown.c4
6 files changed, 135 insertions, 44 deletions
diff --git a/loader2/Makefile b/loader2/Makefile
index ad2a10d8e..d222a6832 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -136,6 +136,7 @@ install: all
install -m 755 $$n $(DESTDIR)/$(RUNTIMEDIR)/loader; \
strip $(DESTDIR)/$(RUNTIMEDIR)/loader/$$n || :; \
done
+ if [ -f keymaps-$(ARCH) ]; then cp keymaps-$(ARCH) $(DESTDIR)/$(RUNTIMEDIR)/keymaps-override-$(ARCH) ; fi
install -m 644 loader.tr $(DESTDIR)/$(RUNTIMEDIR)/loader
install -m 644 module-info $(DESTDIR)/$(RUNTIMEDIR)/loader
install -m 644 font.bgf.gz $(DESTDIR)/$(RUNTIMEDIR)/loader
diff --git a/loader2/keymaps-ppc b/loader2/keymaps-ppc
new file mode 100644
index 000000000..e7463301a
--- /dev/null
+++ b/loader2/keymaps-ppc
Binary files differ
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index bf35849da..a3dfc2a2f 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -28,6 +28,18 @@ VERSION=1.01
export TEXTDOMAIN=s390installer
export TEXTDOMAINDIR=/usr/lib/locale
+doshutdown()
+{
+ exec /sbin/shutdown
+ exit 0
+}
+
+doreboot()
+{
+ exec /sbin/shutdown -r
+ exit 0
+}
+
startinetd()
{
echo
@@ -35,15 +47,14 @@ startinetd()
echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/issue.net
echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/motd
echo >> /etc/motd
- echo $"Now run 'loader' to install Red Hat Linux." >> /etc/motd
- echo >> /etc/motd
/sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid
/sbin/sshd
if [ -z "$RUNKS" ]; then
+ echo
+ echo $"Please connect now to $IPADDR to start the installation."
+ read
while : ; do
- echo
- echo $"Please connect now to $IPADDR and start 'loader' from this shell."
/bin/sh --login
[ $? = 0 ] || break
done
@@ -348,12 +359,12 @@ MTU=$MTU
EOF
# so that the vars get propagated into the sshd shells
-cat >> /etc/profile <<EOF
+mkdir /.ssh
+cat >> /.ssh/environment <<EOF
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
PATH=$PATH
HOME=$HOME
PYTHONPATH=$PYTHONPATH
-export LD_LIBRARY_PATH PATH HOME PYTHONPATH
EOF
if [ "$NETTYPE" = "ctc" ]; then
@@ -364,16 +375,20 @@ fi
# I'm tired of typing this out...
echo "loader" >> /.bash_history
+echo -n $$ > /var/run/init.pid
+# shutdown (halt) on SIGUSR1
+trap doshutdown SIGUSR1
+# reboot on SIGUSR2
+trap doreboot SIGUSR2
+
startinetd
if [ -n "$RUNKS" ]; then
/sbin/loader
fi
-umount -a
-umount /proc
+doshutdown
-exit 0
# ;;; Local Variables: ***
# ;;; mode: sh ***
# ;;; tab-width:3 ***
diff --git a/loader2/loader.c b/loader2/loader.c
index d4d4dc1f0..a44c99119 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -37,6 +37,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/wait.h>
#include <linux/fb.h>
@@ -365,36 +366,52 @@ static void writeVNCPasswordFile(char *pfile, char *password) {
fclose(f);
}
-/* read information that's passed as environmental variables */
-static void readEnvVars(int flags, struct loaderData_s ** ld) {
- struct loaderData_s * loaderData = *ld;
- char * env;
+/* read information from /tmp/netinfo (written by linuxrc) */
+static void readNetInfo(int flags, struct loaderData_s ** ld) {
+ struct loaderData_s * loaderData = *ld;
+ FILE *f;
+ char *end;
+ char buf[100], *vname, *vparm;
- env = getenv("IPADDR");
- if (env && *env) {
- loaderData->ip = strdup(env);
- loaderData->ipinfo_set = 1;
+ f = fopen("/tmp/netinfo", "r");
+ if (!f) {
+ return;
}
- env = getenv("NETMASK");
- if (env && *env) {
- loaderData->netmask = strdup(env);
- }
- env = getenv("GATEWAY");
- if (env && *env) {
- loaderData->gateway = strdup(env);
- }
- env = getenv("DNS");
- if (env && *env) {
- loaderData->dns = strdup(env);
- }
- env = getenv("MTU");
- if (env && *env) {
- loaderData->mtu = atoi(env);
- }
- env = getenv("REMIP");
- if (env && *env) {
- loaderData->ptpaddr = strdup(env);
+ vname = (char *)malloc(sizeof(char)*15);
+ vparm = (char *)malloc(sizeof(char)*85);
+
+ while(fgets(buf, 100, f)) {
+ if ((vname = strtok(buf, "="))) {
+ vparm = strtok(NULL, "=");
+ while (isspace(*vparm))
+ vparm++;
+ end = strchr(vparm, '\0');
+ while (isspace(*end))
+ end--;
+ end++;
+ *end = '\0';
+ if (strstr(vname, "IPADDR")) {
+ loaderData->ip = strdup(vparm);
+ loaderData->ipinfo_set = 1;
+ }
+ if (strstr(vname, "NETMASK")) {
+ loaderData->netmask = strdup(vparm);
+ }
+ if (strstr(vname, "GATEWAY")) {
+ loaderData->gateway = strdup(vparm);
+ }
+ if (strstr(vname, "DNS")) {
+ loaderData->dns = strdup(vparm);
+ }
+ if (strstr(vname, "MTU")) {
+ loaderData->mtu = atoi(vparm);
+ }
+ if (strstr(vname, "REMIP")) {
+ loaderData->ptpaddr = strdup(vparm);
+ }
+ }
}
+ fclose(f);
}
/* parses /proc/cmdline for any arguments which are important to us.
@@ -528,7 +545,7 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
}
}
- readEnvVars(flags, &loaderData);
+ readNetInfo(flags, &loaderData);
/* NULL terminates the array of extra args */
extraArgs[numExtraArgs] = NULL;
@@ -912,6 +929,19 @@ static void migrate_runtime_directory(char * dirname) {
}
+static int hasGraphicalOverride(char *extraArgs[]) {
+ int i;
+
+ if (getenv("DISPLAY"))
+ return 1;
+
+ for (i = 0; extraArgs[i] != NULL; i++) {
+ if (!strncasecmp(extraArgs[i], "--vnc", 5))
+ return 1;
+ }
+ return 0;
+}
+
int main(int argc, char ** argv) {
int flags = 0;
struct stat sb;
@@ -958,6 +988,14 @@ int main(int argc, char ** argv) {
if (!strcmp(argv[0] + strlen(argv[0]) - 5, "rmmod"))
return combined_insmod_main(argc, argv);
+ if (!testing && !access("/var/run/loader.run", R_OK)) {
+ printf(_("loader has already been run. Starting shell."));
+ execl("/bin/sh", "-/bin/sh", NULL);
+ exit(0);
+ }
+ i = open("/var/run/loader.run", O_CREAT | O_TRUNC | O_RDWR, 0600);
+ close(i);
+
/* The fstat checks disallows serial console if we're running through
a pty. This is handy for Japanese. */
fstat(0, &sb);
@@ -999,7 +1037,7 @@ int main(int argc, char ** argv) {
extraArgs[0] = NULL;
flags = parseCmdLineFlags(flags, &loaderData, cmdLine, extraArgs);
- if (FL_SERIAL(flags) && !getenv("DISPLAY"))
+ if (FL_SERIAL(flags) && !hasGraphicalOverride(extraArgs))
flags |= LOADER_FLAGS_TEXT;
setupRamfs();
@@ -1173,6 +1211,11 @@ int main(int argc, char ** argv) {
else
*argptr++ = "/usr/bin/anaconda";
+ /* make sure /tmp/updates exists so that magic in anaconda to */
+ /* symlink rhpl/ will work */
+ if (access("/tmp/updates", F_OK))
+ mkdirChain("/tmp/updates");
+
logMessage("Running anaconda script %s", *(argptr-1));
*argptr++ = "-m";
@@ -1265,10 +1308,42 @@ int main(int argc, char ** argv) {
closeLog();
if (!FL_TESTING(flags)) {
+ int pid, status, rc;
+
char *buf = sdupprintf(_("Running anaconda, the %s system installer - please wait...\n"), getProductName());
printf("%s", buf);
- execv(anacondaArgs[0], anacondaArgs);
- perror("exec");
+
+ if (!(pid = fork())) {
+ execv(anacondaArgs[0], anacondaArgs);
+ fprintf(stderr, "exec of anaconda failed: %s", strerror(errno));
+ exit(1);
+ }
+
+ waitpid(pid, &status, 0);
+
+ if (!WIFEXITED(status) || WEXITSTATUS(status))
+ rc = 1;
+ else
+ rc = 0;
+
+#if defined(__s390__) || defined(__s390x__)
+ /* FIXME: we have to send a signal to linuxrc on s390 so that shutdown
+ * can happen. this is ugly */
+ FILE * f;
+ f = fopen("/var/run/init.pid", "r");
+ if (!f) {
+ logMessage("can't find init.pid, guessing that init is pid 1");
+ pid = 1;
+ } else {
+ char * buf = malloc(256);
+ fgets(buf, 256, f);
+ pid = atoi(buf);
+ }
+ kill(pid, SIGUSR1);
+ return rc;
+#else
+ return rc;
+#endif
}
#if 0
else {
diff --git a/loader2/module-info b/loader2/module-info
index 832b4b5e0..f5b98bf02 100644
--- a/loader2/module-info
+++ b/loader2/module-info
@@ -504,6 +504,10 @@ veth
eth
"iSeries Virtual Ethernet"
+viodasd
+ scsi_hostadapter
+ "iSeries Virtual DASD"
+
# Mac stuff
bmac
eth
diff --git a/loader2/shutdown.c b/loader2/shutdown.c
index 33dab7bad..f6ade0ae0 100644
--- a/loader2/shutdown.c
+++ b/loader2/shutdown.c
@@ -65,11 +65,7 @@ void shutDown(int noKill, int doReboot) {
#endif
} else {
printf("you may safely reboot your system\n");
-#if !defined(__s390__) && !defined(__s390x__)
- while (1);
-#else
reboot(RB_HALT_SYSTEM);
-#endif
}
exit(0);