1 /* install - copy files and set attributes
2 Copyright (C) 1989-1991, 1995-2010 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
22 #include <sys/types.h>
26 #include <selinux/selinux.h>
29 #include "backupfile.h"
33 #include "filenamecat.h"
34 #include "full-read.h"
35 #include "mkancesdirs.h"
37 #include "modechange.h"
38 #include "prog-fprintf.h"
42 #include "stat-time.h"
46 /* The official name of this program (e.g., no `g' prefix). */
47 #define PROGRAM_NAME "install"
49 #define AUTHORS proper_name ("David MacKenzie")
53 static int selinux_enabled = 0;
54 static bool use_default_selinux_context = true;
57 # define endgrent() ((void) 0)
61 # define endpwent() ((void) 0)
65 # define lchown(name, uid, gid) chown (name, uid, gid)
68 #if ! HAVE_MATCHPATHCON_INIT_PREFIX
69 # define matchpathcon_init_prefix(a, p) /* empty */
72 static bool change_timestamps (struct stat const *from_sb, char const *to);
73 static bool change_attributes (char const *name);
74 static bool copy_file (const char *from, const char *to,
75 const struct cp_options *x);
76 static bool install_file_in_file_parents (char const *from, char *to,
77 struct cp_options *x);
78 static bool install_file_in_dir (const char *from, const char *to_dir,
79 const struct cp_options *x);
80 static bool install_file_in_file (const char *from, const char *to,
81 const struct cp_options *x);
82 static void get_ids (void);
83 static void strip (char const *name);
84 static void announce_mkdir (char const *dir, void *options);
85 static int make_ancestor (char const *dir, char const *component,
87 void usage (int status);
89 /* The user name that will own the files, or NULL to make the owner
90 the current user ID. */
91 static char *owner_name;
93 /* The user ID corresponding to `owner_name'. */
94 static uid_t owner_id;
96 /* The group name that will own the files, or NULL to make the group
97 the current group ID. */
98 static char *group_name;
100 /* The group ID corresponding to `group_name'. */
101 static gid_t group_id;
103 #define DEFAULT_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
105 /* The file mode bits to which non-directory files will be set. The umask has
107 static mode_t mode = DEFAULT_MODE;
109 /* Similar, but for directories. */
110 static mode_t dir_mode = DEFAULT_MODE;
112 /* The file mode bits that the user cares about. This should be a
113 superset of DIR_MODE and a subset of CHMOD_MODE_BITS. This matters
114 for directories, since otherwise directories may keep their S_ISUID
116 static mode_t dir_mode_bits = CHMOD_MODE_BITS;
118 /* Compare files before installing (-C) */
119 static bool copy_only_if_needed;
121 /* If true, strip executable files after copying them. */
122 static bool strip_files;
124 /* If true, install a directory instead of a regular file. */
127 /* Program used to strip binaries, "strip" is default */
128 static char const *strip_program = "strip";
130 /* For long options that have no equivalent short option, use a
131 non-character as a pseudo short option, starting with CHAR_MAX + 1. */
134 PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1,
135 PRESERVE_CONTEXT_OPTION_DEPRECATED,
139 static struct option const long_options[] =
141 {"backup", optional_argument, NULL, 'b'},
142 {"compare", no_argument, NULL, 'C'},
143 {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
144 {"directory", no_argument, NULL, 'd'},
145 {"group", required_argument, NULL, 'g'},
146 {"mode", required_argument, NULL, 'm'},
147 {"no-target-directory", no_argument, NULL, 'T'},
148 {"owner", required_argument, NULL, 'o'},
149 {"preserve-timestamps", no_argument, NULL, 'p'},
150 {"preserve-context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
151 /* --preserve_context was silently supported until Apr 2009.
152 FIXME: disable altogether in a year or so. */
153 {"preserve_context", no_argument, NULL, PRESERVE_CONTEXT_OPTION_DEPRECATED},
154 {"strip", no_argument, NULL, 's'},
155 {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
156 {"suffix", required_argument, NULL, 'S'},
157 {"target-directory", required_argument, NULL, 't'},
158 {"verbose", no_argument, NULL, 'v'},
159 {GETOPT_HELP_OPTION_DECL},
160 {GETOPT_VERSION_OPTION_DECL},
164 /* Compare content of opened files using file descriptors A_FD and B_FD. Return
165 true if files are equal. */
167 have_same_content (int a_fd, int b_fd)
169 enum { CMP_BLOCK_SIZE = 4096 };
170 static char a_buff[CMP_BLOCK_SIZE];
171 static char b_buff[CMP_BLOCK_SIZE];
174 while (0 < (size = full_read (a_fd, a_buff, sizeof a_buff))) {
175 if (size != full_read (b_fd, b_buff, sizeof b_buff))
178 if (memcmp (a_buff, b_buff, size) != 0)
185 /* Return true for mode with non-permission bits. */
187 extra_mode (mode_t input)
189 mode_t mask = S_IRWXUGO | S_IFMT;
190 return !! (input & ~ mask);
193 /* Return true if copy of file SRC_NAME to file DEST_NAME is necessary. */
195 need_copy (const char *src_name, const char *dest_name,
196 const struct cp_options *x)
198 struct stat src_sb, dest_sb;
202 if (extra_mode (mode))
205 /* compare files using stat */
206 if (lstat (src_name, &src_sb) != 0)
209 if (lstat (dest_name, &dest_sb) != 0)
212 if (!S_ISREG (src_sb.st_mode) || !S_ISREG (dest_sb.st_mode)
213 || extra_mode (src_sb.st_mode) || extra_mode (dest_sb.st_mode))
216 if (src_sb.st_size != dest_sb.st_size
217 || (dest_sb.st_mode & CHMOD_MODE_BITS) != mode
218 || dest_sb.st_uid != (owner_id == (uid_t) -1 ? getuid () : owner_id)
219 || dest_sb.st_gid != (group_id == (gid_t) -1 ? getgid () : group_id))
222 /* compare SELinux context if preserving */
223 if (selinux_enabled && x->preserve_security_context)
225 security_context_t file_scontext = NULL;
226 security_context_t to_scontext = NULL;
229 if (getfilecon (src_name, &file_scontext) == -1)
232 if (getfilecon (dest_name, &to_scontext) == -1)
234 freecon (file_scontext);
238 scontext_match = STREQ (file_scontext, to_scontext);
240 freecon (file_scontext);
241 freecon (to_scontext);
246 /* compare files content */
247 src_fd = open (src_name, O_RDONLY | O_BINARY);
251 dest_fd = open (dest_name, O_RDONLY | O_BINARY);
258 content_match = have_same_content (src_fd, dest_fd);
262 return !content_match;
266 cp_option_init (struct cp_options *x)
268 cp_options_default (x);
269 x->copy_as_regular = true;
270 x->reflink_mode = REFLINK_NEVER;
271 x->dereference = DEREF_ALWAYS;
272 x->unlink_dest_before_opening = true;
273 x->unlink_dest_after_failed_open = false;
274 x->hard_link = false;
275 x->interactive = I_UNSPECIFIED;
276 x->move_mode = false;
277 x->one_file_system = false;
278 x->preserve_ownership = false;
279 x->preserve_links = false;
280 x->preserve_mode = false;
281 x->preserve_timestamps = false;
282 x->reduce_diagnostics=false;
283 x->data_copy_required = true;
284 x->require_preserve = false;
285 x->require_preserve_context = false;
286 x->require_preserve_xattr = false;
287 x->recursive = false;
288 x->sparse_mode = SPARSE_AUTO;
289 x->symbolic_link = false;
290 x->backup_type = no_backups;
292 /* Create destination files initially writable so we can run strip on them.
293 Although GNU strip works fine on read-only files, some others
296 x->mode = S_IRUSR | S_IWUSR;
297 x->stdin_tty = false;
299 x->open_dangling_dest_symlink = false;
301 x->preserve_security_context = false;
302 x->preserve_xattr = false;
308 #ifdef ENABLE_MATCHPATHCON
309 /* Modify file context to match the specified policy.
310 If an error occurs the file will remain with the default directory
313 setdefaultfilecon (char const *file)
316 security_context_t scontext = NULL;
317 static bool first_call = true;
319 if (selinux_enabled != 1)
321 /* Indicate no context found. */
324 if (lstat (file, &st) != 0)
327 if (first_call && IS_ABSOLUTE_FILE_NAME (file))
329 /* Calling matchpathcon_init_prefix (NULL, "/first_component/")
330 is an optimization to minimize the expense of the following
331 matchpathcon call. Do it only once, just before the first
332 matchpathcon call. We *could* call matchpathcon_fini after
333 the final matchpathcon call, but that's not necessary, since
334 by then we're about to exit, and besides, the buffers it
335 would free are still reachable. */
337 char const *p = file + 1;
341 /* Record final leading slash, for when FILE starts with two or more. */
351 while (*p && !ISSLASH (*p));
353 prefix = malloc (p - p0 + 2);
356 stpcpy (stpncpy (prefix, p0, p - p0), "/");
357 matchpathcon_init_prefix (NULL, prefix);
364 /* If there's an error determining the context, or it has none,
365 return to allow default context */
366 if ((matchpathcon (file, st.st_mode, &scontext) != 0) ||
367 STREQ (scontext, "<<none>>"))
369 if (scontext != NULL)
374 if (lsetfilecon (file, scontext) < 0 && errno != ENOTSUP)
376 _("warning: %s: failed to change context to %s"),
377 quotearg_colon (file), scontext);
384 setdefaultfilecon (char const *file)
390 /* FILE is the last operand of this command. Return true if FILE is a
391 directory. But report an error there is a problem accessing FILE,
392 or if FILE does not exist but would have to refer to an existing
393 directory if it referred to anything at all. */
396 target_directory_operand (char const *file)
398 char const *b = last_component (file);
399 size_t blen = strlen (b);
400 bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
402 int err = (stat (file, &st) == 0 ? 0 : errno);
403 bool is_a_dir = !err && S_ISDIR (st.st_mode);
404 if (err && err != ENOENT)
405 error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
406 if (is_a_dir < looks_like_a_dir)
407 error (EXIT_FAILURE, err, _("target %s is not a directory"), quote (file));
411 /* Process a command-line file name, for the -d option. */
413 process_dir (char *dir, struct savewd *wd, void *options)
415 return (make_dir_parents (dir, wd,
416 make_ancestor, options,
417 dir_mode, announce_mkdir,
418 dir_mode_bits, owner_id, group_id, false)
424 main (int argc, char **argv)
427 int exit_status = EXIT_SUCCESS;
428 const char *specified_mode = NULL;
429 bool make_backups = false;
430 char *backup_suffix_string;
431 char *version_control_string = NULL;
432 bool mkdir_and_install = false;
434 char const *target_directory = NULL;
435 bool no_target_directory = false;
438 bool strip_program_specified = false;
439 security_context_t scontext = NULL;
440 /* set iff kernel has extra selinux system calls */
441 selinux_enabled = (0 < is_selinux_enabled ());
443 initialize_main (&argc, &argv);
444 set_program_name (argv[0]);
445 setlocale (LC_ALL, "");
446 bindtextdomain (PACKAGE, LOCALEDIR);
447 textdomain (PACKAGE);
449 atexit (close_stdin);
459 /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
460 we'll actually use backup_suffix_string. */
461 backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
463 while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options,
471 version_control_string = optarg;
476 copy_only_if_needed = true;
481 /* System V fork+wait does not work if SIGCHLD is ignored. */
482 signal (SIGCHLD, SIG_DFL);
485 case STRIP_PROGRAM_OPTION:
486 strip_program = xstrdup (optarg);
487 strip_program_specified = true;
493 mkdir_and_install = true;
502 specified_mode = optarg;
508 x.preserve_timestamps = true;
512 backup_suffix_string = optarg;
515 if (target_directory)
516 error (EXIT_FAILURE, 0,
517 _("multiple target directories specified"));
521 if (stat (optarg, &st) != 0)
522 error (EXIT_FAILURE, errno, _("accessing %s"), quote (optarg));
523 if (! S_ISDIR (st.st_mode))
524 error (EXIT_FAILURE, 0, _("target %s is not a directory"),
527 target_directory = optarg;
530 no_target_directory = true;
533 case PRESERVE_CONTEXT_OPTION_DEPRECATED:
534 error (0, 0, _("WARNING: --preserve_context is deprecated; "
535 "use --preserve-context instead"));
537 case PRESERVE_CONTEXT_OPTION:
538 if ( ! selinux_enabled)
540 error (0, 0, _("WARNING: ignoring --preserve-context; "
541 "this kernel is not SELinux-enabled"));
544 x.preserve_security_context = true;
545 use_default_selinux_context = false;
548 if ( ! selinux_enabled)
550 error (0, 0, _("WARNING: ignoring --context (-Z); "
551 "this kernel is not SELinux-enabled"));
555 use_default_selinux_context = false;
557 case_GETOPT_HELP_CHAR;
558 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
560 usage (EXIT_FAILURE);
564 /* Check for invalid combinations of arguments. */
565 if (dir_arg && strip_files)
566 error (EXIT_FAILURE, 0,
567 _("the strip option may not be used when installing a directory"));
568 if (dir_arg && target_directory)
569 error (EXIT_FAILURE, 0,
570 _("target directory not allowed when installing a directory"));
572 if (x.preserve_security_context && scontext != NULL)
573 error (EXIT_FAILURE, 0,
574 _("cannot force target context to %s and preserve it"),
577 if (backup_suffix_string)
578 simple_backup_suffix = xstrdup (backup_suffix_string);
580 x.backup_type = (make_backups
581 ? xget_version (_("backup type"),
582 version_control_string)
585 if (scontext && setfscreatecon (scontext) < 0)
586 error (EXIT_FAILURE, errno,
587 _("failed to set default file creation context to %s"),
590 n_files = argc - optind;
591 file = argv + optind;
593 if (n_files <= ! (dir_arg || target_directory))
596 error (0, 0, _("missing file operand"));
598 error (0, 0, _("missing destination file operand after %s"),
600 usage (EXIT_FAILURE);
603 if (no_target_directory)
605 if (target_directory)
606 error (EXIT_FAILURE, 0,
607 _("cannot combine --target-directory (-t) "
608 "and --no-target-directory (-T)"));
611 error (0, 0, _("extra operand %s"), quote (file[2]));
612 usage (EXIT_FAILURE);
615 else if (! (dir_arg || target_directory))
617 if (2 <= n_files && target_directory_operand (file[n_files - 1]))
618 target_directory = file[--n_files];
619 else if (2 < n_files)
620 error (EXIT_FAILURE, 0, _("target %s is not a directory"),
621 quote (file[n_files - 1]));
626 struct mode_change *change = mode_compile (specified_mode);
628 error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
629 mode = mode_adjust (0, false, 0, change, NULL);
630 dir_mode = mode_adjust (0, true, 0, change, &dir_mode_bits);
634 if (strip_program_specified && !strip_files)
635 error (0, 0, _("WARNING: ignoring --strip-program option as -s option was "
638 if (copy_only_if_needed && x.preserve_timestamps)
640 error (0, 0, _("options --compare (-C) and --preserve-timestamps are "
641 "mutually exclusive"));
642 usage (EXIT_FAILURE);
645 if (copy_only_if_needed && strip_files)
647 error (0, 0, _("options --compare (-C) and --strip are mutually "
649 usage (EXIT_FAILURE);
652 if (copy_only_if_needed && extra_mode (mode))
653 error (0, 0, _("the --compare (-C) option is ignored when you"
654 " specify a mode with non-permission bits"));
659 exit_status = savewd_process_files (n_files, file, process_dir, &x);
662 /* FIXME: it's a little gross that this initialization is
663 required by copy.c::copy. */
666 if (!target_directory)
668 if (! (mkdir_and_install
669 ? install_file_in_file_parents (file[0], file[1], &x)
670 : install_file_in_file (file[0], file[1], &x)))
671 exit_status = EXIT_FAILURE;
677 for (i = 0; i < n_files; i++)
678 if (! install_file_in_dir (file[i], target_directory, &x))
679 exit_status = EXIT_FAILURE;
686 /* Copy file FROM onto file TO, creating any missing parent directories of TO.
687 Return true if successful. */
690 install_file_in_file_parents (char const *from, char *to,
691 struct cp_options *x)
693 bool save_working_directory =
694 ! (IS_ABSOLUTE_FILE_NAME (from) && IS_ABSOLUTE_FILE_NAME (to));
695 int status = EXIT_SUCCESS;
699 if (! save_working_directory)
702 if (mkancesdirs (to, &wd, make_ancestor, x) == -1)
704 error (0, errno, _("cannot create directory %s"), to);
705 status = EXIT_FAILURE;
708 if (save_working_directory)
710 int restore_result = savewd_restore (&wd, status);
711 int restore_errno = errno;
713 if (EXIT_SUCCESS < restore_result)
715 if (restore_result < 0 && status == EXIT_SUCCESS)
717 error (0, restore_errno, _("cannot create directory %s"), to);
722 return (status == EXIT_SUCCESS && install_file_in_file (from, to, x));
725 /* Copy file FROM onto file TO and give TO the appropriate
727 Return true if successful. */
730 install_file_in_file (const char *from, const char *to,
731 const struct cp_options *x)
734 if (x->preserve_timestamps && stat (from, &from_sb) != 0)
736 error (0, errno, _("cannot stat %s"), quote (from));
739 if (! copy_file (from, to, x))
743 if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))
744 && ! change_timestamps (&from_sb, to))
746 return change_attributes (to);
749 /* Copy file FROM into directory TO_DIR, keeping its same name,
750 and give the copy the appropriate attributes.
751 Return true if successful. */
754 install_file_in_dir (const char *from, const char *to_dir,
755 const struct cp_options *x)
757 const char *from_base = last_component (from);
758 char *to = file_name_concat (to_dir, from_base, NULL);
759 bool ret = install_file_in_file (from, to, x);
764 /* Copy file FROM onto file TO, creating TO if necessary.
765 Return true if successful. */
768 copy_file (const char *from, const char *to, const struct cp_options *x)
772 if (copy_only_if_needed && !need_copy (from, to, x))
775 /* Allow installing from non-regular files like /dev/null.
776 Charles Karney reported that some Sun version of install allows that
777 and that sendmail's installation process relies on the behavior.
778 However, since !x->recursive, the call to "copy" will fail if FROM
781 return copy (from, to, false, x, ©_into_self, NULL);
784 /* Set the attributes of file or directory NAME.
785 Return true if successful. */
788 change_attributes (char const *name)
791 /* chown must precede chmod because on some systems,
792 chown clears the set[ug]id bits for non-superusers,
793 resulting in incorrect permissions.
794 On System V, users can give away files with chown and then not
795 be able to chmod them. So don't give files away.
797 We don't normally ignore errors from chown because the idea of
798 the install command is that the file is supposed to end up with
799 precisely the attributes that the user specified (or defaulted).
800 If the file doesn't end up with the group they asked for, they'll
803 if (! (owner_id == (uid_t) -1 && group_id == (gid_t) -1)
804 && lchown (name, owner_id, group_id) != 0)
805 error (0, errno, _("cannot change ownership of %s"), quote (name));
806 else if (chmod (name, mode) != 0)
807 error (0, errno, _("cannot change permissions of %s"), quote (name));
811 if (use_default_selinux_context)
812 setdefaultfilecon (name);
817 /* Set the timestamps of file TO to match those of file FROM.
818 Return true if successful. */
821 change_timestamps (struct stat const *from_sb, char const *to)
823 struct timespec timespec[2];
824 timespec[0] = get_stat_atime (from_sb);
825 timespec[1] = get_stat_mtime (from_sb);
827 if (utimens (to, timespec))
829 error (0, errno, _("cannot set time stamps for %s"), quote (to));
835 /* Strip the symbol table from the file NAME.
836 We could dig the magic number out of the file first to
837 determine whether to strip it, but the header files and
838 magic numbers vary so much from system to system that making
839 it portable would be very difficult. Not worth the effort. */
842 strip (char const *name)
850 error (EXIT_FAILURE, errno, _("fork system call failed"));
853 execlp (strip_program, strip_program, name, NULL);
854 error (EXIT_FAILURE, errno, _("cannot run %s"), strip_program);
856 default: /* Parent. */
857 if (waitpid (pid, &status, 0) < 0)
858 error (EXIT_FAILURE, errno, _("waiting for strip"));
859 else if (! WIFEXITED (status) || WEXITSTATUS (status))
860 error (EXIT_FAILURE, 0, _("strip process terminated abnormally"));
865 /* Initialize the user and group ownership of the files to install. */
875 pw = getpwnam (owner_name);
878 unsigned long int tmp;
879 if (xstrtoul (owner_name, NULL, 0, &tmp, NULL) != LONGINT_OK
881 error (EXIT_FAILURE, 0, _("invalid user %s"), quote (owner_name));
885 owner_id = pw->pw_uid;
889 owner_id = (uid_t) -1;
893 gr = getgrnam (group_name);
896 unsigned long int tmp;
897 if (xstrtoul (group_name, NULL, 0, &tmp, NULL) != LONGINT_OK
899 error (EXIT_FAILURE, 0, _("invalid group %s"), quote (group_name));
903 group_id = gr->gr_gid;
907 group_id = (gid_t) -1;
910 /* Report that directory DIR was made, if OPTIONS requests this. */
912 announce_mkdir (char const *dir, void *options)
914 struct cp_options const *x = options;
916 prog_fprintf (stdout, _("creating directory %s"), quote (dir));
919 /* Make ancestor directory DIR, whose last file name component is
920 COMPONENT, with options OPTIONS. Assume the working directory is
921 COMPONENT's parent. */
923 make_ancestor (char const *dir, char const *component, void *options)
925 int r = mkdir (component, DEFAULT_MODE);
927 announce_mkdir (dir, options);
934 if (status != EXIT_SUCCESS)
935 fprintf (stderr, _("Try `%s --help' for more information.\n"),
940 Usage: %s [OPTION]... [-T] SOURCE DEST\n\
941 or: %s [OPTION]... SOURCE... DIRECTORY\n\
942 or: %s [OPTION]... -t DIRECTORY SOURCE...\n\
943 or: %s [OPTION]... -d DIRECTORY...\n\
945 program_name, program_name, program_name, program_name);
948 This install program copies files (often just compiled) into destination\n\
949 locations you choose. If you want to download and install a ready-to-use\n\
950 package on a GNU/Linux system, you should instead be using a package manager\n\
951 like yum(1) or apt-get(1).\n\
953 In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to\n\
954 the existing DIRECTORY, while setting permission modes and owner/group.\n\
955 In the 4th form, create all components of the given DIRECTORY(ies).\n\
959 Mandatory arguments to long options are mandatory for short options too.\n\
962 --backup[=CONTROL] make a backup of each existing destination file\n\
963 -b like --backup but does not accept an argument\n\
965 -C, --compare compare each pair of source and destination files, and\n\
966 in some cases, do not modify the destination at all\n\
967 -d, --directory treat all arguments as directory names; create all\n\
968 components of the specified directories\n\
971 -D create all leading components of DEST except the last,\n\
972 then copy SOURCE to DEST\n\
973 -g, --group=GROUP set group ownership, instead of process' current group\n\
974 -m, --mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x\n\
975 -o, --owner=OWNER set ownership (super-user only)\n\
978 -p, --preserve-timestamps apply access/modification times of SOURCE files\n\
979 to corresponding destination files\n\
980 -s, --strip strip symbol tables\n\
981 --strip-program=PROGRAM program used to strip binaries\n\
982 -S, --suffix=SUFFIX override the usual backup suffix\n\
983 -t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY\n\
984 -T, --no-target-directory treat DEST as a normal file\n\
985 -v, --verbose print the name of each directory as it is created\n\
988 --preserve-context preserve SELinux security context\n\
989 -Z, --context=CONTEXT set SELinux security context of files and directories\n\
992 fputs (HELP_OPTION_DESCRIPTION, stdout);
993 fputs (VERSION_OPTION_DESCRIPTION, stdout);
996 The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\
997 The version control method may be selected via the --backup option or through\n\
998 the VERSION_CONTROL environment variable. Here are the values:\n\
1002 none, off never make backups (even if --backup is given)\n\
1003 numbered, t make numbered backups\n\
1004 existing, nil numbered if numbered backups exist, simple otherwise\n\
1005 simple, never always make simple backups\n\
1007 emit_ancillary_info ();