[SCRIPT] Update content of a module: config, changes, etc..

Post tutorials, HOWTO's and other useful resources here.
User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

[SCRIPT] Update content of a module: config, changes, etc..

Post#1 by fanthom » 28 Jan 2011, 11:26

Use this script for updating modules in which content is static. Do not use it for updating for example 'firefox' module as some required files may be missing in updated version.

Save it as '/usr/bin/update_module' or whatever, and make executable: 'chmod +x /usr/bin/update_module'.
run as follows:
'update_module /path/to_module.lzm'

Code: Select all

#!/bin/sh
#script by fanthom

# Variables
mod=`readlink -f $1`
dest=/tmp/update_module$$
path=`echo $mod | rev | cut -d/ -f2- | rev`

c='\e[36m'
r='\e[31m'
e=`tput sgr0`

# Let's start
if [ "$1" = "" ]; then
echo && echo -e "${r}need a lzm module as an argument
examples:

$0 module.lzm
$0 /mnt/sda2/porteus/modules/configs.lzm"$e
exit
fi

echo && echo -e "${c}provide new name for your module without .lzm at the end"$e
read name
echo && echo -e "${c}wait a while..."$e
mkdir $dest
for x in `unsquashfs -l $mod | cut -b 14- | sed '4,/*/ !d'`; do
    cp -P --parents $x $dest 2> /dev/null
done
dir2lzm $dest $path/$name.lzm
rm -r $dest

echo && echo -e "${c}updated module created as $path/$name.lzm"$e
Please add [Solved] to your thread title if the solution was found.

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: [SCRIPT] Update content of a module: config, changes, et

Post#2 by Hamza » 28 Jan 2011, 14:20

Thanks !

Error "${r}nead a lzm " , fixed !
NjVFQzY2Rg==

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: [SCRIPT] Update content of a module: config, changes, et

Post#3 by Ahau » 28 Jan 2011, 16:47

Very nice, thank you, fanthom!

To clarify for your resident noob--this script would copy files from my live filesystem that have been modified (such as blacklisting a driver and loading another one, or changing my language to Polish), and saves those changes to a new module--correct? This allows one to boot 'always fresh', with some specific changes made. Would this module then need to replace the existing module in /porteus/base (e.g. 001-core.lzm), or would it just contain the altered files, and be placed in /porteus/modules?

Thanks again!

EDIT: after reading https://porteus.org/forum/viewtopic.php?f=53&t=251, I think I understand better. You need to make a module out of your changes first, then run this script to patch them into an existing module, correct? And, this could be done for any module, but some (like firefox), should not be updated this way. Please pardon my rambling :)
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: [SCRIPT] Update content of a module: config, changes, et

Post#4 by fanthom » 28 Jan 2011, 20:16

@Ahau
this script is useful when you have module named for example: porteus_configs which contains some configuration files like:

Code: Select all

/etc/rc.d/rc.local
/etc/wpa_supplicant.conf
/etc/shadow
/root/.mozilla/xxx/xxx/places.sqlite
xxxxx
xxxx
xxx
in case of updating any of the config files/mozilla bookmarks you can just run 'update_module /path/to_your_module' instead of unpacking it, copying files manually, packing it back.
There's also one extra adventage: this script creates another module instead of updating existing one. you can have:

Code: Select all

/porteus/modules/porteus_configs-1.lzm
/porteus/modules/porteus_configs-2.lzm
xxxxx
xxx
porteus is an 'onion' and files from a module which is activated later in the boot process override previous ones, so in case of screwing up - you can just delete porteus_configs with biggest number and all should be ok again :)

This script can not be used for updating firefox (or any other application) as it lists files in the module: 'unsquashfs -l' and copies these which are present. If firefox-4.0 requires some extra files which are not included in firefox-3.13 module then they will be simply skipped by the script.

Hope it's all clear now.
Please add [Solved] to your thread title if the solution was found.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: [SCRIPT] Update content of a module: config, changes, et

Post#5 by Ahau » 29 Jan 2011, 16:52

Yes, it is. Thank you!

I'll play around with it a bit when I have some time :)

Posted after 20 hours 5 minutes 7 seconds:
Re: [SCRIPT] Update content of a module: config, changes, etc..
Ok, yes, now that I've played with it, I understand much better. It updates an existing .lzm from your live filesystem, but only updates the particular files that currently exist within that .lzm.

Very nice work, this will make always running from 'always fresh' mode a dream.
Please take a look at our online documentation, here. Suggestions are welcome!

tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Re: [SCRIPT] Update content of a module: config, changes, et

Post#6 by tb01 » 29 Apr 2014, 18:42

fanthom wrote: ...This script can not be used for updating firefox (or any other application)...
Q1. What would be the proper method to update Firefox? I'm specifically curious about how to address the recent 'heartbeat/heartbleed/Adobe Flash/SSL' vulnerability...

Q2. I think I'm having issues with gnash/Flash (preferences setting) persistence, and I suspect the 'fix' could be the correct answer to Q1, above. Are there any particular caveats to be aware of for using gnash vs. Flash?

Thanks in advance!

--tb01

.
Consider being the change you wish to see in our world...

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: [SCRIPT] Update content of a module: config, changes, et

Post#7 by brokenman » 29 Apr 2014, 22:47

Q1. What would be the proper method to update Firefox? I'm specifically curious about how to address the recent 'heartbeat/heartbleed/Adobe Flash/SSL' vulnerability
Updating openssl should be all that is necessary to circumvent this exploit. You can do this using USM. In a terminal type: usm -g openssl

If you only want to update flash then search for the 'alien slackware flashplayer'' package or slackbuild.
How do i become super user?
Wear your underpants on the outside and put on a cape.

tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Re: [SCRIPT] Update content of a module: config, changes, et

Post#8 by tb01 » 01 May 2014, 02:19

Thanks, brokenman!

I've currently got P 2.1 booted (working on friend's laptop) and I get

Code: Select all

root@porteus:~# usm -g openssl
bash: usm: command not found
root@porteus:~# man usm
No manual entry for usm
I'm assuming 'usm' is a new app for 3.0? Looking forward to doing this when I get 3.0 booted...

Being -NOT- a fan of Adobe, might you know if gnash is vulnerable/ updated?

While searching for this info on porteus.org & web, it appears updating Firefox means building a module. It seems I'll need to do this to acquire the mozilla bugfix1 which enables User Agent Switcher add-on for Porteus v2.1. I hope that will let me access some IE-locked (or bad-formatted) websites. I hope to find time to look into learning to build modules for Porteus!

Also, I managed to lock up Porteus Package Manager under MATE 2.1 x32, while looking for gnash under keyword search in modules. I am logged in as root to fix some other things; maybe that confused PPM? Well, gotta restart at this point anyway! (grin)

Thanks in advance!

--tb01

NOTE1: (From add-on developer's web page) "Q. Why can the user agent not be overidden in Firefox 17 and later?
A. This is due to a bug introduced in Firefox 17. This bug will be fixed when Firefox 23 is released. "

.
Consider being the change you wish to see in our world...

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: [SCRIPT] Update content of a module: config, changes, et

Post#9 by donald » 01 May 2014, 12:39

@tb01
If you are still searching for the openssl update, fetch it from:

http://mirrors1.kernel.org/slackware/

take care to choose the correct arch/slackware version.

EDIT:
for the user agent story take a look at:
http://forum.porteus.org/viewtopic.php? ... 798#p19327

Post Reply