Skip to content

Commit

Permalink
cmake,deb: set EnvironmentFile using cmake
Browse files Browse the repository at this point in the history
this change also fix the EnvironmentFile specified in rbdmap.service.
without this change EnvironmentFile in rbdmap.service is always
/etc/sysconfig/ceph even on debian derived distros. after this change,
this variable is /etc/default/ceph in rbdmap.service shipped by the deb
packages.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Feb 27, 2018
1 parent 50707e7 commit 4865831
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 28 deletions.
14 changes: 2 additions & 12 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export DESTDIR=$(CURDIR)/debian/tmp
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

extraopts += -DUSE_CRYPTOPP=OFF -DWITH_OCF=ON -DWITH_LTTNG=ON -DWITH_PYTHON3=ON -DWITH_EMBEDDED=OFF
extraopts += -DWITH_CEPHFS_JAVA=ON -DWITH_SYSTEMD=ON
extraopts += -DWITH_CEPHFS_JAVA=ON
extraopts += -DWITH_SYSTEMD=ON -DCEPH_SYSTEMD_ENV_DIR=/etc/default
# assumes that ceph is exmpt from multiarch support, so we override the libdir.
extraopts += -DCMAKE_INSTALL_LIBDIR=/usr/lib
extraopts += -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib
Expand Down Expand Up @@ -83,17 +84,6 @@ override_dh_installinit:
install -d -m0755 debian/ceph-common/usr/lib/tmpfiles.d
install -m 0644 -D systemd/ceph.tmpfiles.d debian/ceph-common/usr/lib/tmpfiles.d/ceph.conf

sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mon/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/[email protected]

sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mds/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-fuse/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mgr/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/radosgw/lib/systemd/system/[email protected]
sed -i s./etc/sysconfig/./etc/default/.g debian/rbd-mirror/lib/systemd/system/[email protected]

dh_installinit -p ceph-base --name ceph --no-start
dh_installinit -p radosgw --no-start

Expand Down
29 changes: 21 additions & 8 deletions systemd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_LIBEXECDIR}/systemd/system"
CACHE PATH "Location for systemd service files")
set(CEPH_SYSTEMD_ENV_DIR "/etc/sysconf"
CACHE PATH "Location for systemd service environmental variable settings files")
set(SYSTEMD_ENV_FILE "${CEPH_SYSTEMD_ENV_DIR}/ceph")
foreach(service
ceph-fuse@
ceph-mds@
ceph-mgr@
ceph-mon@
ceph-osd@
ceph-radosgw@
ceph-rbd-mirror@
rbdmap)
configure_file(
${service}.service.in
${service}.service
@ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${service}.service
DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
endforeach()

install(FILES
ceph.target
ceph-fuse.target
Expand All @@ -9,14 +30,6 @@ install(FILES
ceph-mds.target
ceph-radosgw.target
ceph-rbd-mirror.target
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
rbdmap.service
DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Conflicts=umount.target
PartOf=ceph-fuse.target

[Service]
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/ceph-fuse -f --cluster ${CLUSTER} %I
TasksMax=infinity
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=ceph-mds.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
ExecReload=/bin/kill -HUP $MAINPID
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=ceph-mgr.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph

ExecStart=/usr/bin/ceph-mgr -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PartOf=ceph-mon.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
ExecReload=/bin/kill -HUP $MAINPID
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=ceph-osd.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
ExecStartPre=/usr/lib/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=ceph-radosgw.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/radosgw -f --cluster ${CLUSTER} --name client.%i --setuser ceph --setgroup ceph
PrivateDevices=yes
Expand Down
2 changes: 1 addition & 1 deletion systemd/[email protected] → systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=ceph-rbd-mirror.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=CLUSTER=ceph
ExecStart=/usr/bin/rbd-mirror -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
ExecReload=/bin/kill -HUP $MAINPID
Expand Down
2 changes: 1 addition & 1 deletion systemd/rbdmap.service → systemd/rbdmap.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ After=network-online.target local-fs.target
Wants=network-online.target local-fs.target

[Service]
EnvironmentFile=-/etc/sysconfig/ceph
EnvironmentFile=-@SYSTEMD_ENV_FILE@
Environment=RBDMAPFILE=/etc/ceph/rbdmap
Type=oneshot
RemainAfterExit=yes
Expand Down

0 comments on commit 4865831

Please sign in to comment.