# Question for linux program integration

**URL:** <https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291>\
**Category:** Help & Support\
**Created:** [January 24, 2023, 9:33pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291 "2023-01-24T21:33:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [January 24, 2023, 9:33pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291/1 "2023-01-24T21:33:23Z")

</div>

Hi, I would like to ask you a question.

From a while, I’m on my big project write in Crystal.  
Actually when I use my software (ISM), I always fetch the repository under a Virtual Machine and I run my software after I performed a **cd** with my terminal.

But now, I would like to put my binary into **/usr/sbin** (because it require the _root/sudo_ privileges)

But I think some problems will occur, specially with the path, because I can’t put the files my program use under the **/usr/sbin** path, it’s not the purpose for this path.

How I have to proceed for that ?

---

<div class="post-metadata">

**Author:** ![mavu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/mavu/32/213_2.png) [@mavu](https://forum.crystal-lang.org/u/mavu)\
**Post date:** [January 24, 2023, 9:58pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291/2 "2023-01-24T21:58:04Z")

</div>

This is question is best answered with the original source of information for this: [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html)

This document describes the " the conventions used for the layout of a UNIX system", the places where which files should live in the filesystem.

If you need help with deciding in which category some file falls, you can maybe describe the file in question more closely.

---

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [January 24, 2023, 10:24pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291/3 "2023-01-24T22:24:18Z")

</div>

Oh thanks a lot.

It’s stupid, but I just realize now I have to manage that with my software 🤣

But it will be easy, because I made a module where is all path my binary use, I just need to change it.

---

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [January 24, 2023, 10:29pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291/4 "2023-01-24T22:29:31Z")

</div>

So to explain, this is the implementation responsable of all used path by my software:

```auto
module ISM 
  
     module Default 
  
         module Path 
              
             PortsDirectory = "Ports/" 
             SettingsDirectory = "Settings/" 
             IsmDirectory = "ISM/" 
             SoftwaresDirectory = "Softwares/" 
             InstalledSoftwaresDirectory = "InstalledSoftwares/" 
             SettingsIsmDirectory = "#{SettingsDirectory}#{IsmDirectory}" 
             SettingsSoftwaresDirectory = "#{SettingsDirectory}#{SoftwaresDirectory}/" 
             LogsDirectory = "Logs/" 
             TemporaryDirectory = "tmp/ism/" 
             BuiltSoftwaresDirectory = "#{TemporaryDirectory}builtsoftwares/" 
             ToolsDirectory = "tools/" 
             SourcesDirectory = "sources/" 
  
         end 
  
     end 
  
 end

```

**Port directory** : contains synchronized port, in one word some git repositories  
**Settings** : settings files for my software (JSON files)  
**ISM directory** : all crystal implementation for my software  
**Softwares directory** : all software installers (crystal script used by my software with the interpreter)  
**Installed softwares** : all recorded installed softwares (JSON files again)  
**Logs directory:** all installation logs generated by my software  
**Temporary directory** : where ism will download the sources and compile it (already set)

There is a last path not yet mentioned here.  
When my software start a task, like install a software, it generate a file **ISM.task** , it’s a crystal script generated by my software.

I will have a look tomorrow about the Linux convention for the file hierarchy, but if you have any suggestions, I will be happy as well, because for some path, I’m not sure where I’m suppose to put it

---

<div class="post-metadata">

**Author:** ![mavu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/mavu/32/213_2.png) [@mavu](https://forum.crystal-lang.org/u/mavu)\
**Post date:** [January 25, 2023, 2:37pm UTC](https://forum.crystal-lang.org/t/question-for-linux-program-integration/5291/5 "2023-01-25T14:37:34Z")

</div>

Can’t help with all, because I would have to look it up myself, but:

> [@Fulgurance](#):
>
> **Settings** : settings files for my software (JSON files)

This should go to `/etc/ism/`

> [@Fulgurance](#):
>
> **Logs directory:** all installation logs generated by my software

`/var/log/ism/`

> [@Fulgurance](#):
>
> **Installed softwares** : all recorded installed softwares (JSON files again)

If those are “runtime” data, meaning, it is the current state of the system and not modified by hand, `/var/run/ism` would be a good place.

> [@Fulgurance](#):
>
> **Temporary directory** : where ism will download the sources and compile it (already set)

probably `/tmp/ism/` or maybe /opt/ism/build/ if you clean it up or need lots of space. /tmp/ can be small

> [@Fulgurance](#):
>
> **ISM directory** : all crystal implementation for my software

`/opt/ism/```` maybe? not sure. possibly somewhere under `/usr/share/ism``` ?
