mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
Lots-o-cleanup(tm):
1. Fix the bogon I introduced that made some root filesystems fail to be made with `unable to make filesystem on sd1s1a' or some such error message. 2. Latest installment in the never-ending chapter on making FTP do the right thing on a cruel internet. 3. Make `express install' a truly express install and split off what it used to do into a `novice install' that's even more geared to the novice by asking questions in order, rather than forcing them through the menu interface. 4. Make anonymous FTP setup truly DTRT. 5. Build lndir directly into sysinstall and make the novice install offer to set up the ports tree. Also make the ports setup truly explanatory about what it's doing, and always link the ports destination to /usr/ports if necessary so that bsd.port.mk doesn't need to be tweaked.
This commit is contained in:
parent
84c60f0d3f
commit
1babea36ca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12025
8 changed files with 391 additions and 182 deletions
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: apache.c,v 1.8 1995/10/27 17:31:03 jkh Exp $
|
||||
* $Id: apache.c,v 1.9 1995/10/30 08:04:43 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Coranth Gryphon. All rights reserved.
|
||||
|
@ -394,7 +394,7 @@ apacheOpenDialog()
|
|||
}
|
||||
|
||||
int
|
||||
installApache(char *unused)
|
||||
configApache(char *unused)
|
||||
{
|
||||
int i,maxcon;
|
||||
char company[64], file[128];
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installFinal.c,v 1.12 1995/10/26 08:55:47 jkh Exp $
|
||||
* $Id: installFinal.c,v 1.13 1995/10/27 03:59:36 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard & Coranth Gryphon. All rights reserved.
|
||||
|
@ -52,6 +52,8 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
/* This file contains all the final configuration thingies */
|
||||
|
||||
static DMenu MenuSamba = {
|
||||
DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS,
|
||||
"Samba Services Menu",
|
||||
|
@ -76,169 +78,178 @@ static DMenu MenuSamba = {
|
|||
#define SMB_CONF "./smb.conf"
|
||||
|
||||
|
||||
/* Do any final network configuration hackery */
|
||||
/* Load gated package and maybe even seek to configure or explain it a little */
|
||||
int
|
||||
installNetworking(char *unused)
|
||||
configGated(char *unused)
|
||||
{
|
||||
variable_set2("gated", "YES");
|
||||
return RET_SUCCESS;
|
||||
}
|
||||
|
||||
/* Configure this machine as an anonymous FTP server */
|
||||
int
|
||||
configAnonFTP(char *unused)
|
||||
{
|
||||
int i, tval;
|
||||
char tbuf[256];
|
||||
char *tptr;
|
||||
FILE *fptr;
|
||||
char tbuf[256];
|
||||
int i = RET_SUCCESS;
|
||||
|
||||
i = RET_SUCCESS;
|
||||
tptr = msgGetInput("/u", "What directory should the anonymous ftp account point to?");
|
||||
if (tptr && *tptr && (tptr[0] == '/')) {
|
||||
int len = strlen(tbuf);
|
||||
|
||||
/* Do we want to install and set up gated? */
|
||||
if (variable_get("gated")) {
|
||||
/* Load gated package and maybe even seek to configure or explain it a little */
|
||||
}
|
||||
strcpy(tbuf, tptr);
|
||||
if (tbuf[len - 1] == '/')
|
||||
tbuf[len - 1] = '\0';
|
||||
|
||||
/* Set up anonymous FTP access to this machine? */
|
||||
if (variable_get("anon_ftp")) {
|
||||
tptr = msgGetInput("/u", "What directory should the anonymous ftp's home be under?");
|
||||
if (tptr && *tptr && (tptr[0] == '/')) {
|
||||
int len = strlen(tbuf);
|
||||
|
||||
strcpy(tbuf, tptr);
|
||||
if (tbuf[len - 1] == '/')
|
||||
tbuf[len - 1] = '\0';
|
||||
|
||||
if (vsystem("adduser -uid %d -home %s -shell date -dotdir no -batch %s %s \"%s\" ",
|
||||
FTP_UID, tbuf, FTP_NAME, FTP_GROUP, FTP_COMMENT)) {
|
||||
dialog_clear();
|
||||
msgConfirm("Unable to create FTP user! Anonymous FTP setup failed.");
|
||||
i = RET_FAIL;
|
||||
}
|
||||
else {
|
||||
vsystem("mkdir %s/%s/pub", tbuf, FTP_NAME);
|
||||
vsystem("mkdir %s/%s/upload", tbuf, FTP_NAME);
|
||||
vsystem("chmod 0777 %s/%s/upload", tbuf, FTP_NAME);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (vsystem("adduser -uid %d -home %s -shell date -dotdir no -batch %s %s \"%s\" ",
|
||||
FTP_UID, tbuf, FTP_NAME, FTP_GROUP, FTP_COMMENT)) {
|
||||
dialog_clear();
|
||||
msgConfirm("Invalid Directory. Anonymous FTP will not be set up.");
|
||||
msgConfirm("Unable to create FTP user! Anonymous FTP setup failed.");
|
||||
i = RET_FAIL;
|
||||
}
|
||||
else {
|
||||
vsystem("mkdir -p %s; chmod 555 %s; chown root %s", tbuf, tbuf, tbuf);
|
||||
vsystem("mkdir %s/bin && chmod 555 %s/bin", tbuf, tbuf);
|
||||
vsystem("cp /bin/ls %s/bin && chmod 111 %s/bin/ls", tbuf, tbuf);
|
||||
vsystem("mkdir %s/etc && chmod 555 %s/etc", tbuf, tbuf);
|
||||
vsystem("cp /etc/pwd.db /etc/group %s/etc && chmod 444 %s/etc/pwd.db %s/etc/group", tbuf, tbuf, tbuf);
|
||||
vsystem("mkdir -p %s/pub/incoming", tbuf);
|
||||
vsystem("chmod 1777 %s/pub/incoming", tbuf);
|
||||
vsystem("chown -R %s %s/pub", FTP_NAME, tbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set this machine up as a web server? */
|
||||
if (variable_get("apache_httpd")) {
|
||||
i = installApache(NULL);
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Invalid Directory. Anonymous FTP will not be set up.");
|
||||
i = RET_FAIL;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Set this machine up as a Samba server? */
|
||||
if (variable_get("samba")) {
|
||||
if (!dmenuOpenSimple(&MenuSamba))
|
||||
i = RET_FAIL;
|
||||
else {
|
||||
fptr = fopen("/tmp/smb.conf","w");
|
||||
if (fptr) {
|
||||
strcpy(tbuf,"FreeBSD - Samba %v");
|
||||
if (variable_get("SAMBA_string")) {
|
||||
tptr = msgGetInput("FreeBSD - Samba %%v", "What should this server list as its description?\n"
|
||||
"Note that the \"%%v\" refers to the samba version number.");
|
||||
if (tptr && *tptr)
|
||||
strcpy(tbuf, tptr);
|
||||
}
|
||||
int
|
||||
configSamba(char *unused)
|
||||
{
|
||||
int i = RET_SUCCESS;
|
||||
|
||||
if (!dmenuOpenSimple(&MenuSamba))
|
||||
i = RET_FAIL;
|
||||
else {
|
||||
FILE *fptr;
|
||||
char tbuf[256], *tptr;
|
||||
int tval;
|
||||
|
||||
fptr = fopen("/tmp/smb.conf","w");
|
||||
if (fptr) {
|
||||
strcpy(tbuf,"FreeBSD - Samba %v");
|
||||
if (variable_get("SAMBA_string")) {
|
||||
tptr = msgGetInput("FreeBSD - Samba %%v", "What should this server list as its description?\n"
|
||||
"Note that the \"%%v\" refers to the samba version number.");
|
||||
if (tptr && *tptr)
|
||||
strcpy(tbuf, tptr);
|
||||
}
|
||||
|
||||
fprintf(fptr, "[global]\n");
|
||||
fprintf(fptr, "comment = %s\n", tbuf);
|
||||
fprintf(fptr, "log file = /var/log/samba.log\n");
|
||||
fprintf(fptr, "dont descend = /dev,/proc,/root,/stand\n\n");
|
||||
fprintf(fptr, "[global]\n");
|
||||
fprintf(fptr, "comment = %s\n", tbuf);
|
||||
fprintf(fptr, "log file = /var/log/samba.log\n");
|
||||
fprintf(fptr, "dont descend = /dev,/proc,/root,/stand\n\n");
|
||||
|
||||
fprintf(fptr, "printing = bsd\n");
|
||||
fprintf(fptr, "map archive = no\n");
|
||||
fprintf(fptr, "status = yes\n");
|
||||
fprintf(fptr, "public = yes\n");
|
||||
fprintf(fptr, "read only = no\n");
|
||||
fprintf(fptr, "preserve case = yes\n");
|
||||
fprintf(fptr, "strip dot = yes\n");
|
||||
fprintf(fptr, "security = share\n");
|
||||
fprintf(fptr, "guest ok = yes\n\n");
|
||||
fprintf(fptr, "printing = bsd\n");
|
||||
fprintf(fptr, "map archive = no\n");
|
||||
fprintf(fptr, "status = yes\n");
|
||||
fprintf(fptr, "public = yes\n");
|
||||
fprintf(fptr, "read only = no\n");
|
||||
fprintf(fptr, "preserve case = yes\n");
|
||||
fprintf(fptr, "strip dot = yes\n");
|
||||
fprintf(fptr, "security = share\n");
|
||||
fprintf(fptr, "guest ok = yes\n\n");
|
||||
|
||||
if (variable_get("SAMBA_homes")) {
|
||||
fprintf(fptr, "[homes]\n");
|
||||
fprintf(fptr, "browseable = no\n");
|
||||
fprintf(fptr, "comment = User Home Directory\n");
|
||||
fprintf(fptr, "create mode = 0775\n");
|
||||
fprintf(fptr, "public = no\n\n");
|
||||
}
|
||||
if (variable_get("SAMBA_homes")) {
|
||||
fprintf(fptr, "[homes]\n");
|
||||
fprintf(fptr, "browseable = no\n");
|
||||
fprintf(fptr, "comment = User Home Directory\n");
|
||||
fprintf(fptr, "create mode = 0775\n");
|
||||
fprintf(fptr, "public = no\n\n");
|
||||
}
|
||||
|
||||
if (variable_get("SAMBA_printers")) {
|
||||
fprintf(fptr, "[printers]\n");
|
||||
fprintf(fptr, "path = /var/spool\n");
|
||||
fprintf(fptr, "comment = Printers\n");
|
||||
fprintf(fptr, "create mode = 0700\n");
|
||||
fprintf(fptr, "browseable = no\n");
|
||||
fprintf(fptr, "printable = yes\n");
|
||||
fprintf(fptr, "read only = yes\n");
|
||||
fprintf(fptr, "public = no\n\n");
|
||||
}
|
||||
if (variable_get("SAMBA_printers")) {
|
||||
fprintf(fptr, "[printers]\n");
|
||||
fprintf(fptr, "path = /var/spool\n");
|
||||
fprintf(fptr, "comment = Printers\n");
|
||||
fprintf(fptr, "create mode = 0700\n");
|
||||
fprintf(fptr, "browseable = no\n");
|
||||
fprintf(fptr, "printable = yes\n");
|
||||
fprintf(fptr, "read only = yes\n");
|
||||
fprintf(fptr, "public = no\n\n");
|
||||
}
|
||||
|
||||
if (variable_get("SAMBA_export")) {
|
||||
for (tval = 0; ! tval; tval = msgYesNo("Another?")) {
|
||||
tptr = msgGetInput(NULL,"What directory to export?");
|
||||
if (tptr && *tptr && (tptr[0] == '/')) {
|
||||
int len = strlen(tbuf);
|
||||
|
||||
strcpy(tbuf, tptr);
|
||||
if (tbuf[len - 1] == '/')
|
||||
tbuf[len - 1] = '\0';
|
||||
if (directoryExists(tbuf)) {
|
||||
tptr = msgGetInput(pathBaseName(tbuf), "What do you want to call this share?");
|
||||
if (tptr && *tptr) {
|
||||
fprintf(fptr, "[%s]\npath = %s\n", tptr, tbuf);
|
||||
tptr = msgGetInput(NULL, "Enter a short description of this share?");
|
||||
if (tptr && *tptr)
|
||||
fprintf(fptr, "comment = %s\n", tptr);
|
||||
if (msgYesNo("Do you want this share to be read only?"))
|
||||
fprintf(fptr, "read only = no\n\n");
|
||||
else
|
||||
fprintf(fptr, "read only = yes\n\n");
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Invalid Share Name.");
|
||||
}
|
||||
if (variable_get("SAMBA_export")) {
|
||||
for (tval = 0; ! tval; tval = msgYesNo("Another?")) {
|
||||
tptr = msgGetInput(NULL,"What directory to export?");
|
||||
if (tptr && *tptr && (tptr[0] == '/')) {
|
||||
int len = strlen(tbuf);
|
||||
|
||||
strcpy(tbuf, tptr);
|
||||
if (tbuf[len - 1] == '/')
|
||||
tbuf[len - 1] = '\0';
|
||||
if (directoryExists(tbuf)) {
|
||||
tptr = msgGetInput(pathBaseName(tbuf), "What do you want to call this share?");
|
||||
if (tptr && *tptr) {
|
||||
fprintf(fptr, "[%s]\npath = %s\n", tptr, tbuf);
|
||||
tptr = msgGetInput(NULL, "Enter a short description of this share?");
|
||||
if (tptr && *tptr)
|
||||
fprintf(fptr, "comment = %s\n", tptr);
|
||||
if (msgYesNo("Do you want this share to be read only?"))
|
||||
fprintf(fptr, "read only = no\n\n");
|
||||
else
|
||||
fprintf(fptr, "read only = yes\n\n");
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Directory does not exist.");
|
||||
msgConfirm("Invalid Share Name.");
|
||||
}
|
||||
} /* end if (tptr) */
|
||||
} /* end for loop */
|
||||
} /* end if (SAMBA_export) */
|
||||
|
||||
fclose(fptr);
|
||||
vsystem("mv -f /tmp/smb.conf %s", SMB_CONF);
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Unable to open temporary smb.conf file.\nSamba must be configured by hand.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Directory does not exist.");
|
||||
}
|
||||
} /* end if (tptr) */
|
||||
} /* end for loop */
|
||||
} /* end if (SAMBA_export) */
|
||||
fclose(fptr);
|
||||
vsystem("mv -f /tmp/smb.conf %s", SMB_CONF);
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("Unable to open temporary smb.conf file.\n"
|
||||
"Samba will have to be configured by hand.");
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Set this machine up with a PC-NFS authentication server? */
|
||||
if (variable_get("pcnfsd")) {
|
||||
/* Load and configure pcnfsd */
|
||||
}
|
||||
|
||||
int
|
||||
configNFSServer(char *unused)
|
||||
{
|
||||
/* If we're an NFS server, we need an exports file */
|
||||
if (variable_get("nfs_server") && !file_readable("/etc/exports")) {
|
||||
if (!file_readable("/etc/exports")) {
|
||||
dialog_clear();
|
||||
msgConfirm("You have chosen to be an NFS server but have not yet configured\n"
|
||||
"the /etc/exports file. You must configure this information before\n"
|
||||
"other hosts will be able to mount file systems from your machine.\n"
|
||||
"Press [ENTER] now to invoke an editor on /etc/exports");
|
||||
vsystem("echo '#The following example exports /usr to 3 machines named after ducks:' > /etc/exports");
|
||||
vsystem("echo '#/usr huey louie dewie' >> /etc/exports");
|
||||
vsystem("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
|
||||
vsystem("echo '#/home and all directories under it to machines named after dead rock stars,' >> /etc/exports");
|
||||
vsystem("echo '#and, finally, /a to 2 privileged machines allowed to write on it as root.' >> /etc/exports");
|
||||
vsystem("echo '#/usr huey louie dewie' >> /etc/exports");
|
||||
vsystem("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
|
||||
vsystem("echo '#/a -maproot=0 bill albert' >> /etc/exports");
|
||||
vsystem("echo '#' >> /etc/exports");
|
||||
vsystem("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
|
||||
vsystem("echo >> /etc/exports");
|
||||
systemExecute("ee /etc/exports");
|
||||
}
|
||||
configResolv();
|
||||
configSysconfig();
|
||||
return i;
|
||||
variable_set2("nfs_server", "YES");
|
||||
return RET_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installPreconfig.c,v 1.15 1995/10/27 01:22:57 jkh Exp $
|
||||
* $Id: installPreconfig.c,v 1.16 1995/10/27 17:00:23 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
@ -60,6 +60,11 @@ static struct _word {
|
|||
char *name;
|
||||
int (*handler)(char *str);
|
||||
} resWords[] = {
|
||||
{ "configAnonFTP", configAnonFTP },
|
||||
{ "configApache", configApache },
|
||||
{ "configGated", configGated },
|
||||
{ "configNFSServer", configNFSServer },
|
||||
{ "configSamba", configSamba },
|
||||
{ "diskPartitionEditor", diskPartitionEditor },
|
||||
{ "diskPartitionWrite", diskPartitionWrite },
|
||||
{ "diskLabelEditor", diskLabelEditor },
|
||||
|
@ -79,13 +84,11 @@ static struct _word {
|
|||
{ "distExtractAll", distExtractAll },
|
||||
{ "docBrowser", docBrowser },
|
||||
{ "docShowDocument", docShowDocument },
|
||||
{ "installApache", installApache },
|
||||
{ "installCommit", installCommit },
|
||||
{ "installExpress", installExpress },
|
||||
{ "installUpgrade", installUpgrade },
|
||||
{ "installPreconfig", installPreconfig },
|
||||
{ "installFixup", installFixup },
|
||||
{ "installNetworking", installNetworking },
|
||||
{ "installFilesystems", installFilesystems },
|
||||
{ "mediaSetCDROM", mediaSetCDROM },
|
||||
{ "mediaSetFloppy", mediaSetFloppy },
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installUpgrade.c,v 1.11 1995/10/26 08:55:49 jkh Exp $
|
||||
* $Id: installUpgrade.c,v 1.12 1995/10/27 03:59:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
@ -320,20 +320,11 @@ installUpgrade(char *str)
|
|||
}
|
||||
}
|
||||
|
||||
if (installNetworking("upgrade") == RET_FAIL) {
|
||||
dialog_clear();
|
||||
msgConfirm("Some of the networking configuration stuff evidently failed, but\n"
|
||||
"the first stage of the upgrade should otherwise be considered a\n"
|
||||
"success!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("First stage of upgrade completed successfully!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
}
|
||||
dialog_clear();
|
||||
msgConfirm("First stage of upgrade completed successfully!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
|
||||
if (chdir(saved_etc)) {
|
||||
dialog_clear();
|
||||
msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n"
|
||||
|
|
217
release/sysinstall/lndir.c
Normal file
217
release/sysinstall/lndir.c
Normal file
|
@ -0,0 +1,217 @@
|
|||
/* $XConsortium: lndir.c,v 1.14 95/01/09 20:08:20 kaleb Exp $ */
|
||||
/* $XFree86: xc/config/util/lndir.c,v 3.3 1995/01/28 15:41:09 dawes Exp $ */
|
||||
/* Create shadow link tree (after X11R4 script of the same name)
|
||||
Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */
|
||||
|
||||
/* Hacked somewhat by Jordan Hubbard, The FreeBSD Project, to make it */
|
||||
/* an invokable function from sysinstall rather than a stand-alone binary */
|
||||
|
||||
/*
|
||||
Copyright (c) 1990, X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
*/
|
||||
|
||||
/* From the original /bin/sh script:
|
||||
|
||||
Used to create a copy of the a directory tree that has links for all
|
||||
non-directories (except those named RCS, SCCS or CVS.adm). If you are
|
||||
building the distribution on more than one machine, you should use
|
||||
this technique.
|
||||
|
||||
If your master sources are located in /usr/local/src/X and you would like
|
||||
your link tree to be in /usr/local/src/new-X, do the following:
|
||||
|
||||
% mkdir /usr/local/src/new-X
|
||||
% cd /usr/local/src/new-X
|
||||
% lndir ../X
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <stdarg.h>
|
||||
#include "sysinstall.h"
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 2048
|
||||
#endif
|
||||
|
||||
static char *rcurdir;
|
||||
static char *curdir;
|
||||
|
||||
static int
|
||||
equivalent(char *lname, char *rname)
|
||||
{
|
||||
char *s;
|
||||
|
||||
if (!strcmp(lname, rname))
|
||||
return 1;
|
||||
for (s = lname; *s && (s = strchr(s, '/')); s++) {
|
||||
while (s[1] == '/')
|
||||
strcpy(s+1, s+2);
|
||||
}
|
||||
return !strcmp(lname, rname);
|
||||
}
|
||||
|
||||
|
||||
/* Recursively create symbolic links from the current directory to the "from"
|
||||
directory. Assumes that files described by fs and ts are directories. */
|
||||
|
||||
static int
|
||||
dodir(char *fn, struct stat *fs, struct stat *ts, int rel)
|
||||
{
|
||||
DIR *df;
|
||||
struct dirent *dp;
|
||||
char buf[MAXPATHLEN + 1], *p;
|
||||
char symbuf[MAXPATHLEN + 1];
|
||||
struct stat sb, sc;
|
||||
int n_dirs;
|
||||
int symlen;
|
||||
char *ocurdir;
|
||||
|
||||
if ((fs->st_dev == ts->st_dev) && (fs->st_ino == ts->st_ino))
|
||||
return 1;
|
||||
|
||||
if (rel)
|
||||
strcpy (buf, "../");
|
||||
else
|
||||
buf[0] = '\0';
|
||||
strcat (buf, fn);
|
||||
|
||||
if (!(df = opendir (buf))) {
|
||||
msgDebug("%s: Cannot opendir\n", buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
p = buf + strlen (buf);
|
||||
*p++ = '/';
|
||||
n_dirs = fs->st_nlink;
|
||||
while ((dp = readdir (df)) != NULL) {
|
||||
if (dp->d_name[strlen(dp->d_name) - 1] == '~')
|
||||
continue;
|
||||
strcpy (p, dp->d_name);
|
||||
|
||||
if (n_dirs > 0) {
|
||||
if (stat (buf, &sb) < 0) {
|
||||
msgDebug("Can't stat: %s\n", buf);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
/* directory */
|
||||
n_dirs--;
|
||||
if (dp->d_name[0] == '.' &&
|
||||
(dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
|
||||
continue;
|
||||
if (!strcmp (dp->d_name, "RCS"))
|
||||
continue;
|
||||
if (!strcmp (dp->d_name, "SCCS"))
|
||||
continue;
|
||||
if (!strcmp (dp->d_name, "CVS"))
|
||||
continue;
|
||||
if (!strcmp (dp->d_name, "CVS.adm"))
|
||||
continue;
|
||||
ocurdir = rcurdir;
|
||||
rcurdir = buf;
|
||||
curdir = isDebug() ? buf : (char *)0;
|
||||
if (isDebug())
|
||||
msgDebug("%s:\n", buf);
|
||||
if ((stat(dp->d_name, &sc) < 0) && (errno == ENOENT)) {
|
||||
if (mkdir(dp->d_name, 0777) < 0 ||
|
||||
stat (dp->d_name, &sc) < 0) {
|
||||
msgDebug("Unable to make or stat: %s\n", dp->d_name);
|
||||
curdir = rcurdir = ocurdir;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
|
||||
msgDebug("%s: is a link instead of a directory\n", dp->d_name);
|
||||
curdir = rcurdir = ocurdir;
|
||||
continue;
|
||||
}
|
||||
if (chdir (dp->d_name) < 0) {
|
||||
msgDebug("Unable to chdir to: %s\n", dp->d_name);
|
||||
curdir = rcurdir = ocurdir;
|
||||
continue;
|
||||
}
|
||||
(void)dodir(buf, &sb, &sc, (buf[0] != '/'));
|
||||
if (chdir ("..") < 0) {
|
||||
msgDebug("Unable to get back to ..\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
curdir = rcurdir = ocurdir;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* non-directory */
|
||||
symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
|
||||
if (symlen >= 0) {
|
||||
symbuf[symlen] = '\0';
|
||||
if (!equivalent (symbuf, buf))
|
||||
msgDebug("%s: %s\n", dp->d_name, symbuf);
|
||||
} else if (symlink (buf, dp->d_name) < 0)
|
||||
msgDebug("Unable to create symlink: %s\n", dp->d_name);
|
||||
}
|
||||
|
||||
closedir (df);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
lndir(char *from, char *to)
|
||||
{
|
||||
struct stat fs, ts;
|
||||
|
||||
if (!to)
|
||||
to = ".";
|
||||
|
||||
/* to directory */
|
||||
if (stat(to, &ts) < 0) {
|
||||
msgDebug("Destination directory doesn't exist: %s\n", to);
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (!(S_ISDIR(ts.st_mode))) {
|
||||
msgDebug ("%s: Not a directory\n", to);
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (chdir(to) < 0) {
|
||||
msgDebug("Unable to chdir to %s\n", to);
|
||||
return RET_FAIL;
|
||||
}
|
||||
/* from directory */
|
||||
if (stat(from, &fs) < 0) {
|
||||
msgDebug("From directory doesn't exist: %s\n", from);
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (!(S_ISDIR(fs.st_mode))) {
|
||||
msgDebug ("%s: Not a directory\n", from);
|
||||
return RET_FAIL;
|
||||
}
|
||||
return dodir(from, &fs, &ts, 0);
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: options.c,v 1.23 1995/10/22 01:32:57 jkh Exp $
|
||||
* $Id: options.c,v 1.25 1995/10/26 08:56:06 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
@ -100,11 +100,11 @@ mediaCheck(Option opt)
|
|||
return "<unset>";
|
||||
}
|
||||
|
||||
#define TAPE_PROMPT "Please enter the tape block size in 512 byte blocks"
|
||||
#define RELNAME_PROMPT "Please specify the release you wish to load"
|
||||
#define TAPE_PROMPT "Please enter the tape block size in 512 byte blocks:"
|
||||
#define RELNAME_PROMPT "Please specify the release you wish to load:"
|
||||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define CONFIG_PROMPT "Please specify the name of a configuration file"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
|
@ -118,7 +118,7 @@ static Option Options[] = {
|
|||
{ "FTP OnError", "What to do when FTP requests fail: abort, retry, reselect.",
|
||||
OPT_IS_FUNC, mediaSetFtpOnError, VAR_FTP_ONERROR, varCheck },
|
||||
{ "FTP Retries", "If FTP OnError == retry, this is the number of times to try.",
|
||||
OPT_IS_VAR, NULL, VAR_FTP_RETRIES, varCheck },
|
||||
OPT_IS_VAR, RETRY_PROMPT, VAR_FTP_RETRIES, varCheck },
|
||||
{ "FTP username", "Username and password to use instead of anonymous",
|
||||
OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck },
|
||||
{ "Tape Blocksize", "Tape media block size in 512 byte blocks",
|
||||
|
@ -127,12 +127,10 @@ static Option Options[] = {
|
|||
OPT_IS_FUNC, mediaSetCPIOVerbosity, VAR_CPIO_VERBOSITY, varCheck },
|
||||
{ "Release Name", "Which release to attempt to load from installation media",
|
||||
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
|
||||
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML",
|
||||
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
|
||||
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
|
||||
{ "Browser Exec", "This is the path to the main binary of the browser package",
|
||||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Config File", "Name of default configuration file for Load command (top menu)",
|
||||
OPT_IS_VAR, CONFIG_PROMPT, VAR_CONFIG_FILE, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: installUpgrade.c,v 1.11 1995/10/26 08:55:49 jkh Exp $
|
||||
* $Id: installUpgrade.c,v 1.12 1995/10/27 03:59:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
@ -320,20 +320,11 @@ installUpgrade(char *str)
|
|||
}
|
||||
}
|
||||
|
||||
if (installNetworking("upgrade") == RET_FAIL) {
|
||||
dialog_clear();
|
||||
msgConfirm("Some of the networking configuration stuff evidently failed, but\n"
|
||||
"the first stage of the upgrade should otherwise be considered a\n"
|
||||
"success!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("First stage of upgrade completed successfully!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
}
|
||||
dialog_clear();
|
||||
msgConfirm("First stage of upgrade completed successfully!\n\n"
|
||||
"Next comes stage 2, where we attempt to resurrect your /etc\n"
|
||||
"directory!");
|
||||
|
||||
if (chdir(saved_etc)) {
|
||||
dialog_clear();
|
||||
msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: options.c,v 1.23 1995/10/22 01:32:57 jkh Exp $
|
||||
* $Id: options.c,v 1.25 1995/10/26 08:56:06 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
@ -100,11 +100,11 @@ mediaCheck(Option opt)
|
|||
return "<unset>";
|
||||
}
|
||||
|
||||
#define TAPE_PROMPT "Please enter the tape block size in 512 byte blocks"
|
||||
#define RELNAME_PROMPT "Please specify the release you wish to load"
|
||||
#define TAPE_PROMPT "Please enter the tape block size in 512 byte blocks:"
|
||||
#define RELNAME_PROMPT "Please specify the release you wish to load:"
|
||||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define CONFIG_PROMPT "Please specify the name of a configuration file"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
|
@ -118,7 +118,7 @@ static Option Options[] = {
|
|||
{ "FTP OnError", "What to do when FTP requests fail: abort, retry, reselect.",
|
||||
OPT_IS_FUNC, mediaSetFtpOnError, VAR_FTP_ONERROR, varCheck },
|
||||
{ "FTP Retries", "If FTP OnError == retry, this is the number of times to try.",
|
||||
OPT_IS_VAR, NULL, VAR_FTP_RETRIES, varCheck },
|
||||
OPT_IS_VAR, RETRY_PROMPT, VAR_FTP_RETRIES, varCheck },
|
||||
{ "FTP username", "Username and password to use instead of anonymous",
|
||||
OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck },
|
||||
{ "Tape Blocksize", "Tape media block size in 512 byte blocks",
|
||||
|
@ -127,12 +127,10 @@ static Option Options[] = {
|
|||
OPT_IS_FUNC, mediaSetCPIOVerbosity, VAR_CPIO_VERBOSITY, varCheck },
|
||||
{ "Release Name", "Which release to attempt to load from installation media",
|
||||
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
|
||||
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML",
|
||||
{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
|
||||
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
|
||||
{ "Browser Exec", "This is the path to the main binary of the browser package",
|
||||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Config File", "Name of default configuration file for Load command (top menu)",
|
||||
OPT_IS_VAR, CONFIG_PROMPT, VAR_CONFIG_FILE, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
|
|
Loading…
Reference in a new issue