Saving changes to base modules

Get help with XFCE specific problems
Post Reply
Jacoby59
Black ninja
Black ninja
Posts: 49
Joined: 07 Apr 2014, 04:10
Distribution: Porteus 3.0 RazorQT
Location: Chicago

Saving changes to base modules

Post#1 by Jacoby59 » 24 Sep 2014, 16:21

Is it possible to hard-code settings in the base modules by extracting them, copying folders containing changes from current session and recompiling them to modules? If yes, I'd like to know which folders should I copy/paste in which base module's dir for the following changes-

1. Wifi password
2. Panel configuration
3. Wallpapers
4. Desktop settings (including shortcuts)
5. Icon & window manager themes
6. Chrome
7. Date & Time

If it's possible, I could simply make my desired changes and save them to the base modules (much like saving current session) so the changes become permanent. Last week, I created a saved-session module from Porteus Settings centre and placed the module in porteus>modules directory so the changes loaded everytime I boot (Graphics Mode). This worked for a few days, but then the module got corrupt for absolutely no reason at all and wouldn't work anymore.

Please don't suggest me to reformat the partition in ext4 and use porteussave.dat instead, because firstly, it did not work for me in the past, and secondly, I'm still curious whether hard-coding settings is possible. It could be an easy way for people like me who lack basic programming skills to make custom Porteus distro, with their desired changes and themes.

Any help/suggestions would be appreciated. Thanks!

User avatar
Ed_P
Contributor
Contributor
Posts: 3322
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Saving changes to base modules

Post#2 by Ed_P » 24 Sep 2014, 16:52

For #1 this will work.

Code: Select all

#!/bin/bash
# Make a module of my network connections 

if [ `whoami` != "root" ]; then
  su -c "sh $0"
  exit
fi

mkdir -p /tmp/mod

cp -a --parents /etc/NetworkManager/system-connections/*  /tmp/mod/

echo
echo Press Enter to create module, Ctrl+C to end.
read

dir2xzm /tmp/mod /tmp/mynetwork.xzm   &&   rm -rf /tmp/mod

ls -s      /tmp/*.xzm
And a similar approach for #7 using the file noted in viewtopic.php?f=117&t=3551&p=25812#p25812 will work.

Code: Select all

cp -a --parents /etc/localtime    /tmp/mod/
You could also create a single module with several changes in it.

=edit= Showed the code line for #7.
Last edited by Ed_P on 25 Sep 2014, 16:42, edited 2 times in total.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 5574
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Saving changes to base modules

Post#3 by brokenman » 24 Sep 2014, 19:27

The individual paths to these config files will depend on which desktop your are using. For 2-6 you can simply make a module from your /home/guest folder as all settings are stored there.

In fact the best way is exactly what you did. Save your session to a module and drop it in your modules folder. Make a second copy in case of corruption (I have never experienced this).

For clarification:
You ONLY need a savefile.dat file if you are using an NTFS or FAT partition for porteus.
It is best to stay out of the base folder. You want your settings module loaded AFTER the base modules so put it in the modules folder.

So the only thing I would add to Ed_P's script is right after this line:

Code: Select all

cp -a --parents /etc/NetworkManager/system-connections/* /tmp/mod/
put

Code: Select all

cp -a --parents /home/guest /tmp/mod
If you still want to deconstruct the base modules, then the answer to your question is yes. This is possible. Read the website documentation on what modules are. There are tutorials on how to do it.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Jacoby59
Black ninja
Black ninja
Posts: 49
Joined: 07 Apr 2014, 04:10
Distribution: Porteus 3.0 RazorQT
Location: Chicago

Re: Saving changes to base modules

Post#4 by Jacoby59 » 25 Sep 2014, 00:53

Hi brokenman.

I run Porteus 3.0 XFCE (32 bit). I did keep a copy of the module. I uploaded the module to my cloud while it was working. So after it was corrupt I rebooted in Always Fresh mode, downloaded the module from cloud, replaced the corrupt module in porteus>modules with the downloaded one, and rebooted in Graphics Mode. But it still showed the module as corrupt.

For extracting and modifying the base modules, I did read some of the tutorials. However, they are about modifying package modules in general, and I found nothing about making changes specifically to base modules. Anyways, here's a scenario that I thought of and was wondering if it works this way. Here it is-

Let's say I've made all the desired changes and my home>guest dir is ready to be converted to a module using Ed_P's script with your added line. But instead, I decided to take a different approach. I browsed to porteus>base, extracted 001-core.xzm to a folder (let's name it newcore) and noticed that the folders in newcore folder are similar to the folders in file system (that includes home). So I deleted 'home' folder from newcore and copy/pasted the 'home' folder from current session (the one with the changes) in there.

Now if I compiled newcore folder into a module using dir2xzm, renamed it to 001-core.xzm, and replaced the 001-core.xzm in porteus>base (the one that came with Porteus) with this one, would it work? I know it sounds too simple to be true, and I highly doubt that it will work, but I'm curious.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5574
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Saving changes to base modules

Post#5 by brokenman » 25 Sep 2014, 01:41

That is exactly how it works, but also a testament as to why I said stay out of the base modules. By deleting the home folder you just deleted your .bashrc profile and your mc (midnight commander settings). Secondly, because you chose to edit 001-core.xzm, when the browser module 04-firefox.xzm module is loaded it is loaded over the top of your 001-core.xzm folder and any files inside this module (with the same name) will take precedence and overwrite the files you put into 001. This is why the modules folder was created. So the best thing to do is to choose a module later than 04 and put your changes there. Maybe create one called 09-settings.xzm.

When you make a change to the firefox prefs.js file for example (your firefox preferences) and place it in 001-core.xzm, then when the 04-firefox.xzm module is loaded it wipes out your changed prefs.js file with the default one. Does that make sense?
How do i become super user?
Wear your underpants on the outside and put on a cape.

Jacoby59
Black ninja
Black ninja
Posts: 49
Joined: 07 Apr 2014, 04:10
Distribution: Porteus 3.0 RazorQT
Location: Chicago

Re: Saving changes to base modules

Post#6 by Jacoby59 » 25 Sep 2014, 03:25

Thanks, it's much clearer now. I'm still confused about the last paragraph, though. What if I don't do this while on Porteus? Will the problems persist if I copy newcore and home (current session) folders to a different machine and THEN replace the home folder in newcore with the one I copied?

Normally I stay out of the base folder. I wouldn't even have considered this as an option if my saved-session modules hadn't become corrupt. But still I'll most likely stick to save-session and will only get my hands dirty as a last resort if the modules get corrupt yet again.

Plus, what do the numbers in module filenames indicate? Do those indicate load order? For instance, does it mean that 001-modulename.xzm will be loaded before all, and 002-modulename.xzm right after that? Thanks.

User avatar
fanthom
Site Admin
Site Admin
Posts: 4617
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Saving changes to base modules

Post#7 by fanthom » 25 Sep 2014, 16:19

Plus, what do the numbers in module filenames indicate? Do those indicate load order? For instance, does it mean that 001-modulename.xzm will be loaded before all, and 002-modulename.xzm right after that? Thanks.
yes - this is described in our documentation.
Please add [Solved] to your thread title if the solution was found.

User avatar
ralcocer
Samurai
Samurai
Posts: 146
Joined: 02 Jan 2011, 12:53
Distribution: 3.2rc5 Xfce
Location: Puerto Rico
Contact:

Re: Saving changes to base modules

Post#8 by ralcocer » 01 Oct 2015, 13:18

I simply cpy the .config settins I want to keep and put the in the rootcopy folder in either root or user directory , I make a module for the google-chrome settings and decompress it in the rootcopy in order to bypass the "do not support symlinks" error I get.

Post Reply