Consider using a script to read the upstream configuration, modify it, and spit it out to drop-in file.
For example, I use Chef and here's a piece of ruby (library) that parses marathon systemd unit file to get original ExecStart from it
require 'inifile'
module Dcos
def get_execstart_from_unit_file
marathon_systemd_unit_file =
IniFile.load('/etc/systemd/system/dcos-marathon.service')
return marathon_systemd_unit_file['Service']['ExecStart']
end
end
Then in the recipe, I create the drop-in file to append an option to ExecStart
chef_gem 'inifile'
exec_start_orig = get_execstart_from_unit_file
systemd_service_drop_in 'dcos-marathon' do
override 'dcos-marathon.service'
precursor 'Service' => { 'ExecStart' => nil }
service do
exec_start exec_start_orig + ' --env_vars_prefix "DCOS_MARATHON_"'
end
end