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

port of systemd-non-services@jap #1977

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,21 @@ def output(output_path)

attributes[:deb_systemd] = []
attributes.fetch(:deb_systemd_list, []).each do |systemd|
name = File.basename(systemd, ".service")
dest_systemd = staging_path("lib/systemd/system/#{name}.service")
# all standard unit types from systemd.unit(5) except for service
if systemd.end_with?(".socket", ".device", ".mount", ".automount", ".swap", ".target", ".path", ".timer", ".slice", ".scope")
name = File.basename(systemd)
else
systemd_name = File.basename(systemd, ".service")
# set the attribute with the systemd service name
attributes[:deb_systemd] = systemd_name

name = "#{systemd_name}.service"
end

dest_systemd = staging_path("lib/systemd/system/#{name}")
mkdir_p(File.dirname(dest_systemd))
FileUtils.cp(systemd, dest_systemd)
File.chmod(0644, dest_systemd)

# add systemd service name to attribute
attributes[:deb_systemd] << name
end

if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd].any?
Expand Down Expand Up @@ -626,14 +633,6 @@ def output(output_path)
FileUtils.ln_s("/lib/init/upstart-job", dest_init)
end

attributes.fetch(:deb_systemd_list, []).each do |systemd|
name = File.basename(systemd, ".service")
dest_systemd = staging_path("lib/systemd/system/#{name}.service")
mkdir_p(File.dirname(dest_systemd))
FileUtils.cp(systemd, dest_systemd)
File.chmod(0644, dest_systemd)
end

write_control_tarball

# Tar up the staging_path into data.tar.{compression type}
Expand Down