install.bin.c revision b83ec4ed825d984ca8f038544e15b4ca0eac82c7
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <libgen.h>
#include "stdusers.h"
#define FILE_BUFF 40960
static int suppress = 0;
static void usage(void);
static char *find_basename(const char *str);
void
usage(void)
{
"usage: install [-sdO][-m mode][-g group][-u owner] "
"-f dir file ...\n");
}
void
{
int src_fd;
int dest_fd;
int count;
exit(1);
}
exit(1);
}
}
if (count == -1) {
exit(1);
}
if (!suppress)
}
void
{
if (group) {
if (grp < 0)
}
if (owner) {
if (own < 0) {
exit(1);
}
}
exit(1);
}
}
void
{
char *temp;
temp++;
}
char *
find_basename(const char *str)
{
int i;
int len;
for (i = len-1; i >= 0; i--)
if (str[i] == '/')
return ((char *)(str + i + 1));
return ((char *)str);
}
int
errno = 0;
return (errno);
} else if (!suppress) {
}
return (0);
}
int
{
int c;
int errflg = 0;
int dirflg = 0;
int mode = -1;
char dest_file[MAXPATHLEN];
char shadow_dest[MAXPATHLEN];
char shadow_dirb[MAXPATHLEN];
int tonic = 0;
int rv = 0;
switch (c) {
case 'f':
break;
case 'g':
break;
case 'u':
break;
case 'd':
dirflg = 1;
break;
case 'm':
break;
case 's':
suppress = 1;
break;
case 'O':
tonic = 1;
break;
case '?':
errflg++;
break;
}
}
if (errflg) {
usage();
return (1);
}
usage();
return (1);
}
"install: no destination directory specified.\n");
return (1);
}
if (dirflg) {
if (tonic) {
if (rv) {
"install: tonic creatdir "
"%s (%d): (%s)\n",
return (rv);
}
}
if (rv) {
"install: creatdir %s (%d): %s\n",
return (rv);
}
} else {
if (tonic) {
/*
* The standard directories in the proto
* area are created as part of "make setup",
* but that doesn't create them in the
* closed proto area. So if the target
* directory doesn't exist, we need to
* create it now.
*/
if (rv) {
"install: tonic creatdir(f) "
"%s (%d): %s\n",
return (rv);
}
shadow_dirb), "/"),
}
}
if (tonic)
}
if (mode != -1) {
(void) umask(0);
"install: chmod of %s to mode %o failed "
"(%d): %s\n",
return (1);
}
if (tonic) {
"install: tonic chmod of %s "
"to mode %o failed (%d): %s\n",
return (1);
}
}
}
}
return (0);
}