diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb index 4d97dfb0cc..a29be6e34e 100644 --- a/lib/fpm/package/deb.rb +++ b/lib/fpm/package/deb.rb @@ -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? @@ -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}