brew-services: mkpath first if destination dir not existed
This commit is contained in:
parent
372945299d
commit
369de0a05d
@ -246,6 +246,7 @@ module ServicesCli
|
|||||||
temp.flush
|
temp.flush
|
||||||
|
|
||||||
rm service.dest if service.dest.exist?
|
rm service.dest if service.dest.exist?
|
||||||
|
service.dest_dir.mkpath unless service.dest_dir.directory?
|
||||||
cp temp.path, service.dest
|
cp temp.path, service.dest
|
||||||
|
|
||||||
# clear tempfile
|
# clear tempfile
|
||||||
@ -317,8 +318,11 @@ class Service
|
|||||||
# Path to a static plist file, this is always `homebrew.mxcl.<formula>.plist`.
|
# Path to a static plist file, this is always `homebrew.mxcl.<formula>.plist`.
|
||||||
def plist; @plist ||= formula.prefix + "#{label}.plist" end
|
def plist; @plist ||= formula.prefix + "#{label}.plist" end
|
||||||
|
|
||||||
|
# Path to destination plist directory, if run as root it's `boot_path`, else `user_path`.
|
||||||
|
def dest_dir; (ServicesCli.root? ? ServicesCli.boot_path : ServicesCli.user_path) end
|
||||||
|
|
||||||
# Path to destination plist, if run as root it's in `boot_path`, else `user_path`.
|
# Path to destination plist, if run as root it's in `boot_path`, else `user_path`.
|
||||||
def dest; (ServicesCli.root? ? ServicesCli.boot_path : ServicesCli.user_path) + "#{label}.plist" end
|
def dest; dest_dir + "#{label}.plist" end
|
||||||
|
|
||||||
# Returns `true` if formula implements #startup_plist or file exists.
|
# Returns `true` if formula implements #startup_plist or file exists.
|
||||||
def plist?; formula.installed? && (plist.file? || formula.respond_to?(:startup_plist)) end
|
def plist?; formula.installed? && (plist.file? || formula.respond_to?(:startup_plist)) end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user