Getting closer... or ...editing the initrd.gz (Closed)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

Getting closer... or ...editing the initrd.gz (Closed)

#1 Post by LazY Puppy »

Updated Information here!
RSH wrote:I'm now going a very different way. Instead of remastering the OS again and again, I do edit the init Script in initrd.gz, inserting Functions to get automatically Information from a config File at boot partition and executing a Script doing Jobs based on that Information from the config File.
Coming from this Post, this Post and also this Post

I'm trying to provide smart functions to make the user able to configure the Puppy by a external .cfg File. Setting up a new Wallpaper, Startup Sound, load SFS Modules at boot (also to a top layer), install .pet packages automatically and execute Applications automatically after X appears on the screen plus many more...

Booting up a completely different setup Puppy Linux without to use a save file or to do a remaster first.



Currently these Options are available:

# Sleep Time - wait until script zzz_z_auto_execute will be executed
MYSLEEPTIME=2

# Window Manager - set a new window manager, load from SFS, load to a top layer
MYWINDOWMANAGER=jwm
MYWMSFSLOADOPT=1
MYWMSFSTOPLAYEROPT=1
MYWINDOWMANAGERSFS=LP3_WM-Flux-Ice-0.1.sfs

# Num Lock - disable/enable numlock of the numerical block
MYNUMLOCKOPT=1

# Interface - boot directly into new interface: da, de, es, fi, fr, it, nl, pt & tr
MYINTERFACE=de

# Timezone - currently unused
MYTIMEZONE=

# Keyboard Layout - set keyboard layout also needed when using $MYINTERFACE
MYKBDLAYOUT=de
RESTARTAFTERX=1

# Mount all HD and USB Flash Drives - mount all or only listed drives automatically
MOUNTALLMYDRIVES=1
MOUNTMYDRIVES=""

# Welcome First Boot - enable/disable welcome first boot GUI
MYWELCOMEFIRSTBOOT=0

# Personal Settings PopUp - enable/disable the Personal Settings PopUp
MYPERSONALSETTINGSPOPUP=0

# Desktop Icons - enable/disable the Desktop Icons
MYDESKTOPICONS=1

# Drive Icons - enable/disable the Drive Icons (only if $MYDESKTOPICONS is used)
MYDRIVEICONS=1

# Wallpapers - set a new wallpaper for a use
MYWALLPAPERDIRECTORY=Dateien/Wallpaper/RSH
MYWALLPAPER=Michaela.png

# Startup Sound - set a new startup sound (no longer barking)
MYSTARTUPSOUND=studio1337-bootsound.wav

# Install Packages - install .pet packages automatically from directory
MYPKGINSTALLDIROPT=1
MYPKGINSTALLDIR=InstallMe

# Global Directory to load SFS Files from - currently only for my private LazY Puppy
MYGLOBALSFSDIR=

# Auto-Load of SFS Modules at /etc/profile.local - load SFS Modules listed at boot up, load to top layer also
MYBOOTSFSLOADLISTOPT=0
MYBOOTSFSTOPLAYEROPT=0
MYBOOTSFSLOADLIST=""

# Auto-Load of SFS Modules at /root/Startup - load SFS Modules listed after X appears on the screen (only to normal layer)
MYSFSLOADLISTOPT=1
MYSFSLOADLIST=""

# Auto-Start of Applications - execute listed applications automatically and from list in simple text file
MYAUTOSTARTAPPS=""
MYAUTOSTARTAPPSLISTFILE=precise_5.7.1-autostart.lst

# Startup Script - execute a user's startup script
RUNMYSTARTUPSCRIPT=0
RUNMYSTARTUPSCRIPTBOOTCONTENT=0
MYSTARTUPSCRIPT=StartUp


Please, test and do make suggestions or offer parts of your own work - if there is any.



Downloads:

Download initrd.gz for Precise 5.7.1, Slacko 5.9.3 and Tahr 6.0 CE.
It's a .tar.gz file and it contains the initrd.gz files for the named Puppy Systems plus a config file example for each of them
Download Updated Files for Precise 5.7.1
Download Super Lucid 4 initrd.gz plus a config file example.
Download Edit-Initrdgz-1.5.pet to edit initrd, initrd.gz and initrd.xz Archives.


Name-Specification:

$DISTRO_FILE_PREFIX_$DISTRO_VERSION.cfg

It can handle additions (free to define) to the File Name.

Example: $DISTRO_FILE_PREFIX_$DISTRO_VERSION-monday.cfg

So in this here case: precise_5.7.1.cfg or even precise_5.7.1-monday.cfg



Usage:

Boot Parameter setup for a use: pconfig

- pconfig=no (or No or NO or n or N) ---> don't load a config file
- pconfig=monday --> loads the precise_5.7.1-monday.cfg

- no pconfig submitted loads the default config, which is: precise_5.7.1.cfg

As for Options, $MYWALLPAPER and $MYSTARTUPSOUND:

- possible Locations for $MYWALLPAPER:
- - /usr/share/backgrounds, Boot Partition, Boot Directory, Sub Directory of Boot Partition or Boot Directory

- possible Locations for $MYSTARTUPSOUND:
- - /usr/share/audio, Boot Partition, Boot Directory

Usually if there are equal named Files in Boot Partition as well as in Boot Directory, the Boot Directory is the preferred Choice. More Information, Description and Comments in the Config File which shows clearly what has been solved so far.



Additional Directories and Files inside of the initrd.gz:

desk_icons_hide.desktop
desk_icons_show.desktop
zzz_z_auto_execute
zzz_z_auto_execute.desktop

/usr/sbin/mount_a_drive
/usr/sbin/sfs_load_top_layer



Images/Screenshots:

Precise 5.7.1 booted into DE with Enlightenment e17 Window Manager
Precise 5.7.1 booted into DE with L.A.S.S.I.E.'s Window Manager (JWM)
Super Lucid 4 booted into DE with L.A.S.S.I.E.'s Window Manager (JWM)

---

Note 1: Slacko 5.9.3 can't boot into DE interface or even DE keyboard layout if booting from vfat partition. Also can't connect to the web since they forgot to include the files for gprs modems.

Note 2: Could not test Tahr in complete since my machine seems to be too old for this OS. Graphics and Mouse issues here.
Attachments
New-Config-Options-Update-Precise571-0.1.tar.gz
(44.78 KiB) Downloaded 579 times
Last edited by LazY Puppy on Fri 15 Apr 2016, 00:22, edited 12 times in total.

stemsee

#2 Post by stemsee »

Schone dast du wieder da bist! Ja, so ist das Lieben!

This looks very promising. I have to think about how to put this to best use and how to incorporate this into my system.

How are no icons acheived? Is a standard puppy desktop assumed (puppypin backedup?)? I like the idea of setting startup sound and wallpaper. I have to think about it and try it out.

Good stuff though!

stemsee

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#3 Post by LazY Puppy »

stemsee wrote:Schone dast du wieder da bist! Ja, so ist das Lieben!
Thanks. :D
stemsee wrote:This looks very promising. I have to think about how to put this to best use and how to incorporate this into my system.

How are no icons acheived? Is a standard puppy desktop assumed (puppypin backedup?)? I like the idea of setting startup sound and wallpaper. I have to think about it and try it out.

Good stuff though!

stemsee
Yes it is very much promising and works very well over here. By now booted about 50 times in different config setups. Though, the $MYDESKTOPICONS Option currently doesn't work.

I got some code where I do switch the Icons on desktop related to categories. This code has function to remove icons from desktop, but did not work here. So I commented out the lines in the auto-execute script but forgot to remove the option from the config files. Sorry for that.

However, anything else seems to work pretty good.

To put this into your init script is not that hard to do.

Just search the this here Slacko init script for RSH (case sensitive) and watch the additional files in initrd.gz.

RSH

stemsee

#4 Post by stemsee »

Yes, I also want to have the option to load a second savefile automatically on say /initrd/pup_a or add pup_rw0 in the init.

I have a reliable mechanism for no-icons and return to icons. I think with this mechanism it will be easy to add or remove categories using one flag per category.

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#5 Post by LazY Puppy »

I have a reliable mechanism for no-icons and return to icons.
Please, offer some of this.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: Getting closer... or ...editing the initrd.gz

#6 Post by mavrothal »

LazY Puppy wrote:
RSH wrote:I'm now going a very different way. Instead of remastering the OS again and again, I do edit the init Script in initrd.gz, inserting Functions to get automatically Information from a config File at boot partition and executing a Script doing Jobs based on that Information from the config File.
Coming from this Post, this Post and also this Post
Interesting but what is the "use case".
Remastering is usually for much more than changing timezone and wallpaper, so it can not really replace remastering but rather (some) personal settings. To that extend would be nice if you can add wifi configuration and maybe, firewall, SAMBA etc as they usually take more time :wink:

I was also wondering why modify the init so heavily. You could just have it call a script in initrd/bin. Such a minimal change may even make it to woof-CE :shock: for future customizations and if not would be much easier to maintain a patch against an evolving init :wink:

Alternatively you could call the config file from rc.sysinit or even rc.local. Even if you do not want to have a savefile you could still have a config file in /mnt/home with the variables and read them either directly from rc.something or by a script called from rc.something. Though this would require a remastering.

Coming to the user-editable unprotected config file, maybe is a good idea to have some checks that inserted variables are sane, because a typo (say in a path) may get your system unusable. Maybe a GUI "setings-config" where entries would be selected from tested-to-be-available options. This would probably require you to boot the original install the relevant pet and create your config file for future use, but should be more safe.
Alternatively you could extract all these from a configured running puppy. ie instead of remastering or a savefile, extract needed variables and configurations in a flat file or even a yzdrv.
Though with puppy running (mostly) from removables having hard-coded paths can be a problem (no matter what the checks) when changing machine.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#7 Post by LazY Puppy »

Interesting but what is the "use case".
Remastering is usually for much more than changing timezone and wallpaper, so it can not really replace remastering but rather (some) personal settings. To that extend would be nice if you can add wifi configuration and maybe, firewall, SAMBA etc as they usually take more time
It is NOT invented/intented/supposed to replace remastering completely or in general. The case of a use for is to boot a fresh, clean Puppy Linux as a preconfigured Puppy Linux as close to my personal needs as possible.

I want to develop Programs using all my tools developed until today without to do a remaster first, without to install .pet packages and also without to use a save file.

I don't use save files in general and want to save some time on remastering - or even save it completely, as far as possible (but not to replace remastering).
I was also wondering why modify the init so heavily. You could just have it call a script in initrd/bin. Such a minimal change may even make it to woof-CE for future customizations and if not would be much easier to maintain a patch against an evolving init
I'm just a beginner in Linux and Puppy Linux. I don't know much about how the stuff in initrd.gz is handled and getting into / finally. So to modify the init script is what I know and what I already can do. I'm just playing around...

"Why modify the init so heavily" ?

:lol: You did never seen the init script from my private versions of LazY Puppy - that's heavily modified. In this here case, I have minimized the modifications to appr. 5% of all by increasing its functionality up to 500%!

Want it in woof-CE?

Grab the Ideas and suggestions, use it or even re-code it and put it in. I'm not interested in doing woof or doing woof-CE - just got not enough time for such projects.

Alternatively you could call the config file from rc.sysinit or even rc.local. Even if you do not want to have a savefile you could still have a config file in /mnt/home with the variables and read them either directly from rc.something or by a script called from rc.something. Though this would require a remastering.
As stated: I want to save time on remastering. Currently I have to remaster/update 4 (to 6) different remastered Puppy Linux Systems to keep all of them up to date.

When testing/using a new Puppy like the Slacko 593, I just want to work with it and to use it, as I'm doing it in my multiple LazY Puppy Systems. Exclusively and immediately.

Makes it easier to develop and to test afterwards in a fresh and clean bootet equal Puppy Version without to have both, a remastered version and a original version installed on USB HDD or Flash Drive.

Coming to the user-editable unprotected config file, maybe is a good idea to have some checks that inserted variables are sane, because a typo (say in a path) may get your system unusable.
Just boot it with pconfig=no and no config file will be used. Fix it (make it sane) then.

By the way. Checks are already in: e.g. submitted/defined Wallpapers that doesn't exist won't be used.
Though with puppy running (mostly) from removables having hard-coded paths can be a problem (no matter what the checks) when changing machine.
Currently there aren't any hardcoded paths in use - if I didn't overseen anything.
.
Config File wrote:# Use File Names without Path Names, just put those Files
# either to boot partition or into boot directory.
# Boot Directory is the preferred choice if equal named
# files are found at both locations. Any else usage is marked!
Thanks for your suggestions and opinions,

RSH

Jasper

#8 Post by Jasper »

Hi LazY Puppy,

Re: show/hide icons
There is the excellent and versatile "swapicons" or roxoff with restart x as well as the new code from stemsee.

Re: remastering? you wrote
I like remastering still very much. Yes, it's uncomfortable to use different versions by equal names. My Remaster Suite is working in unattended Mode and renames the SFS automatically when ever I'm activating the GUI Option. Since I'm using smallest .gz compression possible generally it takes about 15 Seconds to create a 350 MB .gz compressed SFS. Also it boots much faster when .gz compressed.
My regards
Attachments
SwapIcons.sfs.gz
rename - deleting "dotgz"
(4 KiB) Downloaded 506 times

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#9 Post by LazY Puppy »

Jasper wrote:Hi LazY Puppy,

Re: show/hide icons
There is the excellent and versatile "swapicons" or roxoff with restart x as well as the new code from stemsee.
Thanks for the Info.
Jasper wrote:Re: remastering? you wrote
I like remastering still very much. Yes, it's uncomfortable to use different versions by equal names. My Remaster Suite is working in unattended Mode and renames the SFS automatically when ever I'm activating the GUI Option. Since I'm using smallest .gz compression possible generally it takes about 15 Seconds to create a 350 MB .gz compressed SFS. Also it boots much faster when .gz compressed.
My regards
Yes, but that's not a contradiction in terms of what am I trying to achieve!

RSH

Jasper

#10 Post by Jasper »

Hi again,

One forum member reported doing a substantial sfs remaster using Ted Dog's ram2sfs with xz compression in 86 seconds.

Here, an xz remaster using Ted Dog's ram2sfs takes about 37 minutes, but a gz remaster takes less than 5 minutes.

Yet, your 15 seconds is not satisfactory?
I don't use save files in general and want to save some time on remastering....
My regards

stemsee

#11 Post by stemsee »

Here is my very simple no icons script. First click creates ppin (flag)
Second click switches flag to nipp and extracts wallper line from puppypin and backs-up present puppypin,creates and inserts wallpaper line only into puppypin0. Then moves puppypin0 to puppypin and sets to rox pinboard on desired display :0.0
Third click switches flag to ppin
and (just in case the user changes the iconless puppypin0 wallpaper) extracts that line and inserts to pupypin-bak and etc.

Code: Select all

#!/bin/sh
# copyright (c) 2014 Marcos Contant
if [ -e ~/Choices/ROX-Filer/nipp ]; then
	mv ~/Choices/ROX-Filer/nipp ~/Choices/ROX-Filer/ppin
	bd=`grep -e '  <backdrop style' ~/Choices/ROX-Filer/PuppyPin0`
	sed -i 3i\ "$bd" ~/Choices/ROX-Filer/PuppyPin-bak
	sed -i 4d ~/Choices/ROX-Filer/PuppyPin-bak
	rm ~/Choices/ROX-Filer/PuppyPin
	cp ~/Choices/ROX-Filer/PuppyPin-bak ~/Choices/ROX-Filer/PuppyPin
	DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
	#xmessage "desktop iconified"
elif [ -e ~/Choices/ROX-Filer/ppin ]; then
	mv ~/Choices/ROX-Filer/ppin ~/Choices/ROX-Filer/nipp
	bd=`grep -e '<backdrop style' ~/Choices/ROX-Filer/PuppyPin`
	echo '<?xml version="1.0"?>' > ~/Choices/ROX-Filer/PuppyPin0
	echo "<pinboard>" >> ~/Choices/ROX-Filer/PuppyPin0
	echo "<backdrop style="Stretched">/usr/share/backgrounds/reflecion.png</backdrop>" >> ~/Choices/ROX-Filer/PuppyPin0
	echo \ >> ~/Choices/ROX-Filer/PuppyPin0
	echo "</pinboard>" >> ~/Choices/ROX-Filer/PuppyPin0
	sed -i 3i\ "$bd" ~/Choices/ROX-Filer/PuppyPin0
	sed -i 4d ~/Choices/ROX-Filer/PuppyPin0
	mv ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin-bak
	cp ~/Choices/ROX-Filer/PuppyPin0 ~/Choices/ROX-Filer/PuppyPin
	DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
	#xmessage "desktop de-iconified"
elif [[ ! -e ~/Choices/ROX-Filer/nipp && ! -e ~/Choices/ROX-Filer/ppin ]]; then
touch ~/Choices/ROX-Filer/ppin
fi


User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#12 Post by LazY Puppy »

Jasper wrote:Hi again,

One forum member reported doing a substantial sfs remaster using Ted Dog's ram2sfs with xz compression in 86 seconds.

Here, an xz remaster using Ted Dog's ram2sfs takes about 37 minutes, but a gz remaster takes less than 5 minutes.

Yet, your 15 seconds is not satisfactory?
I don't use save files in general and want to save some time on remastering....
My regards
Of course, it's absolutely satisfactory.

But:
Taken from this Post.
RSH wrote:I'm constantly remastering my LazY Puppy (yes, still the one based on the Lucid 5.2.8-4) - almost on each and every Day since I've started to working on it. A few Days ago I was pi.. off of remastering since I did forgot to include the same File (a hidden on, .NAME) three times in a row at remastering. So I picked up an older work that has been laying around for Months. The Plan was to read out a config File (which is already existing and fully working - except this one special purpose) and to get Information from this config File to let a StartUp Script do its Job related to the current OS booting ($DISTRO_FILE_PREFIX).
So including copying the files three times to their destination location and re-booting the OS, it has had taken about five to seven Minutes to get the damn file into the OS. Adding a line into the Startup Script would have taken just two seconds and only just a single reboot - or even temporarily executing this single Line from within a terminal. :wink:
stemsee wrote:Here is my very simple no icons script.
Thanks for offering this. I will check this out, but I think I can solve this smarter using the code I do already use for the VarioMenu - no restarting of X needed by the way. Or even I'm going to examine the "swapicons".
Jasper wrote:There is the excellent and versatile "swapicons" or roxoff with restart x
Thanks for all your postings, suggestions and opinions.

RSH

stemsee

#13 Post by stemsee »

="LazY Puppy" - no restarting of X needed by the way. Or even I'm going to examine the "swapicons".
My simple code/solution (maybe not cool enough and easily dismissed out-of-hand) DOES NOT restart-X. I hope you at least try it.

Jasper

#14 Post by Jasper »

Hi stemsee,

For me, your code exhibits three problems:
* the show/hide drive icons aspect fails for some drives sometimes
* the original background is not restored
* if using xonclock it disappears from the screen.
I expect you can easily fix these hitches.
--------------
For a plain black screen I occasionally use roxoff

Code: Select all

rox -p=
but then, in my ignorance, I only know how to restore using "restart x".
--------------
Swapicons is fast, accurate, and flexible (I am now reminded the latest v 1.2 is even more flexible than the sfs I provided).

English is, understandably, not an RSH forte. So, though rarely a problem, we do not always understand each other perfectly.

My regards

stemsee

#15 Post by stemsee »

@jasper

Ok...I think that our objectives are somewhat different. My objective was to have an iconless desktop easily, and be able to switch back easily. Drive icons are icons, and anyway managed by 'Desktop Drive Icons Manager'. When you say 'original background' do you mean default? Is xonclock an icon?

Maybe you are concerned with icon 'management' which was until now not in my considerations. However I have devised a method to manage icons that can remain or be removed as the user wishes. And an option to restore exactly the original puppypin.

Also 'rox -p=' is great to know. When using mutlipins by stemsee one need only type the current screen resolution '1366' or whatever to get the iconified desktop back without restarting X. Or simply click on the show/hide-icons button in the tray next to menu.

But this is hijacking RSH's thread.

Jasper

#16 Post by Jasper »

Hi stemsee,

I don't know an official definition of xonclock when in use - perhaps a running applet.

Swapicons is, I repeat, fast and flexible and it actually handles desktop drive icons properly.

Try it.
Attachments
shots-1&3.png
(138.88 KiB) Downloaded 589 times
shot-2.png
(114.09 KiB) Downloaded 602 times

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#17 Post by LazY Puppy »

I have attached updated 'init' and 'auto_execute' Scripts.

Attachments are at the End of the first Post.

Changes:

- option $MYDESKTOPICONS is now working, so booting into a clean desktop is possible.

RSH

stemsee

#18 Post by stemsee »

Thanks @RSH

I have downloaded and I will first scan the scripts then try them out, over the next few days.

stemsee

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#19 Post by LazY Puppy »

stemsee wrote:Thanks @RSH

I have downloaded and I will first scan the scripts then try them out, over the next few days.

stemsee
Make sure to examine the updated 'init' script. I have overseen to mark (# RSH) a needed Line inside of the 'init' script inside initrd.gz. This line is needed for PSUBDIR.

Here it is:

basedirpupsfs="`dirname $PUPSFSFILE`"

Btw.:

I have added this successful to the initrd.gz of Precise 5.7.1 and it worked out of the box. Also Tahr 5.8.1.5 and Tahr 6.0 CE, but I need to refine the Wallpaper Option for both of them.

Wallpaper Option currently uses default.jpg and will fail if different name is setup and/or if .png file is used.

RSH

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#20 Post by LazY Puppy »

http://murga-linux.com/puppy/viewtopic. ... 062#810062
RSH wrote:Beyond this everything seems to be possible using a fresh, clean and un-remastered version of any Puppy Linux.
Ok, I have made some Progress, I have gone beyond! 8)

Now I'm able to boot a fresh, clean and un-remastered Puppy Linux directly into DE Interface using a different Window Manager which is loaded by SFS at boot up process - NOT at /root/StartUp

Just by using the Config File and using the new boot option pinterface from L.A.S.S.I.E. 003.

Options that are currently available AND working:

# Sleep Time - new
# Window Manager - new
# Window Manager SFS to load - new
# Keyboard Layout
# Mount all HD and USB Flash Drives
# Mount only selected HD and USB Flash Drives
# Personal Settings PopUp
# Desktop Icons
# Drive Icons - new
# Wallpapers
# Startup Sound
# Auto-Installation of Packages from Directory (deb, pet, *.gz, rpm, txz & xz) - new added after doing this here Post
# Auto-Load of SFS Modules (/etc/profile.local) - new added after doing this here Post
# Auto-Load of SFS Modules (/root/Startup)
# Auto-Start of Applications
# Startup Script

Since I can't boot Slacko 5.9.3 into DE Interface or even DE Keyboard (won't find the puppy sfs) I will continue this work using a fresh, clean and un-remastered version of precise 5.7.1.

Uploading a precise 5.7.1 initrd.gz File later.

:D

RSH

Post Reply