Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 345584 Details for
Bug 465914
net-misc/chrony - add pkg_config()
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
add emerge --config to chrony
chronyd_add_emerge_config.patch (text/plain), 4.18 KB, created by
Enrico Tagliavini
on 2013-04-14 17:30:55 UTC
(
hide
)
Description:
add emerge --config to chrony
Filename:
MIME Type:
Creator:
Enrico Tagliavini
Created:
2013-04-14 17:30:55 UTC
Size:
4.18 KB
patch
obsolete
>diff --git a/net-misc/chrony/chrony-1.27-r1.ebuild b/net-misc/chrony/chrony-1.27-r1.ebuild >index e534d36..c19190d 100644 >--- a/net-misc/chrony/chrony-1.27-r1.ebuild >+++ b/net-misc/chrony/chrony-1.27-r1.ebuild >@@ -73,4 +73,79 @@ src_install() { > systemd_dounit "${FILESDIR}"/chronyd.service > insinto $(systemd_get_utildir)/ntp-units.d/ > doins "${FILESDIR}"/50-chrony.list >+ >+ #NetworkManager dispatcher file >+ exeinto /etc/NetworkManager/dispatcher.d >+ doexe "${FILESDIR}"/11-chrony >+} >+ >+pkg_config() { >+ CONFIGFILE=/etc/chrony/chrony.conf >+ KEYFILE=/etc/chrony/chrony.keys >+ einfo "This helper is going to overwrite your chrony config file:" >+ einfo " ${CONFIGFILE}" >+ einfo "and the keyfile:" >+ einfo " ${KEYFILE}" >+ einfo "If you are sure, type YES all uppercase" >+ read ANSW >+ [ "${ANSW}" != YES ] && return >+ einfo "Is your RTC in UTC? [yes|no]" >+ read ANSW >+ local utc='#rtconutc' >+ case "${ANSW,,}" in >+ yes) >+ utc=rtconutc >+ ;; >+ no) ;; >+ *) >+ ewarn "Please answer yes or no" >+ return 1 ;; >+ esac >+ einfo "Are you always connected to the internet?" >+ einfo "If you are a NetworkManager user, please answer no" >+ einfo "a NetworkManager script is installed and it should notify" >+ einfo "the running chronyd automatically" >+ einfo "If you are a laptop user you almost surely want to say no here" >+ einfo "and, if not using NetworkManager, make a script to notify chronyd" >+ read ANSW >+ local always_online= >+ case "${ANSW,,}" in >+ yes) ;; >+ no) >+ always_online=offline >+ ;; >+ *) >+ ewarn "Please answer yes or no" >+ return 1 ;; >+ esac >+ >+ echo -n "1 " > ${KEYFILE} >+ # generate a new password >+ dd if=/dev/urandom count=1 bs=32 2>/dev/null | base64 -w 0 | tr -d '/=+' >> \ >+ ${KEYFILE} >+ echo >> ${KEYFILE} >+ # can't use ${FILESDIR} inside pkg_config >+ # any better solution? >+ cat > ${CONFIGFILE} << EOF >+# Pools for Gentoo users >+server 0.gentoo.pool.ntp.org ${always_online} >+server 1.gentoo.pool.ntp.org ${always_online} >+server 2.gentoo.pool.ntp.org ${always_online} >+server 3.gentoo.pool.ntp.org ${always_online} >+ >+keyfile /etc/chrony/chrony.keys >+commandkey 1 >+driftfile /etc/chrony/chrony.drift >+ >+# the RTC can be set in UTC, this solves a lot of problems >+# but remeber to disable the automatic clock update in windows >+${utc} >+ >+# for additional accuracy >+logdir /var/log/chrony >+log statistics measurements tracking >+dumpdir /var/log/chrony >+rtcfile /etc/chrony/chrony.rtc >+EOF >+ einfo "Configure complete. Please restart chronyd" > } >diff --git a/net-misc/chrony/files/11-chrony b/net-misc/chrony/files/11-chrony >new file mode 100755 >index 0000000..d1e4653 >--- /dev/null >+++ b/net-misc/chrony/files/11-chrony >@@ -0,0 +1,50 @@ >+#!/bin/bash >+ >+set -u >+ >+CONFFILE=/etc/chrony/chrony.conf >+ >+# search $CONFFILE for the key passed as $1. echo it. Return 1 if not found >+# or if awk returns non zero. $2 is the path to the config file >+getconf() { >+ local key=$1 >+ local cfile="$2" >+ local value=$(awk "/^$key/ {print \$2}" "$cfile" 2>/dev/null) >+ [ $? -ne 0 ] && return 1 >+ [ -z "$value" ] && return 1 >+ echo "$value" >+ return 0 >+} >+ >+# read chrony config and retrive the current commandkey from the keyfile >+# returns 1 if something fails >+getpassword() { >+ keyfile=$(getconf keyfile "$CONFFILE") >+ [ $? -ne 0 ] && return 1 >+ keynum=$(getconf commandkey "$CONFFILE") >+ [ $? -ne 0 ] && return 1 >+ password=$(getconf $keynum "$keyfile") >+ [ $? -ne 0 ] && return 1 >+ echo $password >+ return 0 >+} >+ >+password=$(getpassword) >+[ $? -ne 0 ] && exit 1 >+ >+case "$2" in >+ up) >+ /usr/bin/chronyc << EOF >+password $password >+online >+EOF >+ ;; >+ down) >+ /usr/bin/chronyc << EOF >+password $password >+offline >+dump >+writertc >+EOF >+ ;; >+esac >\ No newline at end of file >diff --git a/net-misc/chrony/files/chronyd.init b/net-misc/chrony/files/chronyd.init >index c06a822..fb17434 100644 >--- a/net-misc/chrony/files/chronyd.init >+++ b/net-misc/chrony/files/chronyd.init >@@ -21,7 +21,7 @@ checkconfig() { > eerror " chrony.keys.example" > eerror "" > eerror "files (from the documentation directory)" >- eerror "as templates." >+ eerror "as templates, or with emerge --config chronyd" > return 1 > else > # Actually, I tried it, and chrony seems to ignore the pidfile
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 465914
: 345584