Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[timed] Change location of time zone link that timed manages #23

Merged
merged 1 commit into from Aug 7, 2013

Conversation

pgerdt
Copy link

@pgerdt pgerdt commented Aug 6, 2013

Timed links time zone files in /usr/share/zoneinfo to
/var/lib/timed, for example

/var/lib/timed/localtime -> /usr/share/zoneinfo/Europe/Helsinki

The system time zone /etc/localtime is in turn linked to
/var/lib/timed/localtime, so that it follows the time zone
set by timed.

These changes are required as timed is not run with root
priviledges, and it does not have the rights to change
/etc/localtime.

@@ -346,7 +348,7 @@ int source_settings::check_target(string path)
return -1 ;
// The file exists and is a regular file !
ino_t inode = s.st_ino ;
res = stat("/etc/localtime", &s) ;
res = stat("LOCALTIMELINK", &s) ;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be quoted, should it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, will remove quotes.

@pgerdt
Copy link
Author

pgerdt commented Aug 6, 2013

Updated pull request:

  • Removed quotes from around LOCALTIMELINK in settings.cpp as suggested by rburchell
  • Added %ghost directive for /var/lib/timed/localtime to spec file as suggested by saukko

@saukko
Copy link

saukko commented Aug 6, 2013

LGTM

tzset() ;
if(unlink_res)
{
log_error("can't unlink /etc/localtime: %m") ;
log_error("can't unlink LOCALTIMELINK: %m") ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we want to log the path, not the macro name?
"can't unlink "LOCALTIMELINK": %m"
or
"can't unlink %s: %m", LOCALTIMELINK

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, will fix.

@pgerdt
Copy link
Author

pgerdt commented Aug 6, 2013

Updated pull request:

  • Removed erroneous quotes around LOCALTIMELINK as suggested by spiiroin
  • Added group timed that has access to /var/lib/timed, add default user to group timed during installation


%pre
groupadd -rf timed
groupadd-user timed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these you need also to have Requires: lines set properly for oneshot.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added %{_oneshot_groupadd_requires_pre}, %{_oneshot_groupadd_requires_post}, other oneshot requires are already present.

Timed links time zone files in /usr/share/zoneinfo to
/var/lib/timed, for example

  /var/lib/timed/localtime -> /usr/share/zoneinfo/Europe/Helsinki

The system time zone /etc/localtime is in turn linked to
/var/lib/timed/localtime, so that it follows the time zone
set by timed.

The directory /var/lib/timed can be modified by root and
members of group timed, timed installation creates group
timed and adds the default user to the group.

These changes are required as timed is not run with root
privileges, and it does not have the rights to change
/etc/localtime.
@rburchell
Copy link

OK

pgerdt pushed a commit that referenced this pull request Aug 7, 2013
[timed] Change location of time zone link that timed manages
@pgerdt pgerdt merged commit 6ce2b7e into nemomobile:master Aug 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants