Skip to content

Commit

Permalink
Merge pull request #2063 from skoef/systemd-path-flag
Browse files Browse the repository at this point in the history
Add option --deb-systemd-path
  • Loading branch information
jordansissel authored Dec 8, 2024
2 parents ad4402f + 572cf39 commit 13a3c69
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ class FPM::Package::Deb < FPM::Package
next File.expand_path(file)
end

option "--systemd-path", "FILEPATH", "Relative path to the systemd service directory",
:default => "lib/systemd/system" do |file|
next file.gsub(/^\/*/, '')
end

option "--systemd-enable", :flag , "Enable service on install or upgrade", :default => false

option "--systemd-auto-start", :flag , "Start service after install or upgrade", :default => false
Expand Down Expand Up @@ -534,7 +539,7 @@ def output(output_path)
raise FPM::InvalidPackageConfiguration, "Invalid systemd unit file extension: #{extname}. Expected .service or .timer, or no extension."
end

dest_systemd = staging_path("lib/systemd/system/#{name_with_extension}")
dest_systemd = staging_path(File.join(attributes[:deb_systemd_path], "#{name_with_extension}"))
mkdir_p(File.dirname(dest_systemd))
FileUtils.cp(systemd, dest_systemd)
File.chmod(0644, dest_systemd)
Expand Down Expand Up @@ -646,7 +651,8 @@ def output(output_path)
extname = File.extname(systemd)
name_with_extension = extname.empty? ? "#{name}.service" : name

dest_systemd = staging_path("lib/systemd/system/#{name_with_extension}")
dest_systemd = staging_path(File.join(attributes[:deb_systemd_path], "#{name_with_extension}"))

mkdir_p(File.dirname(dest_systemd))
FileUtils.cp(systemd, dest_systemd)
File.chmod(0644, dest_systemd)
Expand Down

0 comments on commit 13a3c69

Please sign in to comment.