2 static const char rcsid[] =
7 * FreeBSD install - a package for the installation and maintainance
8 * of non-core utilities.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
22 * Miscellaneous file access utilities.
31 * Assuming dir is a desired directory name, make it and all intervening
32 * directories necessary.
36 make_hierarchy(char *dir)
45 if ((cp2 = index(cp1, '/')) !=NULL )
55 if (vsystem("mkdir %s", dir)) {
60 apply_perms(NULL, dir);
71 /* Using permission defaults, apply them as necessary */
73 apply_perms(char *dir, char *arg)
77 if (!dir || *arg == '/') /* absolute path? */
83 if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg))
84 warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
86 if (vsystem("cd %s && chown -R %s.%s %s", cd_to, Owner, Group, arg))
87 warnx("couldn't change owner/group of '%s' to '%s.%s'",
92 if (vsystem("cd %s && chown -R %s %s", cd_to, Owner, arg))
93 warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
96 if (vsystem("cd %s && chgrp -R %s %s", cd_to, Group, arg))
97 warnx("couldn't change group of '%s' to '%s'", arg, Group);