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

Add option --deb-systemd-path #2063

Merged
merged 2 commits into from
Dec 8, 2024
Merged
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
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