Think that is a very good suggestion
Quote:
Originally Posted by
utu
@ Capricorny
I would like to encourage you to take Klaus up on his offer in his post #29
to present him with 'the automation' to make 'poor-man's re-mastering'
a menu item in some later Knoppix release.
One way to do this might be first to lay out a proof of principle that others
on this forum might emulate and/or suggest improvements to. You've probably
done this already, and only need to collect all your notes, and Forester's
as well if they are relevant, in one place.
It may be more likely to succeed earlier, as a Knoppix refinement, if squashfs
vs cloop differences were left to be suggested as a subsequent refinement
of the basic idea.
I know you also have an avenue to address this on the debian-knoppix mailing list.
I wish you good luck in this however you choose to proceed.
I will try to carry out something in the direction of this very good suggestion.
While the use of cloop vs squashfs is not peripheral in principle, it surely is peripheral in this context, as ordinary users don't need to be aware of such issues at all.
Furthermore, here on this forum we can see that there is a certain demand for remastering - the reasons may not always be that good, but if it can be done easily, then why not?
One important reason to make it simple, is that it will be easier to ask people to upgrade to newer Knoppix versions - older versions are very often the reasons for trouble, and having made a customization will often be an important reason not to upgrade.
There are some compromizes to be made, I think. Just updating the compressed and persistent images should really be a separate step, for testing before a new ISO image is made, but for the utmost ease for the user, a new ISO image is the best end point. That can be very easily tested, and handled with minimum knowledge of file systems etc.
Making an ISO image means, among other things, that the package database gets written to the ISO, and that extra content in /home may get lost if the users don't take the newly generated persistent image along. For several reasons, among them privacy, I will NOT write the whole of user's /home to the ISO! ;-)
Also, even if it is somewhat less efficient, I think making a separate loop-mounted image for the interim file handling during remastering is best. We can foresee many users running off NTFS, and for them, a new ISO file being the only thing left on the NTFS file system afterwards would be the safest and least intrusive option.
Example of simple remastering script
OK, here's a quick and dirty, and not-that-well-debugged version of the basic poor man's remastering, which I just used for remastering 6.7.0 DVD (cloop version). I can guarantee that each single step works, but haven't had time to test the whole thing.
It takes 4 parameters:
- Directory of remastering workspace
- Size of workspace
- Directory of remastered version
- Size of new persistent store
All those may of course be skipped, and sensible defaults used.
Example: ./rem_02.sh /store/local 20000 /store/local/KNOPPIX670 4000
I'm running the remastered version under qemu right now, and it surely works. I see that I will get space problems with max 4GB compressed image, as the cloop is 3.6 GB after purging the obvious things and installing a few programs. Therefore, squashfs may be to prefer here.
Using cloop, space requirement is ca 2x uncompressed KNOPPIX image size, i.e. ca 18-20 GB for DVD version. Using squashfs, it's only 1x. Images are written directly to new KNOPPIX location, so space is needed for that too. I would not recommend writing directly to slow flash memory. Use some hard disk space if you can.
Code:
#!/bin/bash
# Based loosely on Foresters script on Knoppix-forum modified by tay 20110511-20110810
function to_exist() {
[ -d "$1" ] || sudo mkdir -p $1 ;
}
function purge_or_create() {
[ -d "$1" ] && sudo rm -rf $1
sudo mkdir -p $1 ;
}
function remaster_knoppix() {
command=$1; shift;
operand=$1; shift;
case "${command} ${operand}" in
"create workspace") # Setup workspace as loop image
workdir=$1; shift;
psize=$1; shift;
sudo dd if=/dev/zero of=${workdir}/knoppix-remaster-data.img bs=1M count=$psize
sudo losetup /dev/loop7 ${workdir}/knoppix-remaster-data.img
sudo mkfs.ext3 /dev/loop7
sudo losetup -d /dev/loop7
purge_or_create /tmp/knx-remaster-data;
sudo mount ${workdir}/knoppix-remaster-data.img /tmp/knx-remaster-data -o loop=/dev/loop7 ;
;;
"copy live-system") # This is the simplified copy
to_exist /tmp/knx-remaster-data/knx_source ;
# Copy main /UNIONFS
sudo rsync -ax --delete --exclude=home --exclude=lost+found --exclude=var /UNIONFS/ /tmp/knx-remaster-data/knx_source;
# Use a couple of directories/files from KNOPPIX as stubs
sudo rsync -ax /KNOPPIX/home /KNOPPIX/var /tmp/knx-remaster-data/knx_source;
sudo rsync -ax /KNOPPIX/etc/fstab /tmp/knx-remaster-data/knx_source/etc;
;;
"make isofs") # We don't use pipe here
purge_or_create /tmp/knx-remaster-data/knx_tmpiso ;
sudo chmod a+rwx /tmp/knx-remaster-data/knx_tmpiso;
sudo mkisofs -R -U -V "KNOPPIX.net filesystem" -publisher "KNOPPIX www.knoppix.net" -hide-rr-moved -cache-inodes -pad /tmp/knx-remaster-data/knx_source > /tmp/knx-remaster-data/knx_tmpiso/knoppix.iso ;
;;
"compress isofs") # Not optimized cloop compression
newknoppix_dir=$1; shift;
to_exist ${newknoppix_dir}
sudo create_compressed_fs -B 65536 /tmp/knx-remaster-data/knx_tmpiso/knoppix.iso $newknoppix_dir/KNOPPIX;
;;
"make squashfs")
newknoppix_dir=$1; shift;
to_exist ${newknoppix_dir}
sudo mksquashfs /tmp/knx-remaster-data/knx_source $newknoppix_dir/KNOPPIX.sq -b 262144 -noappend ;
;;
"loopcreate persistent") # Create new persistent image, size in MB must be given.
newknoppix_dir=$1; shift;
to_exist ${newknoppix_dir}
psize=$1; shift;
sudo dd if=/dev/zero of=${newknoppix_dir}/knoppix-data.img bs=1M count=$psize
sudo losetup /dev/loop6 ${newknoppix_dir}/knoppix-data.img
sudo mkfs.ext3 /dev/loop6
sudo losetup -d /dev/loop6
purge_or_create /tmp/knx-data
sudo mount ${newknoppix_dir}/knoppix-data.img /tmp/knx-data -o loop=/dev/loop6 ;
sudo rsync -ax --delete /UNIONFS/home /UNIONFS/var /tmp/knx-data ;
sudo umount /tmp/knx-data;
;;
"purge workspace")
sudo umount /tmp/knx-remaster-data
sudo losetup -d /dev/loop7
workdir=$1; shift;
sudo rm -f ${workdir}/knoppix-remaster-data.img
;;
*)
echo oops;
;;
esac
}
# example: ./rem_02.sh /store/local 20000 /store/local/KNOPPIX670 4000
wrkspc_dir=$1 ; wrkspc_sz=$2 ; remaster_dir=$3 ; persist_sz=$4 ;
remaster_knoppix create workspace ${wrkspc_dir} ${wrkspc_sz}
remaster_knoppix copy live-system
# remaster_knoppix make isofs
# remaster_knoppix compress isofs ${remaster_dir}
remaster_knoppix make squashfs ${remaster_dir}
remaster_knoppix loopcreate persistent ${remaster_dir} ${persist_sz}
remaster_knoppix purge workspace