dh-systemdはdebhelper 9.20160709で統合された

  • 0
    いいね
  • 0
    コメント
      * Apply patches from Michael Biebl to merge dh_systemd_enable
        and dh_systemd_start from the dh-systemd package.
        (Closes: #822670)
      * dh: Enable the systemd helpers by default in compat 10 and
        later.
    

    ということは dh-systemd パッケージをbuild-dependsに含めなくてもいい。

    • debian/compat が 10
    • debian/control で Build-Depends: debhelper (>= 9.20160709)

    が必要要件。

    aptもこんな風にできるよな

    diff -Nru apt-1.3~rc2/debian/changelog apt-1.3~rc2+nmu1/debian/changelog
    --- apt-1.3~rc2/debian/changelog    2016-08-18 06:31:07.000000000 +0900
    +++ apt-1.3~rc2+nmu1/debian/changelog   2016-08-25 11:42:41.000000000 +0900
    @@ -1,3 +1,18 @@
    +apt (1.3~rc2+nmu1) UNRELEASED; urgency=medium
    +
    +  * Non-maintainer upload.
    +  * debian/compat
    +    - set 10
    +  * debian/control
    +    - set Build-Depends: debhelper (>= 9.20160709) to enable merged
    +      dh-systemd
    +    - remove Builde-Depends: dh-systemd  
    +  * debian/rules
    +    - remove "--with systemd --parallel" for dh since it is enabled
    +      by default now.
    +
    + -- Hideki Yamane <henrich@debian.org>  Thu, 25 Aug 2016 11:42:41 +0900
    +
     apt (1.3~rc2) unstable; urgency=medium
    
       [ Julian Andres Klode ]
    diff -Nru apt-1.3~rc2/debian/compat apt-1.3~rc2+nmu1/debian/compat
    --- apt-1.3~rc2/debian/compat   2016-08-18 06:31:07.000000000 +0900
    +++ apt-1.3~rc2+nmu1/debian/compat  2016-08-25 11:41:12.000000000 +0900
    @@ -1 +1 @@
    -9
    +10
    diff -Nru apt-1.3~rc2/debian/control apt-1.3~rc2+nmu1/debian/control
    --- apt-1.3~rc2/debian/control  2016-08-18 06:31:07.000000000 +0900
    +++ apt-1.3~rc2+nmu1/debian/control 2016-08-25 11:41:40.000000000 +0900
    @@ -6,11 +6,11 @@
      Julian Andres Klode <jak@debian.org>,
      David Kalnischkies <donkult@debian.org>
     Standards-Version: 3.9.8
    -Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20141010), libdb-dev,
    +Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20160709), libdb-dev,
      gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~),
      zlib1g-dev, libbz2-dev, liblzma-dev, liblz4-dev (>= 0.0~r126),
      xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2),
    - cmake (>= 3.4), pkg-config, libgtest-dev <!nocheck>, dh-systemd
    + cmake (>= 3.4), pkg-config, libgtest-dev <!nocheck>
     Build-Depends-Indep: doxygen, w3m, graphviz
     Build-Conflicts: autoconf2.13, automake1.4
     Vcs-Git: https://anonscm.debian.org/git/apt/apt.git
    diff -Nru apt-1.3~rc2/debian/rules apt-1.3~rc2+nmu1/debian/rules
    --- apt-1.3~rc2/debian/rules    2016-08-18 06:31:07.000000000 +0900
    +++ apt-1.3~rc2+nmu1/debian/rules   2016-08-25 11:41:55.000000000 +0900
    @@ -11,7 +11,7 @@
     export CTEST_OUTPUT_ON_FAILURE=1
    
     %:
    -   dh $@ --with systemd --parallel --buildsystem=cmake
    +   dh $@ --buildsystem=cmake
    
     override_dh_install-indep:
        dh_movefiles
    

    インストール先ディレクトリこれでいいの?

    $ tree /etc/systemd/
    /etc/systemd/
    ├── journald.conf
    ├── logind.conf
    ├── network
    ├── resolved.conf
    ├── system
    │   ├── basic.target.wants
    │   │   ├── snapper-cleanup.timer -> /lib/systemd/system/snapper-cleanup.timer
    │   │   └── snapper-timeline.timer -> /lib/systemd/system/snapper-timeline.timer
    (snip)
    │   └── timers.target.wants
    │       └── apt-daily.timer -> /lib/systemd/system/apt-daily.timer
    ├── system.conf
    ├── timesyncd.conf
    ├── user
    └── user.conf
    

    basic.target.wantsに入ってるけど、同じようなtimerのapt-daily.timerはtimers.target.wants以下に入ってる。このディレクトリは正しいのか?

    あー

    [Install]
    WantedBy=basic.target
    

    だから挙動は正しい。

    中井さんのSystemd入門(1) - Unitの概念を理解するより

    なお、serviceを有効化した際に、どのtargetの前提として設定するかは、そのserviceの設定ファイルの[Install]セクションにおいて、「WantedBy=」オプションで指定されています。

    basic.targetが妥当なのか、timers.targetなのか、というとtimersのほうが妥当ではないか?
    やっぱりそう

    It is recommended that timer units installed by applications get pulled in via Wants= dependencies from this unit. This is best configured via WantedBy=timers.target in the timer unit's "[Install]" section.