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 )
52 if (vsystem("mkdir %s", dir))
54 apply_perms(NULL, dir);
65 /* Using permission defaults, apply them as necessary */
67 apply_perms(char *dir, char *arg)
71 if (!dir || *arg == '/') /* absolute path? */
77 if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg))
78 warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
80 if (vsystem("cd %s && chown -R %s.%s %s", cd_to, Owner, Group, arg))
81 warnx("couldn't change owner/group of '%s' to '%s.%s'",
86 if (vsystem("cd %s && chown -R %s %s", cd_to, Owner, arg))
87 warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
90 if (vsystem("cd %s && chgrp -R %s %s", cd_to, Group, arg))
91 warnx("couldn't change group of '%s' to '%s'", arg, Group);