jordansissel / pleaserun

An attempt to abstract this "init" script madness.
Other
1.17k stars 80 forks source link

[FEATURE] Add an option for where to write the init scripts #43

Closed lookfirst closed 9 years ago

lookfirst commented 10 years ago

By default, pleaserun seems to output to a temp file. I'd like to be able to specify a directory for where it should write the files.

jordansissel commented 10 years ago

There are currently 3 options:

1) The temporary paths used by default. 2) The 'standard' locations on disk that are most correct for the platform. This is usable with the --install flag. 3) JSON output that includes all files and content as well as 'install actions'. This is usable with the --json flag.

Example:

% bin/pleaserun -p upstart --json --name foo httpd
{"files":[{"path":"/etc/init/foo.conf","content":"description     \"no description given\"\nstart on filesystem or runlevel [2345]\nstop on runlevel [!2345]\n\nrespawn\numask 022\n#nice \n#chroot /\nchdir /\n#limit core <softlimit> <hardlimit>\n#limit cpu <softlimit> <hardlimit>\n#limit data <softlimit> <hardlimit>\n#limit fsize <softlimit> <hardlimit>\n#limit memlock <softlimit> <hardlimit>\n#limit msgqueue <softlimit> <hardlimit>\n#limit nice <softlimit> <hardlimit>\n#limit nofile <softlimit> <hardlimit>\n#limit nproc <softlimit> <hardlimit>\n#limit rss <softlimit> <hardlimit>\n#limit rtprio <softlimit> <hardlimit>\n#limit sigpending <softlimit> <hardlimit>\n#limit stack <softlimit> <hardlimit>\nsetuid root\nsetgid root\nconsole log # log stdout/stderr to /var/log/upstart/\n\n\nexec httpd \n","perms":null},{"path":"/etc/init.d/foo","content":"#!/bin/sh\n\necho \"This job runs via upstart, invoking upstart now...\"\nexec initctl $1 foo\n","perms":493}],"install_actions":[]}
jordansissel commented 10 years ago

However, I'm still open to a 4th option of "put the files here..." but haven't writtne code to do that yet.

lookfirst commented 10 years ago

I honestly just need the files in a directory. I package them up into an rpm in a separate process (using maven).

thedrow commented 10 years ago

@lookfirst Have a look into fpm & fpm-cookery then. Pleaserun will be integreated in the future. https://github.com/bernd/fpm-cookery/pull/68

pgodel commented 10 years ago

I am a big fan of fpm and just started using pleaserun, it would be very helpful to specify where to write the files so I can then run the fpm command to package the rpm/deb with the new shiny init scripts.

eperdeme commented 10 years ago

+1's etc.

Trying to package stuff up using fpm+jenkins+pleaserun and be easier if the output path was selectable.

I guess I could do some JSON wrapper to do this for me but its a bit harder than ./magick.

spuder commented 10 years ago

+1

Also, it would be nice if it could output to multiple directories

pleaserun -p sysv -p upstart -d /tmp

tree /tmp 
|_sysv
|        |_foo.conf
|_upstart
         |_foo.conf
jordansissel commented 9 years ago

@spuder I am ... almost liking that proposal, though this would be the same as -p sysv -d /tmp/sysv repeated for each platform type.

jordansissel commented 9 years ago

pleaserun 0.0.9 published with an --install-prefix flag:

% bin/pleaserun --install --install-prefix /tmp/fancy -p sysv -v lsb-3.1 --name apache /usr/bin/httpd -D
Writing file {:destination=>"/tmp/fancy/etc/init.d/apache"}
Writing file {:destination=>"/tmp/fancy/etc/default/apache"}
lookfirst commented 9 years ago

:+1: