Deleted Added
full compact
nfs.c (9202) nfs.c (12661)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
7 * $Id: nfs.c,v 1.4.2.6 1995/06/10 02:21:40 jkh Exp $
7 * $Id: nfs.c,v 1.5.2.15 1995/11/04 11:09:16 jkh Exp $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 37 unchanged lines hidden (view full) ---

53Boolean
54mediaInitNFS(Device *dev)
55{
56 Device *netDevice = (Device *)dev->private;
57
58 if (NFSMounted)
59 return TRUE;
60
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 37 unchanged lines hidden (view full) ---

53Boolean
54mediaInitNFS(Device *dev)
55{
56 Device *netDevice = (Device *)dev->private;
57
58 if (NFSMounted)
59 return TRUE;
60
61 if (!(*netDevice->init)(netDevice))
61 if (!netDevice->init(netDevice))
62 return FALSE;
63
62 return FALSE;
63
64 if (Mkdir("/nfs", NULL))
64 if (Mkdir("/dist", NULL))
65 return FALSE;
66
65 return FALSE;
66
67 if (vsystem("mount_nfs %s %s %s /nfs", (OptFlags & OPT_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
68 (OptFlags & OPT_NFS_SECURE) ? "-P" : "", dev->name)) {
69 msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->name, strerror(errno), errno);
67 msgNotify("Mounting %s over NFS.", dev->name);
68 if (vsystem("mount_nfs %s %s %s /dist",
69 variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
70 variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name)) {
71 dialog_clear();
72 msgConfirm("Error mounting %s on /dist: %s (%u)", dev->name, strerror(errno), errno);
73 netDevice->shutdown(netDevice);
70 return FALSE;
71 }
72 NFSMounted = TRUE;
74 return FALSE;
75 }
76 NFSMounted = TRUE;
77 msgDebug("Mounted NFS device %s onto /dist\n", dev->name);
73 return TRUE;
74}
75
76int
78 return TRUE;
79}
80
81int
77mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs)
82mediaGetNFS(Device *dev, char *file, Boolean tentative)
78{
83{
79 char buf[PATH_MAX];
84 char buf[PATH_MAX];
80
85
81 snprintf(buf, PATH_MAX, "/nfs/%s", file);
82 if (!access(buf, R_OK))
86 msgDebug("Request for %s from NFS\n", file);
87 snprintf(buf, PATH_MAX, "/dist/%s", file);
88 if (file_readable(buf))
83 return open(buf, O_RDONLY);
89 return open(buf, O_RDONLY);
84 snprintf(buf, PATH_MAX, "/nfs/dists/%s", file);
90 snprintf(buf, PATH_MAX, "/dist/dists/%s", file);
91 if (file_readable(buf))
92 return open(buf, O_RDONLY);
93 snprintf(buf, PATH_MAX, "/dist/%s/%s", variable_get(VAR_RELNAME), file);
94 if (file_readable(buf))
95 return open(buf, O_RDONLY);
96 snprintf(buf, PATH_MAX, "/dist/%s/dists/%s", variable_get(VAR_RELNAME), file);
85 return open(buf, O_RDONLY);
86}
87
88void
89mediaShutdownNFS(Device *dev)
90{
97 return open(buf, O_RDONLY);
98}
99
100void
101mediaShutdownNFS(Device *dev)
102{
91 Device *netdev = (Device *)dev->private;
103 /* Device *netdev = (Device *)dev->private; */
92
93 if (!NFSMounted)
94 return;
104
105 if (!NFSMounted)
106 return;
95 msgDebug("Unmounting /nfs\n");
96 if (unmount("/nfs", MNT_FORCE) != 0)
97 msgConfirm("Could not unmount the NFS partition: %s\n", strerror(errno));
98 if (isDebug())
99 msgDebug("Unmount returned\n");
100 (*netdev->shutdown)(netdev);
107 msgNotify("Unmounting NFS partition on /dist");
108 if (unmount("/dist", MNT_FORCE) != 0) {
109 dialog_clear();
110 msgConfirm("Could not unmount the NFS partition: %s", strerror(errno));
111 }
112 msgDebug("Unmount of NFS partition successful\n");
113 /* (*netdev->shutdown)(netdev); */
101 NFSMounted = FALSE;
102 return;
103}
114 NFSMounted = FALSE;
115 return;
116}