new2dir modified version, imperfect & not thoroughly tested

A home for all kinds of Puppy related projects
Post Reply
Message
Author
Apollia
Posts: 2
Joined: Tue 19 Mar 2013, 20:31
Location: USA
Contact:

new2dir modified version, imperfect & not thoroughly tested

#1 Post by Apollia »

new2dir is a wonderfully useful script included with many (all?) Puppy Linuxes, which makes it much easier to create PET and SFS files.

Wikka page about the original new2dir: http://puppylinux.org/wikka/new2dir

The original version of the new2dir script is by Barry Kauler, the creator of Puppy Linux.

The original new2dir and my modified version of new2dir are under the GNU Lesser General Public License, so anyone is allowed to modify them.


Unfortunately, the original new2dir script makes my hard disk alarmingly busy, even if the software I'm building is all inside the RAM disk. So, I decided to figure out how to stop that.

Also, because I often find Bash very difficult to read and understand, I ended up renaming a lot of variables, and adding some functions and a lot of thorough comments

And, to make it a bit more convenient to build SFS files, I made it possible for this script to optionally launch mksquashfs.


My modified new2dir script is based on the copy of new2dir found in Lighthouse 64 Puppy Linux 6.02 Beta 2.

So far, my modified version seems to mostly work well for me, but, I've only tested it in Lighthouse 64 Puppy Linux 6.02 Beta 2 - a frugal installation running in RAM with no Pupsave file.


Unfortunately, my modified version isn't perfect, and I don't have the time to try to make it perfect. So, people who have a full installation of Puppy, and possibly others who use this script, will still have their disk made busier than it should be.

(Perhaps that could be avoided if this script were modified to be capable of creating a RAM disk.)

Anyone whose /tmp/ folder isn't in a RAM disk will have their disk made unnecessarily, excessively busy by things being done in /tmp/. (And even if you opt not to do anything in /tmp/, some temporary files get written, and that could probably be handled in a more efficient way somehow.)

Though hopefully at least the disk should be less busy than the original new2dir script would make it, because I took out the numerous "sync" commands scattered throughout the script, which were sometimes even inside loops.

I actually don't know if "sync" is important to use or not - but, in my experience, not using it seems to work fine.

But, again, I have only tested this script in Lighthouse 64 Puppy Linux 6.02 Beta 2 - a frugal installation running in RAM with no Pupsave file.


I assume (but am not sure) that anyone who runs Puppy the way I do - with Puppy running entirely in RAM, and booted either from a live disc or a frugal installation with no Pupsave file - will hopefully have no problems with their disk(s) being made excessively busy.

But, please be careful, in case I'm mistaken, or in case there are other problems.


Other known problems or possible problems:

* I commented out the section dealing with .pot (not .pet - .pot) files because somehow (maybe because of a change I made) it caused an error mentioning a unary operator, and I didn't know how to fix that.


* I assume this script possibly might have trouble with paths containing single or double quotes (' or "), since I didn't add in extra code to escape paths, except for an unused function - Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes().

I didn't have the patience to add string-escaping anywhere it might be needed, especially since I don't recall running into trouble related to quotes in filenames with the original new2dir script. I just wanted to avoid a lot of extra testing and fiddling.


* It appears that splitting packages up into separate packages for development files, documentation files, and internationalization files often doesn't work very well - for example, files that get added to the development package sometimes also get erroneously added to the main package. I'm not sure how to fix this, and sorry if this problem was caused by something I did.

Sorry if there are any other problems I'm not aware of!


The source code of my modified new2dir is downloadable from my website:

http://astroblahhh.com/puppy-linux/software/modified-new2dir/v1.0/new2dir.txt


Again, please be careful with it in case there any problems.

I hope this is useful, and all feedback is welcome.

Post Reply