The time now is Fri 22 Feb 2019, 12:15
All times are UTC - 4 |
Author |
Message |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Sat 26 Jun 2010, 05:07 Post subject:
|
|
Here it is, Moo 003:
- JWM theme, icon theme, GTK theme and wallpaper selection GUI
- More fixes, detection of errors
- Slightly faster
- Better GUI
- Puplet name, version and prefix
- Works with Puppy 4.3.1 and above (all Woofed puppies)
TODO:
- Default applications wizard integration
- Make the pets/stuff directories really optional (no need to specify if you don't want them)
Code: | #!/bin/busybox ash
# Moo - a simple Puppy remaster tool
# Iguleder, June 2010, GPL, gl hf
. /etc/DISTRO_SPECS
# the puplet name, prefix and version
export pupletName=$DISTRO_NAME
export pupletPrefix=$DISTRO_FILE_PREFIX
export pupletVersion=$DISTRO_VERSION
# the ISO you wish to remaster
export originalIso="/path/to/iso"
# a directory with PETs to slipstream and an optional directory to copy over to the main SFS
export petsDirectory="/root/moo/pets"
export stuffDirectory="/root/moo/stuff"
# a working for all operations directory
export workingDirectory="/tmp"
# the directory for the remastered iso
export isoDirectory="/root"
# a working directory where the SFS is extracted, needs plenty of space
export sfsWorkingDirectory="$workingDirectory/sfstemp"
# a working directory for the initramfs
export initramfsWorkingDirectory="$workingDirectory/initramfstemp"
# a working directory for the extracted, remastered ISO
export isoWorkingDirectory="$workingDirectory/isotemp"
# a working directory for PETs
export petWorkingDirectory="$workingDirectory/pettemp"
# a temporary mount point for the ISO
export isoMountPoint="/mnt/`basename $originalIso`"
# export all functions, credit goes to sc0ttman
set -a
mount_iso()
{
echo "Creating a mount point for the ISO"
mkdir -p "$isoMountPoint"
echo "Mounting the ISO"
mount -t iso9660 -o loop,ro "$originalIso" "$isoMountPoint"
}
extract_iso()
{
echo "Creating the ISO working directory"
mkdir -p "$isoWorkingDirectory"
sfsFileName="$(basename `ls $isoMountPoint/*.sfs`)"
echo "Extracting the ISO"
for file in `ls $isoMountPoint/*`; do
temp=`basename $file`
if [ "$temp" != "$sfsFileName" ]; then
echo " $temp"
cp $file "$isoWorkingDirectory"
fi
done
}
unmount_iso()
{
echo "Unmounting the ISO"
umount -d "$isoMountPoint"
echo "Removing the ISO mount point"
rmdir "$isoMountPoint"
}
extract_sfs()
{
echo "Extracting the Puppy SFS"
unsquashfs -d "$sfsWorkingDirectory" "$isoMountPoint/$sfsFileName" > /dev/null 2>&1
}
# usage: add_pet /path/to/pet
add_pet()
{
echo "Adding `basename $1`"
echo " Extracting"
tar xzf $1 -C $petWorkingDirectory > /dev/null 2>&1
echo " Copying files to the SFS working directory"
cp -r $petWorkingDirectory/*/* "$sfsWorkingDirectory"
if [ -f "$sfsWorkingDirectory/pinstall.sh" ]; then
echo " Executing pinstall.sh"
chroot $sfsWorkingDirectory bash pinstall.sh
rm $sfsWorkingDirectory/pinstall.sh
fi
echo " Cleaning the PET working directory"
rm -r $petWorkingDirectory/*
}
add_pets()
{
echo "Creating the PET working directory"
mkdir "$petWorkingDirectory"
for pet in `find $petsDirectory -name '*.pet'`; do
add_pet `realpath $pet`
done
echo "Deleting PET working directory"
rmdir "$petWorkingDirectory"
rm $sfsWorkingDirectory/*pet.specs
}
add_stuff()
{
if [ -f "$stuffDirectory" ]; then
if [ "`ls $stuffDirectory`" != "" ]; then
echo "Adding other stuff"
cp -r $stuffDirectory/* "$sfsWorkingDirectory"
fi
fi
}
create_sfs()
{
echo "Creating the remastered SFS"
mksquashfs "$sfsWorkingDirectory" "$isoWorkingDirectory/$pupletPrefix-$pupletVersion.sfs"
echo "Deleting the SFS working directory"
rm -r "$sfsWorkingDirectory"
}
create_iso()
{
cd "$isoWorkingDirectory"
echo "Creating the ISO"
mkisofs -D -R -o "$isoDirectory/$pupletPrefix-$pupletVersion.iso" -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "$isoWorkingDirectory"
echo "Deleting the ISO working directory"
rm -r "$isoWorkingDirectory"
if [ -f $isoDirectory/$pupletPrefix-$pupletVersion.iso ]; then
export flag=1
fi
}
last_minute()
{
cd $sfsWorkingDirectory
. etc/DISTRO_SPECS
echo "Doing all last-minute stuff"
echo " Setting the puplet name"
sed s/DISTRO_NAME=\'$DISTRO_NAME\'/DISTRO_NAME=\'$pupletName\'/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
echo " Setting the puplet version"
sed s/DISTRO_VERSION=$DISTRO_VERSION/DISTRO_VERSION=$pupletVersion/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
echo " Setting the puplet file prefix"
sed s/DISTRO_FILE_PREFIX=\'$DISTRO_FILE_PREFIX\'/DISTRO_FILE_PREFIX=\'$pupletPrefix\'/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
echo " Running fixmenus"
chroot . fixmenus > /dev/null 2>&1
}
# must run before create_sfs (!!!)
create_initramfs()
{
echo "Remastering the initramfs"
echo " Creating the initramfs working directory"
mkdir "$initramfsWorkingDirectory"
echo " Moving over the initramfs"
mv "$isoWorkingDirectory/initrd.gz" "$initramfsWorkingDirectory"
cd "$initramfsWorkingDirectory"
echo " Extracting the initramfs"
gunzip initrd.gz
cpio -i < initrd
rm initrd
echo " Writing the puplet information"
cp "$sfsWorkingDirectory/etc/DISTRO_SPECS" .
echo " Creating the remastered initramfs"
find . | cpio -o -H newc | gzip -9 > "$isoWorkingDirectory/initrd.gz"
echo "Deleting the initramfs working directory"
rm -r "$initramfsWorkingDirectory"
}
# a wrapper for everything
remaster()
{
if [ "`initial_checks`" = "passed" ]; then
msgbox "The remastering process will begin now. It may take time; you will see a message when it is over. Press \"OK\" to continue."
mount_iso
if [ "$(mount | grep "on $isoMountPoint")" != "" ]; then
extract_iso
if [ "`ls $isoWorkingDirectory`" != "" ]; then
extract_sfs
if [ "`ls $sfsWorkingDirectory`" != "" ]; then
unmount_iso
if [ "$(mount | grep "on $isoMountPoint")" = "" ]; then
add_pets
add_stuff
last_minute
select_artwork
create_initramfs
if [ -f "$isoWorkingDirectory/initrd.gz" ]; then
create_sfs
if [ -f "$isoWorkingDirectory/$pupletPrefix-$pupletVersion.sfs" ]; then
create_iso
else
error="unable to create the SFS."
fi
else
error="unable to create the initramfs."
fi
else
error="unable to unmount the ISO."
fi
else
error="unable to extract the SFS."
fi
else
error="unable to extract the ISO."
fi
else
error="unable to mount the ISO."
fi
if [ "$flag" = 1 ]; then
msgbox "Done! Your remastered ISO is $isoDirectory/$pupletPrefix-$pupletVersion.iso."
else
msgbox "Error: $error"
clean_up
fi
else
msgbox "Something is wrong with the selected options. Make sure all fields contain valid values."
fi
}
select_artwork()
{
echo "Locating artwork"
cd "$sfsWorkingDirectory"
for iconTheme in `ls -1 usr/local/lib/X11/themes`; do
if [ "`file usr/local/lib/X11/themes/$iconTheme | grep directory`" != "" ]; then
export iconThemes="$iconThemes<item>$iconTheme</item>"
fi
done
for jwmTheme in `ls -1 root/.jwm/themes | grep jwmrc`; do
export jwmThemes="$jwmThemes<item>${jwmTheme%%-jwmrc*}</item>"
done
for wallpaper in `ls -1 usr/share/backgrounds`; do
export wallpapers="$wallpapers<item>$wallpaper</item>"
done
for gtkTheme in `ls -1 usr/share/themes`; do
if [ "$gtkTheme" != "Default" ]; then
export gtkThemes="$gtkThemes<item>$gtkTheme</item>"
fi
done
export themeChooser='
<vbox>
<hbox>
<text><label>Icon theme:</label></text>
<combobox width-request="250">
<variable>iconTheme</variable>
'$iconThemes'
</combobox>
</hbox>
<hbox>
<text><label>JWM theme:</label></text>
<combobox width-request="250">
<variable>jwmTheme</variable>
'$jwmThemes'
</combobox>
</hbox>
<hbox>
<text><label>Wallpaper:</label></text>
<combobox width-request="250">
<variable>wallpaper</variable>
'$wallpapers'
</combobox>
</hbox>
<hbox>
<text><label>GTK theme:</label></text>
<combobox width-request="250">
<variable>gtkTheme</variable>
'$gtkThemes'
</combobox>
</hbox>
<button label="OK" has-focus="true">
<action>echo $iconTheme > /tmp/moo</action>
<action>echo $jwmTheme >> /tmp/moo</action>
<action>echo $wallpaper >> /tmp/moo</action>
<action>echo $gtkTheme >> /tmp/moo</action>
<action>EXIT:Exit</action>
</button>
</vbox>'
gtkdialog3 -c -p themeChooser > /dev/null 2>&1
iconTheme=`cat /tmp/moo | head -1`
jwmTheme=`cat /tmp/moo | head -2 | tail -1`
wallpaper=`cat /tmp/moo | head -3 | tail -1`
gtkTheme=`cat /tmp/moo | tail -1`
rm /tmp/moo
echo "Setting artwork"
rm usr/local/lib/X11/pixmaps/*
cp -a usr/local/lib/X11/themes/$iconTheme/* usr/local/lib/X11/pixmaps
echo $iconTheme > etc/desktop_icon_theme
cp -f root/.jwm/themes/$jwmTheme-colors root/.jwm/jwm_colors
cp -f root/.jwm/themes/$jwmTheme-jwmrc root/.jwm/jwmrc-theme
cp usr/share/backgrounds/$wallpaper usr/share/backgrounds/default.jpg
echo "# -- THEME AUTO-WRITTEN DO NOT EDIT
include \"/usr/share/themes/$gtkTheme/gtk-2.0/gtkrc\"
include \"/root/.gtkrc.mine\"
# -- THEME AUTO-WRITTEN DO NOT EDIT" > root/.gtkrc-2.0
}
msgbox()
{
export message="
<vbox>
<text><label>$1</label></text>
<button label=\"OK\" has-focus=\"true\">
<action>EXIT:Exit</action>
</button>
</vbox>"
gtkdialog3 -c -p message > /dev/null 2>&1
}
initial_checks()
{
if [[ -f "$originalIso" && -d "$workingDirectory" && -d "$petsDirectory" && -d "$stuffDirectory" && "$pupletName" != "" && "$pupletVersion" != "" && "$pupletPrefix" != "" && -d "$isoDirectory" ]]; then
echo "passed"
fi
}
clean_up()
{
echo "Cleaning up"
if [ -d "$isoMountPooint" ]; then
if [ "$(mount | grep "on $isoMountPoint")" != "" ]; then
umount "$isoMountPoint"
fi
rmdir "$isoMountPoint"
fi
if [ -f "$sfsWorkingDirectory" ]; then
rm -r "$sfsWorkingDirectory"
fi
if [ -f "$initramfsWorkingDirectory" ]; then
rm -r "$initramfsWorkingDirectory"
fi
if [ -f "$isoWorkingDirectory" ]; then
rm -r "$isoWorkingDirectory"
fi
if [ -f /tmp/moo ]; then
rm /tmp/moo
fi
}
export gui='
<window title="Moo 003" allow-grow="false">
<vbox>
<text><label>Welcome to the Moo remaster tool.</label></text>
<frame Technical Stuff>
<hbox>
<text><label>The Puppy ISO to remaster:</label></text>
<entry accept="file" >
<default>"'$originalIso'"</default>
<variable>originalIso</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">originalIso</action>
</button>
</hbox>
<hbox>
<text><label>A working directory (at least 512 MB free):</label></text>
<entry accept="directory">
<default>"'$workingDirectory'"</default>
<variable>workingDirectory</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">workingDirectory</action>
</button>
</hbox>
<hbox>
<text><label>A directory with PETs to slipstream (optional):</label></text>
<entry accept="directory">
<default>"'$petsDirectory'"</default>
<variable>petsDirectory</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">petsDirectory</action>
</button>
</hbox>
<hbox>
<text><label>A directory with stuff to copy to the main SFS (optional):</label></text>
<entry accept="directory">
<default>"'$stuffDirectory'"</default>
<variable>stuffDirectory</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">stuffDirectory</action>
</button>
</hbox>
</frame>
<frame The Puplet Information>
<hbox>
<vbox>
<text><label>The puplet name:</label></text>
<entry>
<default>"'$pupletName'"</default>
<variable>pupletName</variable>
</entry>
</vbox>
<vbox>
<text><label>The puplet prefix:</label></text>
<entry>
<default>"'$pupletPrefix'"</default>
<variable>pupletPrefix</variable>
</entry>
</vbox>
<vbox>
<text><label>The puplet version:</label></text>
<entry>
<default>"'$pupletVersion'"</default>
<variable>pupletVersion</variable>
</entry>
</vbox>
</hbox>
</frame>
<hbox>
<text><label>Location for the remastered ISO:</label></text>
<entry>
<default>"'$isoDirectory'"</default>
<variable>isoDirectory</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">isoDirectory</action>
</button>
</hbox>
<hbox>
<button>
<label>Remaster</label>
<action>remaster</action>
</button>
<button use-stock="true" label="gtk-quit">
<label>Exit</label>
<action type="exit">EXIT_NOW</action>
</button>
</hbox>
</vbox>
</window>'
gtkdialog3 -p gui
|
Here's a screeny of Cow 001, an example puplet ... 431 with pwidgets, Bones and the Stardust icon theme. Works just fine, it's moo-001.iso and moo-001.sfs, and the save file is moo too
Description |
|
Filesize |
47.61 KB |
Viewed |
1025 Time(s) |

|
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Sat 26 Jun 2010, 06:53 Post subject:
|
|
Looks great... Just a few questions...
Moo will not change the version number, sfs prefix or puplet name on my puppies..
Because as mentioned, Puppy 4.2 (all Unleashed puppies, I guess) don't have 'DISTRO_SPECS'..
(Maybe it's just a TurboPup thing though... Anyone confirm this?
Cos strangely, 214X has DISTRO_SPECS..
but ttuuxxx changed it so much, I don't know if thats normal..)
So...
1. I still need to be sure of the correct method used in 4.2 and under (Unleashed puppies) to set distro name?
2. I want to be able to change sfs prefix, but methods seem to differ in <4.2 and 4.3>
The sfs prefix in the 4.2 init script is hardcoded to 'pup_', is this the same in all Puppies?
Or is the prefix value (in the init script) now taken from DISTRO_SPECS, as your code suggests?
About version numbers:
Actually, in Woofy, I will simply leave the version number unchanged from the base..
I don't think its right to change the version number - they are not new versions built from nothing, only puplets..
People could remaster a 4.2 iso, and call it 431, 433, or even 503, just to be first..
I dont want to contribute to even more confusing puppy version numbers..
Finally..
I'm 99% sure that my defaults-changer will just need a prefix added to the file paths to work on an extracted sfs...
I'm doing it now.. At least that should be nice and quick
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Sat 26 Jun 2010, 09:40 Post subject:
|
|
I think 2.14x has DISTRO_SPECS because ttuxxx took many scripts from Woof ... they determine the version number and distro name according to that file.
I've noticed some stuff use /etc/puppyversion ... like pwidgets. I added that to Moo already.
Try to take a look in the 4.2.1 init scripts (in /etc/rc.d) and see how they detect the distro name and version. Maybe it's fixed, so you'll need some sed work.
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Sat 26 Jun 2010, 13:46 Post subject:
|
|
updated to version 0.3.. see main post (thanks lguleder!)
themes and default apps now can be changed...
That all works great..
still gotta do the distro name and sfs prefix for 4.2, then i'll add the DISTRO_SPECS stuff...
and add a splash message before the sfs is created..
then i'm done with it..
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Tue 29 Jun 2010, 02:51 Post subject:
|
|
Would it be a good idea to have a list/dir of bugfixes to be applied to the remastered sfs?
Perhaps Woofy could check for the version and apply fixes for that version...
.. Such as replacing old system files with updated ones, searching for bugs and replacing with updated code...
For example, Patriots clean unmount pup save file fix, updated init script?
I'd like Woofy to be able to bring remastered puplets 'up to date' a litte bit, in terms of bugfixes..
Just a thought...
But then, only 7 downloads, so I guess no one cares!
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
Last edited by sc0ttman on Tue 29 Jun 2010, 03:09; edited 1 time in total
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Tue 29 Jun 2010, 02:57 Post subject:
|
|
I do.
(lol, I logged in immediately after you posted this)
I already had that idea in mind.
I'm currently trying to integrate Moo with Woof, find a way to auto-download Woof and steal the rootfs-skeleton thing from it. That can also solve the splash screen problem, because Woof generates it. The problem is applying the distro details ... the DISTRO_SPECS file is not enough.
If I get anything to work, I'll post it.
Also, I had a funny idea, a tool that gets a list of PETs and makes a Puppy from them. Just takes a pets list, then downloads them and Woof, trims the packages and viola, a new Puppy. Sort of a combination between Unleashed and Woof
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
tubby
Joined: 24 Jan 2009 Posts: 317
|
Posted: Tue 29 Jun 2010, 03:05 Post subject:
|
|
I certainly do, i was just waiting for you two devs to reach a level when you were reasonably happy with your efforts.
Keep on working on it please and it could be one of the best projects for woof builds.
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Tue 29 Jun 2010, 03:27 Post subject:
|
|
tubby wrote: | I certainly do, i was just waiting for you two devs to reach a level when you were reasonably happy with your efforts. |
So far, I am very happy with Woofy (especially with lguleders additions), as it all works perfectly and is very simple to use...
I'm actually now using a 'woofylet' as my default OS.. Very happy with it.
I just wanna add a few features - without complicating the Woofy remaster process..
Woofy currently allows a '1 click' remaster - I'd like to keep this feature
This way, even new users can simply add packages and click 'Go'..
Changing the actual distro name is not that important to me - as it's pretty much hidden from the user, anyway..
I may leave it.. Changing wallpapers, gtk themes and splash images have more effect..
But adding a few bugfixes 'on the fly' would be nice.. I'll look into it..
I may need a list of bugfix suggestions (and help!) from people..
And I would love to let users choose a new splash screen, cos it makes a big difference to puplets...
I repeatedly find myself missing the files required to check it out...
But couldn't an image just be replaced?
tubby wrote: | Keep on working on it please and it could be one of the best projects for woof builds. |
Moo or Woofy?? Cos for Woofy, I'm not gonna add any features which will only work for Woof built puppies..
I want Woofy to be VERY simple to use...
So I need all features to work as expected, no matter what ISO is chosen.
Perhaps Moo will be more suited to more advanced users, who want to change specific 'Woof' features.
BTW, I don't mind the Moo stuff going here at all, but wonder if another thread may be better?
I think the scope of Moo will soon exceed my expertise (and therefore Woofy)..
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Tue 29 Jun 2010, 03:44 Post subject:
|
|
You're right, I'll open a new thread for Moo, sort of a "development version" of Woofy for more advanced users
This way you can work on Woofy and I on Moo in parallel, share ideas and features ... could be great. I find this quite fun, actually ... I'm looking forward to improve Woofy. Moo is just my "plaything" (quote of Barry ), I just don't like working with alien code, so I wrote my own remaster tool from scratch to help you with Woofy, but now it's so fun I can't resist the urge to make it full-featured
By the way, I'm currently working on the skeleton updation code ... would you like me to write some code that makes a non-Woof Puppy a Woof-Puppy? I mean, puts all the Woof stuff, including the new PPM and all Puppy wizards?
I think it could be quite cool to have such a feature in Woofy.
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 2805 Location: South Australia :-(
|
Posted: Tue 29 Jun 2010, 05:31 Post subject:
|
|
Guys here are a few ideas for you to think about. You may have already implemented some of them.
The thing that I find really annoying is dependency control. Ok let me provide a working example.
I take a perfectly good distro and install a new software package. The files that are installed are stored in a package file so they can be uninstalled later with PPM if you decide to uninstall the package. The problem is some dependencies are required by a number of packages. Now PPM is smart enough not to delete all files automatically and you have to manually delete some if you want. Most of the time people don't bother in case they delete something required and break another package. I'm not sure how this is done but I guess it looks at the package install list.
Now what would be really nice is a way of checking to see if the dependency already exists. If it does do not install it again, maybe ask if it is a later version. If we had something like this then all packages could contain all dependencies and the missing dependency problem would disappear, unfortunately the packages will be bigger than necessary.
Another method might be to do a test install to see what dependencies are missing/required before installation. Sort of similar to check dependencies before installation instead of after.
One last thing. It would be nice to have a package list of all software in puppy that could be safely removed. This would allow you to make your own bare bones puppy then install what you like. This would be a great enhancement to woofy.
Just a few ideas to get your creative juices flowing
_________________ Software <-> Distros <-> Tips <-> Newsletters
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Tue 29 Jun 2010, 06:15 Post subject:
|
|
I already have many fixes for Woofy, sc0ttman. Here's my 005.
- Use of mktemp for the creation of temporary files and working directories
- Much better error detection
- Way better validation of the selected options
- Clean up code in case the remastering fails
Now it's much better and safer. Also more user friendly, you should add those to Woofy.
The next Moo will have its own thread, since 006 is going to mess with Woof itself, not very useful for Woofy, although I'm pretty sure making Woofy apply all the Woof stuff to an Unleashed Puppy is a nice trick
Code: | #!/bin/busybox ash
# Moo - a simple Puppy remaster tool
# Iguleder, June 2010, GPL, gl hf
. /etc/DISTRO_SPECS
# the puplet name, prefix and version
export pupletName=$DISTRO_NAME
export pupletPrefix=$DISTRO_FILE_PREFIX
export pupletVersion=$DISTRO_VERSION
# the ISO you wish to remaster
export originalIso="/path/to/iso"
# a directory with PETs to slipstream and an optional directory to copy over to the main SFS
export petsDirectory="/root/moo/pets"
export stuffDirectory="/root/moo/stuff"
# a working directory for all operations
export workingDirectory="/tmp"
# the directory for the remastered iso
export isoDirectory="/root"
# export all functions, credit goes to sc0ttman
set -a
mount_iso()
{
echo "Creating a mount point for the ISO"
# a temporary mount point for the ISO
export isoMountPoint=`mktemp -d -p /mnt`
echo "Mounting the ISO"
mount -t iso9660 -o loop,ro "$originalIso" "$isoMountPoint"
}
extract_iso()
{
echo "Creating the ISO working directory"
# a working directory for the extracted, remastered ISO
export isoWorkingDirectory=`mktemp -d -p $workingDirectory`
sfsFileName="$(basename `ls $isoMountPoint/*.sfs`)"
echo "Extracting the ISO"
for file in `ls $isoMountPoint/*`; do
temp=`basename $file`
if [ "$temp" != "$sfsFileName" ]; then
echo " $temp"
cp $file "$isoWorkingDirectory"
fi
done
}
unmount_iso()
{
echo "Unmounting the ISO"
umount -d "$isoMountPoint"
echo "Removing the ISO mount point"
rmdir "$isoMountPoint"
}
extract_sfs()
{
echo "Creating the SFS working directory"
# a working directory where the SFS is extracted, needs plenty of space
export sfsWorkingDirectory=`mktemp -u -d -p $workingDirectory`
echo "Extracting the Puppy SFS"
unsquashfs -d $sfsWorkingDirectory "$isoMountPoint/$sfsFileName" > /dev/null 2>&1
}
# usage: add_pet /path/to/pet
add_pet()
{
echo "Adding `basename $1`"
echo " Extracting"
tar xzf $1 -C $petWorkingDirectory > /dev/null 2>&1
echo " Copying files to the SFS working directory"
cp -r $petWorkingDirectory/*/* "$sfsWorkingDirectory"
if [ -f "$sfsWorkingDirectory/pinstall.sh" ]; then
echo " Executing pinstall.sh"
chroot "$sfsWorkingDirectory" bash pinstall.sh
rm "$sfsWorkingDirectory/pinstall.sh"
fi
echo " Cleaning the PET working directory"
rm -r $petWorkingDirectory/*
}
add_pets()
{
if [ -d "$petsDirectory" ]; then
echo "Creating the PET working directory"
# a working directory for PETs
export petWorkingDirectory=`mktemp -d -p $workingDirectory`
for pet in `find $petsDirectory -name '*.pet'`; do
add_pet `realpath $pet`
done
echo "Deleting PET working directory"
rmdir "$petWorkingDirectory"
rm $sfsWorkingDirectory/*pet.specs
fi
}
add_stuff()
{
if [ -d "$stuffDirectory" ]; then
if [ "`ls $stuffDirectory`" != "" ]; then
echo "Adding other stuff"
cp -r $stuffDirectory/* "$sfsWorkingDirectory"
fi
fi
}
create_sfs()
{
echo "Creating the remastered SFS"
mksquashfs "$sfsWorkingDirectory" "$isoWorkingDirectory/$pupletPrefix-$pupletVersion.sfs"
echo "Deleting the SFS working directory"
rm -r "$sfsWorkingDirectory"
}
create_iso()
{
cd "$isoWorkingDirectory"
echo "Creating the ISO"
mkisofs -D -R -o "$isoDirectory/$pupletPrefix-$pupletVersion.iso" -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "$isoWorkingDirectory"
echo "Deleting the ISO working directory"
rm -r "$isoWorkingDirectory"
if [ -f $isoDirectory/$pupletPrefix-$pupletVersion.iso ]; then
export flag=1
fi
}
last_minute()
{
cd $sfsWorkingDirectory
. etc/DISTRO_SPECS
echo "Doing all last-minute stuff"
echo " Setting the puplet name"
sed s/DISTRO_NAME=\'$DISTRO_NAME\'/DISTRO_NAME=\'$pupletName\'/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
echo " Setting the puplet version"
sed s/DISTRO_VERSION=$DISTRO_VERSION/DISTRO_VERSION=$pupletVersion/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
echo " Setting the puplet file prefix"
sed s/DISTRO_FILE_PREFIX=\'$DISTRO_FILE_PREFIX\'/DISTRO_FILE_PREFIX=\'$pupletPrefix\'/ etc/DISTRO_SPECS > etc/DISTRO_SPECS_temp
mv etc/DISTRO_SPECS_temp etc/DISTRO_SPECS
if [[ -d "$petsDirectory" || -d "$stuffDirecotry" ]]; then
echo " Running fixmenus"
chroot . fixmenus > /dev/null 2>&1
fi
}
# must run before create_sfs (!!!)
create_initramfs()
{
echo "Remastering the initramfs"
echo " Creating the initramfs working directory"
# a working directory for the initramfs
export initramfsWorkingDirectory=`mktemp -d -p $workingDirectory`
echo " Moving over the initramfs"
mv "$isoWorkingDirectory/initrd.gz" "$initramfsWorkingDirectory"
cd "$initramfsWorkingDirectory"
echo " Extracting the initramfs"
gunzip initrd.gz
cpio -i < initrd
rm initrd
echo " Writing the puplet information"
cp "$sfsWorkingDirectory/etc/DISTRO_SPECS" .
echo " Creating the remastered initramfs"
find . | cpio -o -H newc | gzip -9 > "$isoWorkingDirectory/initrd.gz"
echo "Deleting the initramfs working directory"
rm -r "$initramfsWorkingDirectory"
}
# a wrapper for everything
remaster()
{
if [ "`initial_checks`" = "passed" ]; then
msgbox "Your puplet is $pupletName ${pupletVersion:0:1}.${pupletVersion:1:1}.${pupletVersion:2:1}; the remastered ISO will be $isoDirectory/$pupletPrefix-$pupletVersion.iso." "The remastering process will begin now. It may take time; you will see a message when it is over." "Press \"OK\" to continue."
mount_iso
if [ "$(mount | grep "on $isoMountPoint")" != "" ]; then
extract_iso
if [ "`ls $isoWorkingDirectory`" != "" ]; then
extract_sfs
if [ "`ls $sfsWorkingDirectory`" != "" ]; then
unmount_iso
if [ "$(mount | grep "on $isoMountPoint")" = "" ]; then
add_pets
add_stuff
last_minute
select_artwork
create_initramfs
if [ -f "$isoWorkingDirectory/initrd.gz" ]; then
create_sfs
if [ -f "$isoWorkingDirectory/$pupletPrefix-$pupletVersion.sfs" ]; then
create_iso
else
error="unable to create the SFS"
fi
else
error="unable to create the initramfs"
fi
else
error="unable to unmount the ISO"
fi
else
error="unable to extract the SFS"
fi
else
error="unable to extract the ISO"
fi
else
error="unable to mount the ISO"
fi
if [ "$flag" = 1 ]; then
echo "Done."
msgbox "Done! Your remastered ISO is $isoDirectory/$pupletPrefix-$pupletVersion.iso."
else
msgbox "Error: $error." "The remastering process is canceled."
clean_up
fi
fi
}
select_artwork()
{
echo "Locating artwork"
cd "$sfsWorkingDirectory"
for iconTheme in `ls -1 usr/local/lib/X11/themes`; do
if [ "`file usr/local/lib/X11/themes/$iconTheme | grep directory`" != "" ]; then
export iconThemes="$iconThemes<item>$iconTheme</item>"
fi
done
for jwmTheme in `ls -1 root/.jwm/themes | grep jwmrc`; do
export jwmThemes="$jwmThemes<item>${jwmTheme%%-jwmrc*}</item>"
done
for wallpaper in `ls -1 usr/share/backgrounds`; do
export wallpapers="$wallpapers<item>$wallpaper</item>"
done
for gtkTheme in `ls -1 usr/share/themes`; do
if [ "$gtkTheme" != "Default" ]; then
export gtkThemes="$gtkThemes<item>$gtkTheme</item>"
fi
done
export temp=`mktemp -p /tmp`
export themeChooser='
<vbox>
<hbox>
<text><label>Icon theme:</label></text>
<combobox width-request="250">
<variable>iconTheme</variable>
'$iconThemes'
</combobox>
</hbox>
<hbox>
<text><label>JWM theme:</label></text>
<combobox width-request="250">
<variable>jwmTheme</variable>
'$jwmThemes'
</combobox>
</hbox>
<hbox>
<text><label>Wallpaper:</label></text>
<combobox width-request="250">
<variable>wallpaper</variable>
'$wallpapers'
</combobox>
</hbox>
<hbox>
<text><label>GTK theme:</label></text>
<combobox width-request="250">
<variable>gtkTheme</variable>
'$gtkThemes'
</combobox>
</hbox>
<button label="OK" has-focus="true">
<action>echo $iconTheme > $temp</action>
<action>echo $jwmTheme >> $temp</action>
<action>echo $wallpaper >> $temp</action>
<action>echo $gtkTheme >> $temp</action>
<action>EXIT:Exit</action>
</button>
</vbox>'
gtkdialog3 -c -p themeChooser > /dev/null 2>&1
iconTheme=`cat $temp | head -1`
jwmTheme=`cat $temp | head -2 | tail -1`
wallpaper=`cat $temp | head -3 | tail -1`
gtkTheme=`cat $temp | tail -1`
rm $temp
echo "Setting artwork"
rm usr/local/lib/X11/pixmaps/*
cp -a usr/local/lib/X11/themes/$iconTheme/* usr/local/lib/X11/pixmaps
echo $iconTheme > etc/desktop_icon_theme
cp -f root/.jwm/themes/$jwmTheme-colors root/.jwm/jwm_colors
cp -f root/.jwm/themes/$jwmTheme-jwmrc root/.jwm/jwmrc-theme
cp usr/share/backgrounds/$wallpaper usr/share/backgrounds/default.jpg
echo "# -- THEME AUTO-WRITTEN DO NOT EDIT
include \"/usr/share/themes/$gtkTheme/gtk-2.0/gtkrc\"
include \"/root/.gtkrc.mine\"
# -- THEME AUTO-WRITTEN DO NOT EDIT" > root/.gtkrc-2.0
}
msgbox()
{
for line in "$@"; do
text="$text<text xalign=\"0\"><label>$line</label></text>"
done
export message='
<vbox>
'$text'
<button label="OK" has-focus="true">
<action>EXIT:Exit</action>
</button>
</vbox>'
gtkdialog3 -c -p message #> /dev/null 2>&1
unset text
}
initial_checks()
{
if [ ! -f "$originalIso" ]; then
msgbox "Error: the Puppy ISO you chose to remaster does not exist."
else
if [ ! -d "$workingDirectory" ]; then
msgbox "Error: you chose an invalid working directory."
else
if [ ! -d "$isoDirectory" ]; then
msgbox "Error: you chose an invalid output directory for the remastered ISO."
else
if [ "$pupletName" = "" ]; then
msgbox "Error: the puplet name cannot be blank."
else
temp=${#pupletPrefix}
if [[ "$temp" != "3" && "$temp" != "4" ]]; then
msgbox "Error: the puplet prefix must be either 3 or 4 characters long."
else
if [ "${#pupletVersion}" != "3" ]; then
msgbox "Error: the puplet version must be a 3-digits number."
else
if expr $pupletVersion + 1 &> /dev/null ; then
echo "passed"
else
msgbox "Error: the puplet version must be numeric."
fi
fi
fi
fi
fi
fi
fi
}
clean_up()
{
echo "Cleaning up"
if [ -d "$isoMountPoint" ]; then
if [ "$(mount | grep "on $isoMountPoint")" != "" ]; then
umount -d "$isoMountPoint" > /dev/null 2>&1
fi
rmdir "$isoMountPoint" > /dev/null 2>&1
fi
if [ -d "$sfsWorkingDirectory" ]; then
rm -r "$sfsWorkingDirectory"
fi
if [ -d "$initramfsWorkingDirectory" ]; then
rm -r "$initramfsWorkingDirectory"
fi
if [ -d "$isoWorkingDirectory" ]; then
rm -r "$isoWorkingDirectory"
fi
if [ -d "$petWorkingDirectory" ]; then
rm -r "$petWorkingDirectory"
fi
}
export mainWindow='
<window title="Moo 005" allow-grow="false" width-request="500">
<vbox>
<text><label>Welcome to the Moo remaster tool.</label></text>
<frame Technical Stuff>
<hbox>
<text><label>The Puppy ISO to remaster:</label></text>
<entry accept="file" tooltip-text="This is the ISO you wish to remaster.">
<default>"'$originalIso'"</default>
<variable>originalIso</variable>
</entry>
<button>
<input file icon="gtk-file"></input>
<action type="fileselect">originalIso</action>
</button>
</hbox>
<hbox>
<text><label>Location for the remastered ISO:</label></text>
<entry accept="directory" tooltip-text="This is the directory for the remastered ISO.">
<default>"'$isoDirectory'"</default>
<variable>isoDirectory</variable>
</entry>
<button>
<input file icon="gtk-open"></input>
<action type="fileselect">isoDirectory</action>
</button>
</hbox>
<hbox>
<text><label>A working directory (at least 512 MB free):</label></text>
<entry accept="directory" tooltip-text="This is a working directory where Moo prepares the remastered ISO; it must have a Linux file system with plenty of free space. You can use the default of /tmp to do everything in RAM.">
<default>"'$workingDirectory'"</default>
<variable>workingDirectory</variable>
</entry>
<button>
<input file icon="gtk-open"></input>
<action type="fileselect">workingDirectory</action>
</button>
</hbox>
<hbox>
<text><label>A directory with PETs to slipstream (optional):</label></text>
<entry accept="directory" tooltip-text="This is a directory containing PET packages you wish to slipstream into your puplet. It is optional.">
<default>"'$petsDirectory'"</default>
<variable>petsDirectory</variable>
</entry>
<button>
<input file icon="gtk-open"></input>
<action type="fileselect">petsDirectory</action>
</button>
</hbox>
<hbox>
<text><label>A directory with extra stuff (optional):</label></text>
<entry accept="directory" tooltip-text="This is a directory containing files to copy to the file system root of your puplet, /. It is optional.">
<default>"'$stuffDirectory'"</default>
<variable>stuffDirectory</variable>
</entry>
<button>
<input file icon="gtk-open"></input>
<action type="fileselect">stuffDirectory</action>
</button>
</hbox>
</frame>
<frame The Puplet Information>
<hbox>
<vbox>
<text><label>The puplet name:</label></text>
<entry width-request="215" tooltip-text="This is name of your puplet.">
<default>"'$pupletName'"</default>
<variable>pupletName</variable>
</entry>
</vbox>
<vbox>
<text><label>The puplet prefix:</label></text>
<entry width-request="120" tooltip-text="This is prefix of your puplet.">
<default>"'$pupletPrefix'"</default>
<variable>pupletPrefix</variable>
</entry>
</vbox>
<vbox>
<text><label>The puplet version:</label></text>
<entry width-request="120" tooltip-text="This is version of your puplet; it must be a 3-digit long, natural number.">
<default>"'$pupletVersion'"</default>
<variable>pupletVersion</variable>
</entry>
</vbox>
</hbox>
</frame>
<hbox>
<button>
<label>Remaster</label>
<action>remaster</action>
</button>
<button use-stock="true" label="gtk-quit">
<label>Exit</label>
<action type="exit">EXIT_NOW</action>
</button>
</hbox>
</vbox>
</window>'
gtkdialog3 -p mainWindow
|
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 2805 Location: South Australia :-(
|
Posted: Wed 30 Jun 2010, 17:33 Post subject:
|
|
sc0ttman, It's all gone a bit quiet here.
Have you finished developing woofy or are you just busy?
I have played with moo but have had a few problems.
I noticed you have mention that you can use woofy to delete files/programs from a current distro. I also acknowledge you need to know the file and pathname to do this. Is there some way you could make woofy create a list of installed software to make it easier to uninstall. This would be a great feature but would obviously come with risks.
_________________ Software <-> Distros <-> Tips <-> Newsletters
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Wed 30 Jun 2010, 17:49 Post subject:
|
|
smokey01 wrote: | sc0ttman, It's all gone a bit quiet here.
Have you finished developing woofy or are you just busy?
...
Is there some way you could make woofy create a list of installed software to make it easier to uninstall. This would be a great feature but would obviously come with risks. |
I've been busy.. And will be for a bit..
About deleting stuff, at the moment, I just use pfilesearch to build a list of files to delete...
I just search by app name, and use the list of files returned..
For example, I just search for 'abiword' and copy and paste the returned files and folders into a text file.
I repeat this process for all the apps I want removed and then use this list in Woofy..
However...
I am gonna make the delete feature more user friendly in future.. So..
you just give a list of app names and woofy finds and removes all the matching files for you..
This should mean that to delete (most of) the goffice suite, you would simply supply the following list, in a text file:
Code: | abiword
gnumeric
inkscape
inklite
aeksaurus
goffice |
I see no reason to have to find and list all packages in the base iso...
.. as long as the stuff you want to delete is in the list, it will be removed..
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 2805 Location: South Australia :-(
|
Posted: Wed 30 Jun 2010, 18:08 Post subject:
|
|
sc0ttman wrote: | This should mean that to delete (most of) the goffice suite, you would simply supply the following list, in a text file:
Code: | abiword
gnumeric
inkscape
inklite
aeksaurus
goffice |
I see no reason to have to find and list all packages in the base iso...
.. as long as the stuff you want to delete is in the list, it will be removed.. |
That's great but what about all the associated files and dependencies. Are they left behind or do they get deleted too.
Thanks
_________________ Software <-> Distros <-> Tips <-> Newsletters
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2660 Location: UK
|
Posted: Thu 01 Jul 2010, 08:57 Post subject:
|
|
smokey01 wrote: | That's great but what about all the associated files and dependencies. Are they left behind or do they get deleted too. |
Example: If you search for 'abiword', everything with 'abiword' in the name gets removed - including any files (of any name) that are inside any folders that match 'abiword'.
This removes most stuff, but I was gonna do the same as Moo - add pets to a directory and they get removed..
But this requires users to have the pet files of the stuff they want deleted, and it's a fair bit slower..
Finding these pets, and gettting the correct versions may be a problem..
And it still doesnt solve the dependencies 'issue'..
About this issue - there is no way a user can safely remove the dependencies of any app, without knowing the name of those libs and which other apps share them..
There is no way to automatically and safely remove all libs, if the user doesn't know what can be removed safely..
So, there is no real value in having or building a list of dependencies for apps, because users will still need to know which are safe to remove.
Users cannot escape the need for this knowledge - so putting the libs you want removed in the list is as easy as it can get..
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|