/*
* 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
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* updatehome - Update the current label's $HOME copy and link files.
*
* Update home reads the user's minimum label copy and link
* control files (.copy_files and .link_files) which contain a list
* of files to be copied and symbolically linked from the user's minimum
* label $HOME to the user's current label's $HOME.
*
* This is done by the Trusted Solaris dtsession whenever a
* newly labeled workspace is created so that the user's favorite
* files are available for use. For example the user probably
* wants a symlink to .profile, .login, .cshrc, .exrc, .mailrc, ~/bin,
* ... . updatehome provides a convient mechanism for accomplishing
* this. The user may add any set of files either to be copied
* (.copy_files), or symbolically linked (.link_files).
*
* Files should not include embedded MLDs.
*
* Entry options = c, if replace existing current label $HOME copies
* (default is to ignore existing).
* d, if to print debug trace msgs (internal use only).
* i, if to ignore errors encountered (default is to
* abort).
* m, if to suppress error diagnostics -- perror
* (internal use only).
* r, if replace existing current label $HOME copies or
* symbolic links -- implies c and s (default is to
* ignore existing).
* s, if replace existing current label $HOME symbolic
* links (default is to ignore existing).
*
* Exit stderr = diagnostic messages.
* exis status = 0, no errors noted.
* 1, if errors noted.
*
* Calls __setupfiles (which does all the real work).
*/
/*
* There is a private contract between __setupfiles in this
* directory and login. Changes made to __setupfiles may need to be
* reflected in the source for login.
*
* G.Winiger 96/11/03
*/
#include <locale.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <user_attr.h>
#include "setupfiles.h"
#if !defined(TEXT_DOMAIN)
#endif /* !defined(TEXT_DOMAIN) */
int
{
extern int opterr; /* getopt error flag */
(void) textdomain(TEXT_DOMAIN);
opterr = 0; /* handle errors here */
switch (opt) {
case 'c': /* replace existing copy */
break;
case 'd': /* debug */
break;
break;
case 'm': /* suppress error diagnostic (perror) */
/* prints */
break;
case 'r': /* replace existing */
break;
case 's': /* replace existing symbolic links */
break;
case '?': /* switch error */
(char)optopt);
default:
argv[0]);
exit(1);
/*NOTREACHED*/
} /* switch (opt) */
} /* while ((opt = getopt()) */
exit(1);
}
gettext("Unable to get default user labels.\n"));
exit(1);
}
}
NULL) == -1) {
gettext("str_to_label failure on min_label for"
exit(1);
}
}
exit(1);
}
return (0);
} /* update home */