diff options
author | harald <harald> | 2001-08-22 10:56:17 +0000 |
---|---|---|
committer | harald <harald> | 2001-08-22 10:56:17 +0000 |
commit | 871c68cb05fa93fd55757248b9bff55e8181ace9 (patch) | |
tree | a1821e976b56045a48dd51b30ebab239c745cbd6 /loader | |
parent | 29a25bf3882596ca917e6d1c0612cd691e659a55 (diff) | |
download | anaconda-871c68cb05fa93fd55757248b9bff55e8181ace9.tar.gz anaconda-871c68cb05fa93fd55757248b9bff55e8181ace9.tar.xz anaconda-871c68cb05fa93fd55757248b9bff55e8181ace9.zip |
rejoined s390 branch
Diffstat (limited to 'loader')
-rwxr-xr-x | loader/linuxrc.s390 | 260 | ||||
-rw-r--r-- | loader/module-info.s390 | 45 | ||||
-rw-r--r-- | loader/s390/Makefile | 47 | ||||
-rw-r--r-- | loader/s390/common.h | 8 | ||||
-rw-r--r-- | loader/s390/dasdformat.c | 144 | ||||
-rw-r--r-- | loader/s390/installer.spec | 35 | ||||
-rw-r--r-- | loader/s390/mountpoint.c | 179 | ||||
-rw-r--r-- | loader/s390/netsetup.c | 96 | ||||
-rw-r--r-- | loader/s390/pkgselect.c | 120 | ||||
-rw-r--r-- | loader/s390/pkgsrc.c | 65 |
10 files changed, 999 insertions, 0 deletions
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 new file mode 100755 index 000000000..291249060 --- /dev/null +++ b/loader/linuxrc.s390 @@ -0,0 +1,260 @@ +#! /bin/sh +# +# Copyright (C) 2000,2001 by +# Bernhard Rosenkraenzer <bero@redhat.com> +# Oliver Paukstadt <opaukstadt@millenux.com> +# Karsten Hopp <karsten@redhat.de> +# Florian La Roche <laroche@redhat.com> +# Nils Philippsen <nils@redhat.de> +# Helge Deller <hdeller@redhat.de> +# +# 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 +# + +debugshell() +{ + echo "You have defined DEBUG, so here is a shell. You can use 'exit'" + echo "to go on with the normal installation process." + /bin/sh +} + +startinetd() +{ + echo + echo "Starting telnetd and sshd to allow login over the network." + /sbin/inetd + echo "Generating ssh keys, This can take a while..." + (cd /etc/ssh + echo " Generating host_key" + ssh-keygen -q -t rsa1 -f ssh_host_key -C '' -N '' >/dev/null 2>&1 + echo " Generating rsa_key" + ssh-keygen -q -t rsa -f ssh_host_rsa_key -C '' -N '' >/dev/null 2>&1 + echo " Generating dsa_key" + ssh-keygen -q -t dsa -f ssh_host_dsa_key -C '' -N '' >/dev/null 2>&1 + chmod 600 ssh_host_key ssh_host_rsa_key ssh_host_dsa_key + chmod 644 *.pub + echo "Done" + ) + /sbin/sshd + while : ; do + echo + echo "Please connect now to $IPADDR and start 'rhsetup' or start" + echo "'rhsetup nointeractive' from this shell." + /bin/sh -l + done + # /sbin/mingetty console --noclear +} + + +echo "Starting the S390 initrd to configure networking. Version is 0.24." + +PATH="/bin:/sbin:/usr/bin:/usr/sbin" +export PATH + +#mount -n -o remount,rw / +mount -t proc none /proc +mount -t devpts none /dev/pts + +ifconfig lo 127.0.0.1 netmask 255.0.0.0 +route add -host 127.0.0.1 dev lo + +[ -n "$DEBUG" ] && debugshell + +# Parse configuration +if [ -n "$HOST" ]; then + set -- `echo $HOST |sed 's/:/ /g'` + HNAME=$1 + DEVICE=$2 + NETTYPE=`echo $DEVICE |sed -e 's/[0-9].*//'` + IPADDR=$3 + if [ ":$NETTYPE" = ":iucv" ]; then + IUCV="iucv=$4" + GATEWAY=$5 + MTU=$6 + elif [ ":$NETTYPE" = ":ctc" ]; then + GATEWAY=$4 + MTU=$5 + else + MTU=$4 + fi +fi +if [ -n "$MTU" ]; then + MMTU="mtu $MTU" +fi +if [ -n "$NETWORK" ]; then + set -- `echo $NETWORK | sed 's/:/ /g'` + NETWORKIP=$1 + NETMASK=$2 + BROADCAST=$3 + if [ ":$NETTYPE" != ":ctc" ] && [ ":$NETTYPE" != ":iucv" ]; then + GATEWAY=$4 + fi +fi + +# Check for missing parameters, prompt for them if necessary +while [ -z "$HNAME" ]; do + echo "Please enter the FQDN of your new virtual machine (e.g. s390.redhat.com):" + read HNAME +done +while [ -z "$DEVICE" ]; do + echo "Please enter the network device you intend to use (e.g. ctc0, iucv0, eth0, tr0):" + read DEVICE + NETTYPE=`echo $DEVICE |sed -e 's/[0-9].*//'` +done +while [ -z "$IPADDR" ]; do + echo "Please enter the IP address of your new virtual machine:" + read IPADDR +done +if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ]; then + while [ -z "$NETMASK" ]; do + echo "Please enter your netmask (e.g. 255.255.255.0):" + read NETMASK + done + while [ -z "$BROADCAST" ]; do + echo "Please enter your broadcast address:" + read BROADCAST + done + while [ -z "$NETWORKIP" ]; do + echo "Please enter your network address:" + read NETWORKIP + done + while [ -z "$GATEWAY" ]; do + echo "Please enter your default gateway:" + read GATEWAY + done + while [ -z "$LCS" ] && [ -z "$QETH" ]; do + echo "(1) for OSA-2 with LCS or (2) for OSA-Express with QDIO/QETH" + read INF + while [ -z "$LCS" ] && [ ":$INF" = ":1" ]; do + echo "OSA Device address (e.g. fc20,1 - or \"auto\" (may not work)):" + read LCS + done + while [ -z "$QETH" ] && [ ":$INF" = ":2" ]; do + echo "OSA-Express Device address (e.g. 0xf000,0xf001,0xf002 - or \"auto\" (may not work)):" + read QETH + done + done +else + while [ -z "$GATEWAY" ]; do + echo "Enter the IP of your ctc/iucv point-to-point partner:" + read GATEWAY + done + if [ ":$NETTYPE" = ":iucv" ]; then + while [ -z "$IUCV" ]; do + echo "Enter iucv kernel module options (usually iucv=HOST):" + read IUCV + done + fi +fi + +# configure network-interface +if [ ":$NETTYPE" = ":ctc" ]; then + insmod ctc $CTC + ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY + route add -host $IPADDR dev $DEVICE +elif [ ":$NETTYPE" = ":iucv" ]; then + insmod netiucv $IUCV + ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY + route add -host $IPADDR dev $DEVICE +else + if [ -z "$QETH" ]; then + if [ ":$LCS" = ":auto" ]; then + LCS="" + else + LCS=`echo $LCS | sed -e '/^0x\|^0X/ b; s/^/0x/'` + LCS="noauto=1 devno_portno_pairs=$LCS" + fi + insmod -f /lib/lcs.o $LCS + else + if [ ":$QETH" = ":auto" ]; then + QETH="qeth_options=" + else + QETH="qeth_options=noauto,$QETH" + fi + insmod -f /lib/qdio.o + insmod -f /lib/qeth.o $QETH + fi + ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST + route add -net $NETWORKIP netmask $NETMASK dev $DEVICE +fi +route add default gw $GATEWAY dev $DEVICE + +[ -n "$HNAME" ] && hostname $HNAME + +# show interfaces and routing table +ifconfig -a +route -n + +[ -n "$DEBUG" ] && debugshell + +echo "Starting portmap." +portmap + +# convert to space-separated lists +DNS=`echo $DNS |sed -e 's/:/ /g'` +SEARCHDNS=`echo $SEARCHDNS |sed -e 's/:/ /g'` + +# transfer options into install environment +cat > /tmp/install.cfg <<EOF +HNAME="$HNAME" +DEVICE="$DEVICE" +NETTYPE="$NETTYPE" +IPADDR="$IPADDR" +GATEWAY="$GATEWAY" +MTU="$MTU" +NETWORKIP="$NETWORKIP" +NETMASK="$NETMASK" +BROADCAST="$BROADCAST" +INSTALL="$INSTALL" +INTERACTIVE="$INTERACTIVE" +DNS="$DNS" +SEARCHDNS="$SEARCHDNS" +RPMSERVER="$RPMSERVER" +MOUNTS="$MOUNTS" +FORCEDASDFORMAT="$FORCEDASDFORMAT" +SWAP="$SWAP" +DASD="$DASD" +LCS="$LCS" +QETH="$QETH" +IUCV="$IUCV" +CTC="$CTC" +DTZ="$DTZ" +ROOTPW="$ROOTPW" +CROOTPW="$CROOTPW" +export HNAME DEVICE NETTYPE IPADDR GATEWAY MTU INTERACTIVE +export NETWORKIP NETMASK BROADCAST INSTALL DNS SEARCHDNS FORCEDASDFORMAT +export RPMSERVER MOUNTS SWAP DASD LCS QETH IUCV DTZ ROOTPW CROOTPW +EOF +# immediately read it in again to export these into the shell below +. /tmp/install.cfg + +[ -n "$DEBUG" ] && debugshell + +if [ ":$INTERACTIVE" = ":0" ]; then + rhsetup nointeractive || startinetd +else + startinetd +fi + +umount -a +umount /proc +#umount / + +exit 0 +# vim:ts=3:sw=3 +# ;;; Local Variables: *** +# ;;; mode: sh *** +# ;;; tab-width:3 *** +# ;;; end: *** diff --git a/loader/module-info.s390 b/loader/module-info.s390 new file mode 100644 index 000000000..48bce7ac0 --- /dev/null +++ b/loader/module-info.s390 @@ -0,0 +1,45 @@ +Version 0 +# The version 0 module-info format is ('|' denotes the left margin): +# |<module-name> +# | <module-type> [<module-alias>] +# | "<description-string>" +# | <argument> "<argument-description-string>" ["<match-regex>" ["<default>"]] +# |# <comment> +# Stanzas are delimited by non-indented lines, and continued with indented lines. +# Comments start in the first column, or are preceded only by whitespace. +# The []'s above are not literal, they delimit optional material. +# There can be multiple <argument> lines. +# <module-name> is the name of the module without any .o extension, just +# as the module name would be entered in /etc/modules.conf +# <module-type> is the base part of the string demanded by kerneld (eth, +# scsi_hostadapter, etc.) +# <module-alias> is an optional identifier to identify groups of similar +# drivers, such as the non-scsi cdrom devices which are requested by +# block-major-*; they are given an alias of "cdrom". +# <description-string> is a free-form string enclosed in quotes to describe +# the module to a human reader +# <argument> is an argument such as io or irq, as understood by the module +# <argument-description-string> is a free-form description +# <match-regex> is a regular expression which can be used to test the +# validity of a user-entered string +# <default> is a default value. This should not be provided unless it is +# almost always the correct value, and will not, say, hang a user's computer +# if it is wrong +# +# Ideas for version 1 file format: +# o Add long description, presumably including all known cards supported +# by the module in question +# o Sub-argument description, for arguments which have multiple parts +# separated by commas, particularly ones which share code with boot-time +# arguments. +# o Optional architecture flag(?) + +# drivers/net directory + +netiucv + eth + "S/390 Inter-User Communication Vehicle (iucv)" + +ctc + eth + "S/390 Channel to Channel" diff --git a/loader/s390/Makefile b/loader/s390/Makefile new file mode 100644 index 000000000..c34708b21 --- /dev/null +++ b/loader/s390/Makefile @@ -0,0 +1,47 @@ +CFLAGS=-Wall -O2 +LDLIBS=-lnewt +PACKAGE=installer +VERSION=$(shell cat installer.spec | grep Version: | sed 's/Version: //g') +VERNAME=$(PACKAGE)-$(VERSION) + +SOURCES=dasdformat.c mountpoint.c netsetup.c pkgsrc.c pkgselect.c Makefile installer.spec common.h +APPS=dasdformat mountpoint netsetup pkgsrc pkgselect + +all: $(APPS) + strip $(APPS) + +dasdformat: dasdformat.c +mountpoint: mountpoint.c +netsetup: netsetup.c +pkgsrc: pkgsrc.c +pkgselect: pkgselect.c + +install: $(APPS) + mkdir -p $(DESTDIR)/usr/bin + install $(APPS) $(DESTDIR)/usr/bin + +clean: + rm -f $(APPS) + rm -rf $(PACKAGE).tar.gz $(PACKAGE).tar + rm -rf $(VERNAME)-1.src.rpm + +tar: + rm -rf $(PACKAGE) + rm -rf $(VERNAME).tar + mkdir $(PACKAGE) 2>/dev/null + cp $(SOURCES) $(PACKAGE)/ + tar cvf $(VERNAME).tar $(PACKAGE) + rm -rf $(PACKAGE) + +tgz: tar + rm -rf $(VERNAME).tar.gz + gzip $(VERNAME).tar + +srpm: tgz + rpmbuild --define "_srcrpmdir `pwd`" -ts $(VERNAME).tar.gz + rm -rf $(VERNAME).tar.gz + +rpm: srpm + rpm --rebuild $(VERNAME)-1.src.rpm + cp /usr/src/redhat/RPMS/`uname -m`/$(VERNAME)-1.*.rpm ../ + diff --git a/loader/s390/common.h b/loader/s390/common.h new file mode 100644 index 000000000..63a050f13 --- /dev/null +++ b/loader/s390/common.h @@ -0,0 +1,8 @@ +static void +doNewtInit (int *width, int *height) +{ + newtInit (); + newtCls (); + newtGetScreenSize (width, height); + newtDrawRootText (0, 0, "Red Hat Linux for S/390 (C) 2001 Red Hat, Inc."); +} diff --git a/loader/s390/dasdformat.c b/loader/s390/dasdformat.c new file mode 100644 index 000000000..381bd2790 --- /dev/null +++ b/loader/s390/dasdformat.c @@ -0,0 +1,144 @@ +/***************************************************************************** + * DASD setup * + * (c) 2000-2001 Bernhard Rosenkraenzer <bero@redhat.com> * + * Copyright (C) 2001 Florian La Roche <laroche@redhat.com> * + *****************************************************************************/ + +#include <newt.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include "common.h" + +#define MAX_DASD 26 +#define DASD_FMT "dasd%c" +#define DEV_DASD_FMT "/dev/" DASD_FMT + +int +main (int argc, char **argv) +{ + newtComponent form, tb, ok, cancel, ret, cb[MAX_DASD]; + int format[MAX_DASD], have_dasd[MAX_DASD]; + int w, h, i, dasds = 0; + char dasd[sizeof (DEV_DASD_FMT) + 1], tmp[4096], error[4096]; + + for (i = 0; i < MAX_DASD; i++) { + int fd; + sprintf (dasd, DEV_DASD_FMT, 'a' + i); + if ((fd = open (dasd, O_RDONLY)) >= 0) { + dasds++; + have_dasd[i] = 1; + close (fd); + } else + have_dasd[i] = 0; + } + + doNewtInit (&w, &h); + + if (dasds == 0) { + newtWinMessage ("Error", "Ok", + "No DASD devices found.\nPlease check your setup."); + newtFinished (); + exit (EXIT_FAILURE); + } + + newtCenteredWindow (w - 22, h - 6, "DASD initialization"); + form = newtForm (NULL, NULL, 0); + tb = newtTextbox (1, 0, w - 23, 2, NEWT_FLAG_WRAP); + newtTextboxSetText (tb, "Please choose which DASDs you would like to " + "format.\nAll data on those DASDs will be lost."); + newtFormAddComponent (form, tb); + for (i = 0; i < MAX_DASD; i++) { + if (! have_dasd[i]) + continue; + sprintf (dasd, DEV_DASD_FMT, 'a' + i); + cb[i] = newtCheckbox (6 + (i / 10) * 16, 3 + (i % 10), + dasd, '*', NULL, NULL); + newtFormAddComponent (form, cb[i]); + } + ok = newtButton ((w - 22) / 2 - 15, h - 10, "OK"); + newtFormAddComponent (form, ok); + cancel = newtButton ((w - 22) / 2 + 5, h - 10, "Cancel"); + newtFormAddComponent (form, cancel); + + newtFormSetCurrent (form, ok); + + ret = newtRunForm (form); + if (ret == cancel) { + newtFinished (); + exit (EXIT_FAILURE); + } + + for (i = 0; i < MAX_DASD; i++) + format[i] = (have_dasd[i] && + newtCheckboxGetValue (cb[i]) == '*'); + newtPopWindow (); + + for (i = 0; i < MAX_DASD; i++) { + int format_dasd, err = 0; + FILE *f; + char proc[256]; + + if (! format[i]) + continue; + + sprintf (dasd, DEV_DASD_FMT, 'a' + i); + newtCenteredWindow (48, 2, "DASD initialization"); + form = newtForm (NULL, NULL, 0); + tb = newtTextbox (1, 0, 46, 2, NEWT_FLAG_WRAP); + sprintf (tmp, "Currently formatting DASD %s...\n" + "This can take several minutes - Please wait.", dasd); + newtTextboxSetText (tb, tmp); + newtFormAddComponent (form, tb); + newtDrawForm (form); + newtRefresh (); + + /* Check if we need to run dasdfmt... */ + sprintf (tmp, DASD_FMT ":active", 'a' + i); + f = fopen ("/proc/dasd/devices", "r"); + format_dasd = (f && !ferror (f)); + while (format_dasd && !feof (f)) { + fgets (proc, sizeof proc, f); + if (strstr (proc, tmp)) + format_dasd = 0; + } + if (f) + fclose (f); + + if (format_dasd) { + sprintf (tmp, "/sbin/dasdfmt -b 4096 -y -f %s", dasd); + if ((err = system (tmp))) { + sprintf (error, + "Error %d while trying to run\n%s:\n%s", + err, tmp, strerror (errno)); + newtWinMessage ("Error", "Ok", error); + format_dasd = 0; + } + } + if (err == 0) { + sprintf (tmp, "Making %s filesystem on DASD %s...\n" + "This can take a while - Please wait.", + "ext2", dasd); + newtTextboxSetText (tb, tmp); + newtRefresh (); + sprintf (tmp, "/sbin/mke2fs -b 4096 %s1 >>" + "/tmp/mke2fs.log 2>&1", dasd); + err = system (tmp); + if (err != 0) { + sprintf (error, + "Error %u while trying to run\n%s:\n%s", + err, tmp, strerror (errno)); + newtWinMessage ("Error", "Ok", error); + newtPopWindow (); + newtFinished (); + exit (EXIT_FAILURE); + } + } + newtPopWindow (); + } + newtFinished (); + exit (EXIT_SUCCESS); +} diff --git a/loader/s390/installer.spec b/loader/s390/installer.spec new file mode 100644 index 000000000..8f59d21c7 --- /dev/null +++ b/loader/s390/installer.spec @@ -0,0 +1,35 @@ +Name: installer +Version: 0.13 +Release: 1 +Summary: Tool for configuring the package source for Red Hat Linux for S/390. +URL: http://www.redhat.com/ +Source: %{name}-%{version}.tar.gz +License: GPL +Group: System Environment/Base +Prefix: %{_prefix} +BuildRoot: %{_tmppath}/%{name}-root +ExclusiveArch: s390 s390x + +%description +Tools for installing and configuring Red Hat Linux for S/390. + +%prep +%setup -n installer + +%build +make CFLAGS="$RPM_OPT_FLAGS" + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR="$RPM_BUILD_ROOT" + +%files +%defattr(-,root,root) +/usr/bin/* + +%clean +rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/%{name}-%{version} + +%changelog +* Thu Dec 28 2000 Bernhard Rosenkraenzer <bero@redhat.com> +- initial RPM diff --git a/loader/s390/mountpoint.c b/loader/s390/mountpoint.c new file mode 100644 index 000000000..237b28726 --- /dev/null +++ b/loader/s390/mountpoint.c @@ -0,0 +1,179 @@ +/***************************************************************************** + * DASD mount point setup * + * (c) 2000-2001 Bernhard Rosenkraenzer <bero@redhat.com> * + * v 0.2.1 - 2001/04/25 Helge Deller <hdeller@redhat.de> * + * - added commandline-parsing of the initial mountpoints * + * - exit program if user press the Cancel-button * + * - added check for existance of root-fs * + * v 0.2.0 - 2000/12/18 * + * initial release * + * TODO: sanity checks: * + * you can't mount different DASDs at the same mount point. * + *****************************************************************************/ + +#include <newt.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include "common.h" + +#define MAX_DASD 26 +#define DASD_FMT "dasd%c" +#define DASD_FMT_P1 DASD_FMT "1" +#define DEV_DASD_FMT "/dev/" DASD_FMT +#define DEV_DASD_FMT_P1 DEV_DASD_FMT "1" + +int +main (int argc, char **argv) +{ + newtComponent form, ok, cancel, ret, mountPoint[MAX_DASD]; + char *mp[MAX_DASD], dasd[13]; + int have_dasd[MAX_DASD], num_dasds = 0, w, h, i, fd, root_found; + FILE *f; + + for (i = 0; i < MAX_DASD; i++) { + sprintf (dasd, DEV_DASD_FMT_P1, 'a' + i); + mp[i] = NULL; + have_dasd[i] = 0; + fd = open (dasd, O_RDONLY); + if (fd >= 0) { + num_dasds++; + have_dasd[i] = 1; + close (fd); + } + } + + doNewtInit (&w, &h); + if (num_dasds == 0) { + newtWinMessage ("Error", "Ok", "No DASD devices found.\n" + "Please check your setup."); + newtFinished (); + exit (EXIT_FAILURE); + } + + /* analyze the initial mountpoint from the commandline, + * which should be given as argv's in the style: + * /dev/dasda1:/usr /dev/dasdb1:/tmp + */ + for (i = 2; i < argc; i++) { + int n; + char *d = argv[i]; + char *p = strchr (d, ':'); + char msg[1024]; + + if (!p) { + snprintf (msg, sizeof msg, "Invalid parameter: %s\n" + "Usage is: %s <dasd-partition>:<mountpoint>", + d, argv[0]); + newtWinMessage ("Error", "Ok", msg); + continue; + } + + *p++ = '\0'; + for (n = 0; n < MAX_DASD; n++) { + sprintf (dasd, DEV_DASD_FMT_P1, 'a' + n); + if (strncmp (d, dasd, strlen (dasd)) == 0) + break; + } + + if (n >= MAX_DASD) { + snprintf (msg, sizeof msg, + "Invalid %s DASD device in command-line.", d); + newtWinMessage ("Error", "Ok", msg); + continue; + } + + if (p[0] != '/') { + snprintf (msg, sizeof msg, "Invalid path '%s' for " + "DASD device %s in command-line.", p, d); + newtWinMessage ("Error", "Ok", msg); + continue; + } + + if (!have_dasd[n]) { + snprintf (msg, sizeof msg, + "DASD device %s is not on-line.", d); + newtWinMessage ("Error", "Ok", msg); + continue; + } + + /* save this mountpoint */ + mp[n] = p; + } + + newtCenteredWindow (73, 18, "Mount points"); + form = newtForm (NULL, NULL, 0); + newtFormAddComponent (form, newtLabel (1, 0, + "Please choose the mount points for your DASDs.")); + for (i = 0; i < MAX_DASD; i++) { + if (have_dasd[i]) { + sprintf (dasd, DASD_FMT_P1 ":", 'a' + i); + newtFormAddComponent (form, newtLabel (1 + (i / 11) + * 24, 2 + (i % 11), dasd)); + mountPoint[i] = newtEntry (1 + (i / 11) * 24 + 8, 2 + + (i % 11), mp[i], 15, NULL, NEWT_ENTRY_SCROLL); + newtFormAddComponent (form, mountPoint[i]); + } + } + ok = newtButton (73 / 2 - 15, 14, "OK"); + cancel = newtButton (73 / 2 + 5, 14, "Cancel"); + newtFormAddComponent (form, ok); + newtFormAddComponent (form, cancel); + newtFormSetCurrent (form, ok); + + do { + ret = newtRunForm (form); + if (ret == cancel) { + newtPopWindow (); + newtFinished (); + exit (EXIT_FAILURE); + } + + /* check for a root-fs */ + root_found = 0; + for (i = 0; i < MAX_DASD; i++) { + char *mp; + if (!have_dasd[i]) + continue; + mp = newtEntryGetValue (mountPoint[i]); + if (mp && strcmp (mp, "/") == 0) + root_found = 1; + } + if (!root_found) + newtWinMessage ("Error", "Ok", + "You need at least one root-filesystem.\n"); + } while (!root_found); + + f = fopen (argv[1], "w"); + for (i = 0; i < MAX_DASD; i++) { + if (have_dasd[i]) { + char tmp[512]; + sprintf (dasd, DEV_DASD_FMT_P1, 'a' + i); + mp[i] = newtEntryGetValue (mountPoint[i]); + if (mp[i] && strlen (mp[i])) { + int err; + fprintf (f, "%s:%s\n", dasd, mp[i]); + snprintf (tmp, sizeof (tmp), + "/sbin/tune2fs -L %s %s" + " >/dev/null 2>&1", mp[i], dasd); + err = system (tmp); + if (err != 0) { + char s[2048]; + snprintf (s, sizeof (s), + "Error %u while " + "running\n%s:\n%s", err, tmp, + strerror (errno)); + newtWinMessage ("Error", "Ok", s); + } + } + } + } + fclose (f); + + newtPopWindow (); + newtFinished (); + exit (EXIT_SUCCESS); +} diff --git a/loader/s390/netsetup.c b/loader/s390/netsetup.c new file mode 100644 index 000000000..4aa33b625 --- /dev/null +++ b/loader/s390/netsetup.c @@ -0,0 +1,96 @@ +/***************************************************************************** + * Network configuration * + * (c) 2001 Bernhard Rosenkraenzer <bero@redhat.com> * + * Copyright (C) 2001 Florian La Roche <laroche@redhat.com> * + *****************************************************************************/ + +#include <newt.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include "common.h" + +int +main (int argc, char **argv) +{ + newtComponent form, ok, cancel, ret, host, domains, dns; + char *d, *ip, *tmp, *txt_hostname, *txt_search, *txt_dns; + char error[4096]; + int w, h; + FILE *f; + + /* XXX should be passed in argv instead */ + txt_hostname = getenv ("HNAME"); + txt_search = getenv ("SEARCHDNS"); + txt_dns = getenv ("DNS"); + + doNewtInit (&w, &h); + newtCenteredWindow (w - 7, 11, "Network setup"); + + form = newtForm (NULL, NULL, 0); + newtFormAddComponent (form, newtLabel (1, 0, "Your full hostname:")); + host = newtEntry (1, 1, txt_hostname, w - 9, NULL, NEWT_ENTRY_SCROLL); + newtFormAddComponent (form, host); + newtFormAddComponent (form, newtLabel (1, 2, + "Domain name search list:")); + domains = newtEntry (1, 3, txt_search, w - 9, NULL, NEWT_ENTRY_SCROLL); + newtFormAddComponent (form, domains); + newtFormAddComponent (form, newtLabel (1, 4, + "IP(s) of your DNS server(s), separated by spaces:")); + dns = newtEntry (1, 5, txt_dns, w - 9, NULL, NEWT_ENTRY_SCROLL); + newtFormAddComponent (form, dns); + + ok = newtButton ((w - 7) / 2 - 15, 7, "OK"); + cancel = newtButton ((w - 7) / 2 + 5, 7, "Cancel"); + newtFormAddComponent (form, ok); + newtFormAddComponent (form, cancel); + + newtFormSetCurrent (form, ok); + + ret = newtRunForm (form); + if (ret == cancel) { + newtPopWindow (); + newtFinished (); + exit (EXIT_FAILURE); + } + + f = fopen ("/etc/resolv.conf", "w"); + if (!f) { + int err = errno; + sprintf (error, + "Error %d while trying to write /etc/resolv.conf\n%s", + err, strerror (err)); + newtWinMessage ("Error", "Ok", error); + newtPopWindow (); + newtFinished (); + exit (EXIT_FAILURE); + } + fprintf (f, "search %s\n", newtEntryGetValue (domains)); + d = newtEntryGetValue (dns); + ip = strtok (d, " "); + while (ip) { + fprintf (f, "nameserver %s\n", ip); + ip = strtok (NULL, " "); + } + fclose (f); + + f = fopen ("/etc/HOSTNAME", "w"); + if (!f) { + int err = errno; + sprintf (error, + "Error %d while trying to write /etc/HOSTNAME\n%s", + err, strerror (err)); + newtWinMessage ("Error", "Ok", error); + newtPopWindow (); + newtFinished (); + exit (EXIT_FAILURE); + } + fputs (newtEntryGetValue (host), f); + fclose (f); + newtPopWindow (); + newtFinished (); + exit (EXIT_SUCCESS); +} diff --git a/loader/s390/pkgselect.c b/loader/s390/pkgselect.c new file mode 100644 index 000000000..7a7e757fe --- /dev/null +++ b/loader/s390/pkgselect.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2001 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Karsten Hopp <karsten@redhat.de> + * + * Package selection + */ + +#include <newt.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include <dirent.h> +#include "common.h" + + +struct s_packages { + char *name; + char *suffix; + char *filename; +}; + +struct s_packages packages[] = { + { "Minimal - Install just a base system", "minimal", "packages.minimal" }, + { "Desktop - Install packages for desktop use", "desktop", "packages.desktop" }, + { "Default - A selection of the most common packages", "default", "packages.default" }, + { "Server - A selection best suited for servers", "server", "packages.server" }, + { "Everything - Install everything", "all", "packages.all" } +}; + +#define NUM_PACKAGES (sizeof(packages) / sizeof(struct s_packages)) + +int +main (int argc, char **argv) +{ + newtGrid grid, subgrid, buttons; + newtComponent label, listbox, text_b, form, okay, cancel, answer; + char *defcomp; + int i; + int width, height, selection; + FILE *f; + + defcomp = "default"; + if (argc >= 2 && argv[1][0]) { + for(i=0; i<NUM_PACKAGES; i++) { + printf("FN: %s , PN: %s\n", argv[1], packages[i].suffix); + if(!strncmp(packages[i].suffix, argv[1], strlen(packages[i].suffix))) { + defcomp = argv[1]; + break; + } + } + } + printf("defcomp ist %s\n", defcomp); + + doNewtInit (&width, &height); + width -= 7; + + form = newtForm (NULL, NULL, 0); + label = newtLabel(-1, -1, ("Please select a set of preconfigured packages from this list")); + + listbox = newtListbox(1, 1, NUM_PACKAGES >= 8 ? 8 : NUM_PACKAGES, \ + NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); + for(i=0; i<NUM_PACKAGES; i++) { + newtListboxAddEntry(listbox, packages[i].name, (void **) i); + if(!strncmp(packages[i].suffix, defcomp, strlen(defcomp))) + newtListboxSetCurrent(listbox, i); + } + /* text_b = newtTextbox(1, 1, 20, 5, NEWT_FLAG_WRAP); + * newtTextboxSetText(text_b, packages[(int)newtListboxGetCurrent(listbox)].description); + * newtPushHelpLine(packages[(int)newtListboxGetCurrent(listbox)].description); + * + * subgrid = newtGridHStacked(NEWT_GRID_COMPONENT, listbox, NEWT_GRID_COMPONENT, text_b, NULL); + */ + + subgrid = newtGridHStacked(NEWT_GRID_COMPONENT, listbox, NULL); + buttons = newtButtonBar(("Ok"), &okay, ("Cancel"), &cancel, NULL); + + if (argc >= 2 && argv[1][0] && defcomp && *defcomp) + newtFormSetCurrent (form, okay); + + grid = newtGridBasicWindow(label, subgrid, buttons); + newtGridWrappedWindow(grid, ("Package selection")); + newtGridAddComponentsToForm(grid, form, 1); + newtGridFree(grid, 1); + + + while ((answer = newtRunForm(form)) != okay && (answer != NULL)) { + if (answer == cancel) { + newtPopWindow(); + newtFormDestroy(form); + newtFinished (); + return 1; + } else { + /* must have pressed F12 */ + break; + } + } + selection = (int) newtListboxGetCurrent(listbox); + if (!(f=fopen("/tmp/selection", "w"))) { + perror("Couldn't write to /tmp/selection"); + exit(1); + } + fprintf(f, "%s", packages[selection].suffix); + fclose(f); + newtFinished (); + + exit (EXIT_SUCCESS); +} +/* vim:ts=3:sw=3 + */ diff --git a/loader/s390/pkgsrc.c b/loader/s390/pkgsrc.c new file mode 100644 index 000000000..8665129ba --- /dev/null +++ b/loader/s390/pkgsrc.c @@ -0,0 +1,65 @@ +/***************************************************************************** + * Package source selection * + * (c) 2000 Bernhard Rosenkraenzer <bero@redhat.com> * + * Copyright (C) 2001 Florian La Roche <laroche@redhat.com> * + *****************************************************************************/ + +#include <newt.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include "common.h" + +int +main (int argc, char **argv) +{ + newtComponent form, ok, cancel, ret, path, lbl, *cur; + char *server; + int width, height; + FILE *f; + + server = "ftp://ftp.localdomain.com/pub/s390"; + if (argc >= 2 && argv[1][0]) + server = argv[1]; + + doNewtInit (&width, &height); + width -= 7; + + newtCenteredWindow (width, 12, "Package source"); + form = newtForm (NULL, NULL, 0); + + lbl = newtTextbox(1, 1, width - 1, 4, NEWT_FLAG_WRAP); + newtTextboxSetText(lbl, "Please enter the full path to the Red Hat " + "Linux for S/390 RPMs. This can be an FTP, HTTP or NFS URL.\n" + "(Examples: ftp://ftp.local.com/pub/s390, " + "http://www.local.com/s390, nfs.local.com:/mnt/s390)"); + newtFormAddComponent (form, lbl); + + path = newtEntry (2, 6, server, width - 4, NULL, NEWT_ENTRY_SCROLL); + newtFormAddComponent (form, path); + + ok = newtButton (width / 2 - 15, 8, "OK"); + newtFormAddComponent (form, ok); + cancel = newtButton (width / 2 + 5, 8, "Cancel"); + newtFormAddComponent (form, cancel); + + if (argc >= 2 && argv[1][0] && server && *server) + newtFormSetCurrent (form, ok); + else + newtFormSetCurrent (form, path); + + ret = newtRunForm (form); + newtPopWindow (); + newtFinished (); + + if (ret == cancel || !(f = fopen ("/tmp/rpmserver", "w"))) + exit (EXIT_FAILURE); + + fprintf (f, "RPMSERVER=\"%s\"\n", newtEntryGetValue (path)); + fclose (f); + + exit (EXIT_SUCCESS); +} |