# Gem post-install script or files outside the gem hierarchy

**URL:** <https://www.ruby-forum.com/t/gem-post-install-script-or-files-outside-the-gem-hierarchy/126634>\
**Category:** Ruby\
**Created:** [January 20, 2008, 7:39pm UTC](https://www.ruby-forum.com/t/gem-post-install-script-or-files-outside-the-gem-hierarchy/126634 "2008-01-20T19:39:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Cain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@Jim\_Cain](https://www.ruby-forum.com/u/Jim_Cain)\
**Post date:** [January 20, 2008, 7:39pm UTC](https://www.ruby-forum.com/t/gem-post-install-script-or-files-outside-the-gem-hierarchy/126634/1 "2008-01-20T19:39:30Z")

</div>

Is it possible for a gem to run a post-install script or write files  
outside of the gem directory structure? I am specifically needing to  
write config files to /etc and startup files to /etc/init.d and then  
run chkconfig to create the proper symlinks.

Cheers,  
Jim

---

<div class="post-metadata">

**Author:** ![Jim\_Cain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@Jim\_Cain](https://www.ruby-forum.com/u/Jim_Cain)\
**Post date:** [January 21, 2008, 12:42am UTC](https://www.ruby-forum.com/t/gem-post-install-script-or-files-outside-the-gem-hierarchy/126634/2 "2008-01-21T00:42:28Z")

</div>

On Sun, 20 Jan 2008 13:38:16 -0500, Jim Cain wrote:

> Is it possible for a gem to run a post-install script or write files  
> outside of the gem directory structure? I am specifically needing to  
> write config files to /etc and startup files to /etc/init.d and then run  
> chkconfig to create the proper symlinks.

What’s chkconfig? It doesn’t exist on my Debian system. (Alternatively,  
one could ask “What’s /etc? It doesn’t exist on my Windows system.”)

You’re not distributing Ruby software. You’re distributing UNIX software  
which happens to be written in Ruby. You should look at some alternate  
way to distribute your software, most likely distributing it as a  
tarball  
with an installation script, and with its dependencies documented, and  
documenting the proper procedure to set up init symlinks after  
installation.

Also, target your software for the Linux Standard Base, not for RedHat.  
See [http://refspecs.linux-foundation.org/LSB\_3.1.0/LSB-Core-generic/LSB-](http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-)  
Core-generic/initsrcinstrm.html for the right way to install init  
scripts.

–Ken

---

<div class="post-metadata">

**Author:** ![Jim\_Cain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@Jim\_Cain](https://www.ruby-forum.com/u/Jim_Cain)\
**Post date:** [January 21, 2008, 3:50am UTC](https://www.ruby-forum.com/t/gem-post-install-script-or-files-outside-the-gem-hierarchy/126634/3 "2008-01-21T03:50:11Z")

</div>

On Jan 20, 2008 6:39 PM, Ken B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You’re not distributing Ruby software. You’re distributing UNIX software  
> which happens to be written in Ruby. You should look at some alternate  
> way to distribute your software, most likely distributing it as a tarball  
> with an installation script, and with its dependencies documented, and  
> documenting the proper procedure to set up init symlinks after  
> installation.
> 
> Also, target your software for the Linux Standard Base, not for RedHat.  
> See [http://refspecs.linux-foundation.org/LSB\_3.1.0/LSB-Core-generic/LSB-](http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-)  
> Core-generic/initsrcinstrm.html for the right way to install init scripts.

Actually, the software that requires config files and startup scripts  
is all internal proprietary stuff that will never be publicly  
released. I suppose I’ll have to make RPMs of those. I do have some  
generic supporting libraries that are potential candidates for open  
source release, but that will depend on the decisions of others.
