Page 1 of 1

HOWTO make your modules.Porteus 1.1 (64-32 bit)

Posted: 29 Mar 2012, 11:47
by liguero
Make your modules for porteus 1.1 (64 and 32 bit)

Create a module in two steps :
1. slackyd search packages and dependencies and stores it in the directory "/var/slackyd"
2. the script "mkmodule.sh" install packages in the temporary directory "tmp-dir" and
create a new module.

A. slackyd :

During the first use of slack you must update packages list and md5 hash list :
guest@porteus:~$ slackyd -u

You can then download the package you are interested :
guest@porteus:~$ slackyd -g package-name (ie: firefox-11, chrome, apache ...)

Before downloading a new package, remember to empty the last package (it's very important!):
guest@porteus:~$ slackyd -p

B. mkmodule.sh :

1. code: SELECT ALL
2. copy and paste under Kwrite.
3. save as "mkmodule.sh" for instance.
4. make script executable : chmod +x mkmodule.sh
5. run this script as root (su, password).

Become root.
guest@porteus:~$ su root
Password:
root@porteus:/home/guest#

The script expects parameter the name of the future module. (without extension),
as shown below :

root@porteus:/home/guest# ./mkmodule.sh apache (for instance)

If all goes well you should find the module enabled in the directory "porteus/modules" as "apache.xzm".

Unfortunately things do not happen the way we want, for example with "google-chrome".
The error messages below illustrates my point :

[4208:4208:846892184:FATAL:zygote_host_linux.cc(143)] The SUID sandbox helper binary was found,
but is not configured correctly. Rather than run without sandboxing I'm aborting now.
You need to make sure that /opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.
Aborted


This is why I added an option to correct a package :

[1]Open a terminal as root to view or modify file(s) in directory "tmp-dir"
[2]Continue
[3]Quit

In the case of google-chrome we choose to open a terminal so as to correct access rights to files.
In the terminal window we enter the following command :

root@porteus:/home/guest# chmod 4755 tmp-dir/opt/google/chrome/chrome-sandbox
root@porteus:/home/guest# ls -l tmp-dir/opt/google/chrome/chrome-sandbox
root@porteus:/home/guest# exit


We then choose option 2 to continue and create the new module.

At the end of the script you are prompted to delete the directory "tmp-dir" and
to empty the folder "/var/slackyd".

remove directory vlc-dir created later ? [y/n] :

Answer no until you have not tested the new module.
If everything works fine you can then delete "tmp-dir" and empty "/var/slackyd".

root@porteus:/home/guest# rm -r tmp-dir
root@porteus:/home/guest# slackyd -p

If you have a problem to fix, you can restart the script "mkmodule.sh".
As the files were not deleted, you can correct a defect.
After that, you can recreate the module with option 1.

Temporary directory "tmp-dir" already exists:
[1]Skip directly to module creation
[2]Clear the directory and install new package


With option 2, you can empty the directory "tmp-dir". This means that you probably downloaded a new packages
and had forgotten to delete "tmp-dir" during a previous operation.

Before restarting the script, pay attention to the fact that you must first disable the module with "activate".
root@porteus:/home/guest# activate module-name.xzm

Then, you can delete the module:
root@porteus:/home/guest# rm /mnt/your-usb-key/porteus/modules/module-name.xzm

With a little help of "Dolphin" or "Konqueror" (super user mode) you can do everything at once.
"right click" -> activate and "shift-suppr" -> delete.

Enjoy!

Code: Select all

#!/bin/bash
#Install package and make module for porteus 1.1 (64 and 32 bit)

if [ ! $1 = "" ]; then
txz=`ls /var/slackyd/*.txz 2>/dev/null`
  if [ ${#txz} != 0  ];then
      if [ ! -d tmp-dir ];then
	mkdir tmp-dir; yes="n"
      else 
	echo
	echo "Temporary directory \"tmp-dir\" already exists:"
	echo
	echo "[1]Skip directly to module creation"
	echo "[2]Clear the directory and install new package"
      while [ true ]; do
	  read  -n 1 -s option
	  case "$option" in
	    "1") yes="y"; break;;
	    "2") rm -r tmp-dir/* 2>/dev/null; yes="n"; break;;
	  esac
      done
      #read -p 'tmp-dir already exists. Skip directly to module creation ? [y/n] : ' -n 1 -s yes
      fi
	  if [ $yes = "n" ]; then
	   
		for toconv in $txz
			do
				echo $toconv
				installpkg -root tmp-dir $toconv
				if [ $? != 0 ]; then 
					echo "error installing package "$toconv; exit
				fi
			done
	  fi
echo "Installation of the package is complete:"
echo
echo "[1]Open a terminal as root to view or modify file(s) in directory \"tmp-dir\""
echo "[2]Continue"
echo "[3]Quit"

yes="n"
while [ true ];do
  read  -n 1 -s option
  case "$option" in
    "1") /usr/bin/ktsuss /tmp/.terminal ;;
    "2") yes="y"; break;;
    "3") exit;;
  esac
done

#Make module vlc and activate it
dir2xzm tmp-dir ${1%*.xzm}.xzm
activate ${1%*.xzm}.xzm

#Remove temporary dir.
	read -p 'remove directory vlc-dir created later ? [y/n] : ' -n 1 -s yes
		echo
		if [ $yes = "y" ]; then
		rm -r tmp-dir
		slackyd -p
		fi
	else echo "Directory /var/slackyd is empty"
	fi
else echo "Précisez le nom du module"
fi

Re: HOWTO make your modules.Porteus 1.1 (64-32 bit)

Posted: 29 Mar 2012, 15:08
by Ahau
Hi liguero, many thanks for this post and your other recent HOWTO's!

Could you please give us a little more detail on the benefits of this script (mkmodule.sh) versus the built-in command "txz2xzm"? Based on reading the script (haven't had a chance to test it yet), it appears that it allows the user to input a custom name for the module, and it also allows the user to make customizations to the files before they get compressed into a module. Is this correct?

cheers!

Re: HOWTO make your modules.Porteus 1.1 (64-32 bit)

Posted: 29 Mar 2012, 17:25
by liguero
Hello, Ahau

The primary purpose was didactic. The second is due to my laziness.

I wanted to see what looks like a module vlc. When I saw the huge amount of files, I thought
I was going to end up drowning in the data stream.
I wanted all the slackware packages (86 I think) held in a single module.This requires that the process is automated.

As you know, "installpkg" is used to install slackware-package.
This is why I thought of installing the packages into a temporary directory using this command.

At the end of the operation, we have a directory containing all files of different packages previously
downloaded by slackyd.
For simplicity I thought "slackyd". It is doing pretty good for the dependencies search and
offers the choice between different versions.

It remains only to create a module using "dir2xzm". One module, 86 packages.

Well, yes, vlc is an extreme case. A little heavy for transfers via usb-key.
But it works perfectly! All codecs are present!

With this method, there is an advantage which I had not originally thought is that you can make changes to the downloaded files.
This proved useful in the case of Google-Chrome where I met a problem with the slackware package proposed by slackyd.

It's true, my script is far from perfect. It only allows to dissect how is a conversion packet-module.
I did not want to completely automate the process to stay almost simple. This is why I kept the 2 steps: slackyd + script

I do not know if I answered your question.
Cheers.

Re: HOWTO make your modules.Porteus 1.1 (64-32 bit)

Posted: 29 Mar 2012, 18:29
by Ahau
Yes, I think you did, thank you :) The script also allows combining all packages from the /var/slackyd directory into a single xzm, without the need to convert all to xzm's with txz2xzm, then merge the xzm's together (or manually installing each package to a fakeroot and then converting to xzm). Nice work, and thank you for sharing!

Re: HOWTO make your modules.Porteus 1.1 (64-32 bit)

Posted: 30 Mar 2012, 00:24
by brokenman
Nice work. Inspires me to restart my slackyd front end. So much to do, so little time to do it.