Personalised directory for e-smith layer

Hello,

I have a little but very frustrating problem with my Nethserver instance:
I had personalised the DUC script to have the Disk Usage graphic without the /opt directory ( the /opt directory my Time Machine backup place)

But sometime there’s a nethserver update, my personalised script is swapped by the original one.

Is it possible for the development team to think about a way to have a directory to put our personalised scripts?

you don’t need anything new, you already have the way to achieve it…

you’d really take a look at how the e-smith layer works to understand how to make persistent your customization

I began to work on exclusions. Do you recall I asked you for the exact syntax?
Unfortunately, I can’t find time, I’m sorry.
I’m not even sure that exclusions will work fine.
See

@filippo_carletti

The exact working syntax is here:

I had replied in the other post but perhaps you didn’t see it.
Don’t worry about this, I understand.:slight_smile:

@Stefano_Zamboni

I know that you have a good knowledge about SME and Nethserver, but I really don’t understand why you persist to answer this way. It’s really counter productive.
If you know and don’t want to share your knowledge… Stay in your ivory tower, but don’t post unpleasant answer. :smiling_imp:

1 Like

no ivory tower or anything similar…

you have a car and you’re asking how to add 4 wheels, that you already have… that’s all

I just told you that you/we don0t need to add anything else because you/we already have all we need… it’s just the way you/we use it

well, an unpleasant answer would be “RTFM”

maybe filling my answers with emoticons or funny pictures will make them more pleasant…
the sense of written words are in the eyes/mind of the reader…

Don’t be afraid to ask Jim, just show your work so we can help.

exactly: don’t ask to change the underlying logic, tell us how you did it and let’s find a way to make it work.

Hi @Jim. You can make use of custom e-smith templates, not only to change the behaviour of default templates but also for any config file.

If it’s OK with all of you, I’d rather move this from feature to support request.

Regarding the nethserver-duc customization, you can create a custom template for nethserver-duc-index file:

mkdir -p /etc/e-smith/templates-custom/etc/e-smith/events/actions/
cp /etc/e-smith/events/actions/nethserver-duc-index /etc/e-smith/templates-custom/etc/e-smith/events/actions/
chmod +w /etc/e-smith/templates-custom/etc/e-smith/events/actions/nethserver-duc-index 

Add the desired changes to the file:

vi /etc/e-smith/templates-custom/etc/e-smith/events/actions/nethserver-duc-index

Apply the changes:

expand-template /etc/e-smith/events/actions/nethserver-duc-index
signal-event nethserver-duc-save
4 Likes

Adding --exclude=opt will exclude:

/etc/opt
/var/opt
/usr/share/foomatic/db/source/opt
/opt
1 Like

Perhaps there a little misunderstood…

I’m doing exactly what. @nas said in this thread:

But sometime, my modification in the template is crushed by an update.

@dnutan
I will verify where I’m making the customisation, and try your method.
Thank you

because when you install an update, the nethserver-duc-update won’t expand your custom template like @dnutan proposes and the action you have modified like @nas proposed has been updated by the new rpm.

Your only chance is to do a PR to github with the change you need.

1 Like

so, IIUC, you edited /etc/e-smith/events/actions/nethserver-duc-index

which is an action, not a template

the only way to achieve your needs is to store the --exclude part/list in a db and then use it in the beginning of the action… you get the values from the db, you create the list using the right syntax and then you use it in the command line…
this is something not trivial

templates are there to templatize the config files… not the script ones
actions are script and you’d never edit it… first of all because you’ll miss your customization every time you update the rpm that owns that file
if you need custom actions to be executed during events, just add your script there, use different names, and link them in the desired event
so, at the end, to solve your issue that script must be modified to accept params from the db…

doing so, you can add as many exclusions you want… it doesn’t matter, 'cause the script will always be executed in the right way

my 2c

2 Likes

@stephdl, @Stefano_Zamboni: thanks for pointing that out.

Thank you for the explaination.

it’s exactly what 's occurring.

Just add your script there… But where exactly?

Can I just copy the actual script, make the modification and save it in this place and this script will be alway the only script that will be executed by the system, even if there’s duc update occurring.

I was referring to custom action…

yours is not a custom action, but a system’s one…
so, please, follow Steph’s advice and ask for a PR… that script must be changed to work as you expect…
generally speaking everything that can be a parameter (and customized) should be stored inside the configuration db

for example:
db configuration set duc service excludeList /opt;/mydir/mydir2

then the duc script should retrieve those values and use them as parameters