summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-05-20 15:26:00 +0000
committerJeremy Katz <katzj@redhat.com>2003-05-20 15:26:00 +0000
commit1f3bf130e3705ed4d77af08cf51c12128ab5424d (patch)
tree9f5d2f3b64e7aa17b261e911cb1fff0547451e7d /loader2
parent445f36acfd30cd71b89e8ed7385b74cb9da0f2dc (diff)
downloadanaconda-1f3bf130e3705ed4d77af08cf51c12128ab5424d.tar.gz
anaconda-1f3bf130e3705ed4d77af08cf51c12128ab5424d.tar.xz
anaconda-1f3bf130e3705ed4d77af08cf51c12128ab5424d.zip
merge from taroon branch to HEAD. mostly the package stuff, but also
msw's ctrl-alt-del thing and some arch fixups
Diffstat (limited to 'loader2')
-rw-r--r--loader2/init.c46
-rw-r--r--loader2/linuxrc.s3909
-rw-r--r--loader2/loader.c2
-rw-r--r--loader2/net.c9
4 files changed, 50 insertions, 16 deletions
diff --git a/loader2/init.c b/loader2/init.c
index a5341f7fb..8b572baba 100644
--- a/loader2/init.c
+++ b/loader2/init.c
@@ -97,6 +97,7 @@ char * env[] = {
int testing=0;
void unmountFilesystems(void);
void disableSwap(void);
+struct termios ts;
int mystrstr(char *str1, char *str2) {
char *p;
@@ -164,9 +165,9 @@ int hasNetConfiged(void) {
struct ifconf configs;
struct ifreq devs[10];
- #ifdef __i386__
- return 0;
- #endif
+#ifdef __i386__
+ return 0;
+#endif
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0) {
@@ -434,11 +435,20 @@ int copyDirectory(char * from, char * to) {
return 0;
}
+void sigintHandler(int signum)
+{
+ /* reset terminal */
+ tcsetattr(0, TCSANOW, &ts);
+ /* Shift in, default color, move down 100 lines */
+ /* ^O ^[[0m ^[[100E */
+ printf("\017\033[0m\033[100E\n");
+ shutDown(0, 1);
+}
int main(int argc, char **argv) {
pid_t installpid, childpid;
int waitStatus;
- int fd;
+ int fd;
int doReboot = 0;
int doShutdown =0;
int isSerial = 0;
@@ -450,7 +460,6 @@ int main(int argc, char **argv) {
char buf[500];
int len;
-
#if !defined(__s390__) && !defined(__s390x__)
testing = (getppid() != 0) && (getppid() != 1);
#endif
@@ -483,9 +492,6 @@ int main(int argc, char **argv) {
}
printf("done\n");
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
-
/* these args are only for testing from commandline */
for (i = 1; i < argc; i++) {
if (!strcmp (argv[i], "serial")) {
@@ -551,6 +557,13 @@ int main(int argc, char **argv) {
dup2(0, 2);
#endif
+ /* disable Ctrl+Z, Ctrl+C, etc */
+ tcgetattr(0, &ts);
+ ts.c_iflag &= ~BRKINT;
+ ts.c_iflag |= IGNBRK;
+ ts.c_iflag &= ~ISIG;
+ tcsetattr(0, TCSANOW, &ts);
+
setsid();
if (ioctl(0, TIOCSCTTY, NULL)) {
printf("could not set new controlling tty\n");
@@ -613,6 +626,23 @@ int main(int argc, char **argv) {
exit(0);
}
+ /* set up the ctrl+alt+delete handler to kill our pid, not pid 1 */
+ signal(SIGINT, sigintHandler);
+ if ((fd = open("/proc/sys/kernel/cad_pid", O_WRONLY)) != -1) {
+ char buf[7];
+ int count;
+ sprintf(buf, "%d", getpid());
+ count = write(fd, buf, strlen(buf));
+ close(fd);
+ /* if we succeeded in writing our pid, turn off the hard reboot
+ ctrl-alt-del handler */
+ if (count == strlen(buf) &&
+ (fd = open("/proc/sys/kernel/ctrl-alt-del", O_WRONLY)) != -1) {
+ write(fd, "0", 1);
+ close(fd);
+ }
+ }
+
while (!doShutdown) {
childpid = wait4(-1, &waitStatus, 0, NULL);
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index a3dfc2a2f..df964865d 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -367,6 +367,15 @@ HOME=$HOME
PYTHONPATH=$PYTHONPATH
EOF
+cat >> /etc/profile <<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
echo "REMIP=$GATEWAY" >> /tmp/netinfo
echo "export REMIP=$GATEWAY" >> /etc/profile
diff --git a/loader2/loader.c b/loader2/loader.c
index a44c99119..2882785c3 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -1058,7 +1058,7 @@ int main(int argc, char ** argv) {
checkForRam(flags);
- mlLoadModuleSet("cramfs:vfat:nfs:loop:isofs", modLoaded, modDeps,
+ mlLoadModuleSet("cramfs:vfat:nfs:loop:isofs:floppy", modLoaded, modDeps,
modInfo, flags);
/* now let's do some initial hardware-type setup */
diff --git a/loader2/net.c b/loader2/net.c
index 0e4fc1925..d8c6d1bcb 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -314,7 +314,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
if (!cfg->noDns)
writeResolvConf(cfg);
- return 0;
+ return LOADER_NOOP;
}
text = newtTextboxReflowed(-1, -1,
@@ -489,12 +489,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
writeResolvConf(cfg);
}
- /* JKFIXME: this is a hack */
-#if !defined(__s390__) && !defined(__s390x__)
return 0;
-#else
- return LOADER_NOOP;
-#endif
}
int configureNetwork(struct networkDeviceConfig * dev) {
@@ -803,7 +798,7 @@ int kickstartNetworkUp(struct knownDevices * kd,
setupNetworkDeviceConfig(netCfgPtr, loaderData, flags);
rc = readNetConfig(loaderData->netDev, netCfgPtr, flags);
- if (rc) {
+ if ((rc == LOADER_BACK) || (rc == LOADER_ERROR)) {
logMessage("unable to setup networking");
return -1;
}