Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108409391
D37004.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D37004.diff
View Options
Index: usr.sbin/tzsetup/tzsetup.8
===================================================================
--- usr.sbin/tzsetup/tzsetup.8
+++ usr.sbin/tzsetup/tzsetup.8
@@ -32,7 +32,7 @@
.Nd set local timezone
.Sh SYNOPSIS
.Nm
-.Op Fl nrs
+.Op Fl clnrs
.Op Fl C Ar chroot_directory
.Op Ar zoneinfo_file | zoneinfo_name
.Sh DESCRIPTION
@@ -54,6 +54,10 @@
.It Fl C Ar chroot_directory
Open all files and directories relative to
.Ar chroot_directory .
+.It Fl c
+Install selected zoneinfo file by copying.
+.It Fl l
+Install selected zoneinfo file as a symbolic link.
.It Fl n
Do not create or copy files.
.It Fl r
Index: usr.sbin/tzsetup/tzsetup.c
===================================================================
--- usr.sbin/tzsetup/tzsetup.c
+++ usr.sbin/tzsetup/tzsetup.c
@@ -79,6 +79,10 @@
path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN],
path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN];
+enum {
+ mode_unset = 0, mode_copy, mode_symlink
+} copymode;
+
static int reallydoit = 1;
static int reinstall = 0;
static char *chrootenv = NULL;
@@ -654,18 +658,21 @@
char prompt[SILLY_BUFFER_SIZE];
struct stat sb;
ssize_t len;
- int fd1, fd2, copymode;
-
- if (lstat(path_localtime, &sb) < 0) {
- /* Nothing there yet... */
- copymode = 1;
- } else if (S_ISLNK(sb.st_mode))
- copymode = 0;
- else
- copymode = 1;
+ int fd1, fd2;
+
+ if (copymode == mode_unset) {
+ if (lstat(path_localtime, &sb) < 0) {
+ /* Nothing there yet... */
+ copymode = mode_copy;
+ } else if (S_ISLNK(sb.st_mode)) {
+ copymode = mode_symlink;
+ } else {
+ copymode = mode_copy;
+ }
+ }
#ifdef VERBOSE
- if (copymode)
+ if (copymode == mode_copy)
snprintf(prompt, sizeof(prompt),
"Copying %s to %s", zoneinfo_file, path_localtime);
else
@@ -676,7 +683,7 @@
#endif
if (reallydoit) {
- if (copymode) {
+ if (copymode == mode_copy) {
fd1 = open(zoneinfo_file, O_RDONLY, 0);
if (fd1 < 0) {
snprintf(prompt, sizeof(prompt),
@@ -745,7 +752,7 @@
}
#ifdef VERBOSE
- if (copymode)
+ if (copymode == mode_copy)
snprintf(prompt, sizeof(prompt),
"Copied timezone file from %s to %s",
zoneinfo_file, path_localtime);
@@ -814,11 +821,17 @@
strcmp(vm_guest, "none") != 0)
skiputc = 1;
- while ((c = getopt(argc, argv, "C:nrs")) != -1) {
+ while ((c = getopt(argc, argv, "C:clnrs")) != -1) {
switch(c) {
case 'C':
chrootenv = optarg;
break;
+ case 'c':
+ copymode = mode_copy;
+ break;
+ case 'l':
+ copymode = mode_symlink;
+ break;
case 'n':
reallydoit = 0;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 1:34 PM (17 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16145529
Default Alt Text
D37004.diff (2 KB)
Attached To
Mode
D37004: tzsetup: allow choice of copy or symlink for /etc/localtime
Attached
Detach File
Event Timeline
Log In to Comment