PDA

View Full Version : Speed



pap2003
06-26-2003, 08:23 PM
Klause Knopper is using a script that makes the original version run faster.
---------------------------------------------------------------------
#!/bin/sh
find / -anewer /KNOPPIX.build/mkisofs.timestamp -not \( -type d -o -path /KNOPPIX.build\* -o -path /tmp\* -o -path /proc/\* -o -path /mnt/\* \) -printf '%p %A@\n' | sort -rn +1 -t' ' | awk -F' ' '{print $1 " " ++i}' > /KNOPPIX.build/mkisofs.sort

echo "/bin/mkdir 10090" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/chown 10080" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/cp 10070" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/ln 10060" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/rm 10050" >> /KNOPPIX.build/mkisofs.sort
echo "/dev/* 20000" >> /KNOPPIX.build/mkisofs.sort
echo "/etc/* 30000" >> /KNOPPIX.build/mkisofs.sort
-----------------------------------------------------------------------

But I can't understand how it works,
What is /KNOPPIX.build/mkisofs.timestamp and /KNOPPIX.build/mkisofs.sort
Has anyone any idea how it works?

Thanks

arkaine23
06-26-2003, 09:03 PM
Its like what you can do when burning any data CD with windows burning apps- optimize the layout of the files so that they can be accessed more quickly. The ones used more often get put in the places on the cd with the fastest access time. Its also like storing data at the beginning of a HDD. The outer tracks of a disk spin at the same rate as the inner tracks, but the outer tracks are larger so more data goes by the reader in the same amount of time.

pap2003
06-27-2003, 06:49 AM
Ok, now I know how it works, but how do I use it.
Between witch steps.
is it before
mkisofs -R -U -V "KNOPPIX.net filesystem" -P "KNOPPIX www.knoppix.net" -hide-rr-moved -cache-inodes -no-bak -pad /mnt/hda1/knx/source/KNOPPIX | nice -5 /usr/bin/create_compressed_fs - 65536 > /mnt/hda1/knx/master/KNOPPIX/KNOPPIX

or after that.

I try to run it but I get mkisofs.timestamp no such file or directory.
A little how-to would be nice.
Has anyone used this script and how

Zyodin
07-05-2003, 10:25 PM
I am also having trouble getting this to work. I understand what this script is supposed to do but I do not know how to create mkisofs.timestamp and once I get that file, how do I use mkisofs.sort after running the script?

I assume that this script needs to be run prior to creating large KNOPPIX compressed file and creating the .iso, but should it be run while chrooted or not?

If there is anyone out there that uses this script on their remaster please advise.

Thanks!

techfreak
05-27-2004, 04:20 PM
Can some one write brief instructions on how to use this sort script for sorting so we can actually use it. In addition, where it syas "KNOPPIX.build" in the script, is that the location of your KNOPPIX chrooted environment ? if not than please explain what needs to be in that folder. Also looks like everything in the script points to 2 files -mkisofs.timestamp & mkisofs.sort . What or how are these files suppose to look maybe someone can give an example so we can use the speed sort script. Thank you.

techfreak
05-27-2004, 11:10 PM
All right I came across the original scripts that were used by Klaus Knopper to build the original Knoppix CD. These are from April 2003 so they are old but maybe someone can help me modify these so they suit Knoppix 3.4. Here are the scripts:



Attached.

WARNING: THESE SCRIPTS WILL DESTROY YOUR ENTIRE SYSTEM, MAKE YOUR
HARDDISK UNREADABLE, YOUR TV WILL EXPLODE, YOU WILL HAVE 7 YEARS OF BAD
LUCK, YOUR GIRLFRIEND WILL LEAVE YOU, AND THE WORLD AS WE KNOW IT
WILL COME TO A SUDDEN END. YOU HAVE BEEN WARNED. ;-)

Seriously, please don't run these scripts without reading them
carefully, understanding what they do and modifying them accordingly.

Regards
-Klaus Knopper

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.checklibs"

#!/bin/bash
# Knoppix.checklibs (C) 2003 Klaus Knopper
# Checks for missing libraries in binary files

DIRS="/bin /sbin /usr/bin /usr/sbin /usr/X11R6/bin /usr/games /usr/local/bin /usr/local/sbin /lib /usr/lib"

for d in $DIRS; do
ldd $d/* 2>&1 | while read line; do
case "$line" in
*:) CURRENT="${line%\:*}";;
*not\ found*) echo "ERROR: $CURRENT: $line";;
esac
done
done

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.clean"

#!/bin/bash
# Restore initial system state, clean all temporary files

umask 022

# echo "Updating package lists..."
# pump; sleep 2
# perl -pi -e 's/^deb/#deb/g' /etc/apt/sources.list
# apt-get update >/dev/null 2>&1
# perl -pi -e 's/^#deb/deb/g' /etc/apt/sources.list


/etc/init.d/autofs stop
[ -x /etc/init.d/knoppix-terminalserver ] && /etc/init.d/knoppix-terminalserver deconfigure

# remove only "temporary" or saved files in the given directories
nuke(){
for i in `find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 -o -name \*.0.log -o -name browse.dat -o -name \*.\*pk 2>/dev/null`; do
rm -f "$i"
done
}

# set all files in the given directories to a length of zero
zero(){
for i in `find "$@" -type f -size +0 -not -name \*.ini 2>/dev/null`; do
:> "$i"
done
}

rmdir /mnt/cdrom?* /mnt/hd?* /mnt/sd?* 2>/dev/null
rm -f /etc/ifstate /etc/X11/XF86Config /etc/X11/XF86Config-4 \
/etc/XF86Config /etc/XF86Config-4 /etc/sysconfig/* \
/etc/ssh/*key* \
/etc/samba/*.SID /var/lib/samba/* /var/cache/samba/* /etc/samba/*.tdb \
/dev/mouse* /dev/cdrom* /dev/cdwriter* \
/var/run/*/* /var/run/* /var/log/ksymoops/* /var/lock/*/* /var/lock/* \
/var/state/*/* /var/state/* /var/log/nessus/* /var/lib/nessus/* \
/halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \
/etc/resolv.conf /etc/*passwd- /etc/*shadow- /etc/*group- 2>/dev/null
mkdir -p /etc/sysconfig/network-scripts /etc/sysconfig/provider
cat >/etc/dhcpc/resolv.conf <<EOT
# insert nameservers here
# nameserver 127.0.0.1
EOT
chmod 644 /etc/dhcpc/resolv.conf
ln -s /etc/dhcpc/resolv.conf /etc/
rm -rf /tmp/* /var/tmp/* /var/backups/* /root/.??* /.??* /home/root/.??* \
/home/*/.ssh /home/*/.bash_history \
/home/knoppix/* /home/knoppix/.??* /var/lib/texmf/ls-R \
/var/spool/texmf/ls-R /var/run/screen/* /var/spool/squid/* \
/usr/share/applnk/System/Nessus.desktop
nuke /var/log /var/cache /var/spool/texmf
zero /var/local /var/log /var/spool /var/mail \
/var/lib/games /var/cache/man /var/lib/wine \
/var/lib/nfs /var/lib/xkb

for i in `find /usr/*/man -name \*.\[0-9ln\]` ; do
[ -f "$i".gz -o -f "$i".bz2 ] && rm -f "$i"
done

# delete old dowloaded packages
apt-get clean

# Strip X11 Libs
strip --strip-unneeded `find /usr/X11R6/lib/modules -name \*.so -o -name \*.o`

# Recreate empty utmp and wtmp
:>/var/run/utmp
:>/var/run/wtmp
# regenerate module dependencies and ls.so.cache
echo -n "Updating ld.so.cache..."
ldconfig
echo " Done."
echo -n "Updating modules.dep..."
depmod -a 2>/dev/null
echo " Done."
echo -n "Updating texhash..."
mktexlsr
echo " Done."
echo -n "Updating mandb..."
mandb -c
man doesnotexist >/dev/null 2>&1
echo " Done."
echo -n "Updating menus..."
/usr/sbin/mkmenusfromkde
echo " Done."
echo -n "Updating locate-database..."
updatedb --prunepaths="/KNOPPIX.build /mnt/hd /mnt/cdrom /tmp /usr/tmp /var/tmp"
update-dlocatedb
echo " Done."

echo -n "Fixing permissions in /dev/..."
chown root.root /dev/ttyp*
chmod 666 /dev/ttyp* /dev/sg* /dev/audio* /dev/dsp* /dev/mixer* /dev/sequencer*
echo " Done".

echo -n "Fixing permissions in /etc/ppp/..."
chown root.dip /etc/ppp/*secrets /etc/ppp/ppp_* /etc/ppp/peers/*provider /etc/ppp/peers /etc/ppp /etc/chatscripts /etc/chatscripts/*
chmod g+rwX /etc/ppp/*secrets /etc/ppp/ppp_* /etc/ppp/peers/*provider /etc/ppp/peers /etc/ppp /etc/chatscripts /etc/chatscripts/*
echo " Done".

echo -n "Removing unused architecture Kernel sources: "
for i in `ls -1 /usr/src/linux/arch/ | grep -v i386`; do
echo -n "$i "; rm -rf /usr/src/linux/arch/"$i" /usr/src/linux/include/asm-"$i"
done
echo " Done."

# Remove obsolete bluetooth module
rm -f /lib/modules/*/kernel/drivers/usb/bluetooth.o

echo -n "Creating auto.mnt..."
cat >/etc/auto.mnt <<EOT
# Knoppix automounter file for Directory /mnt/auto
# umask=000 only works for msdos/vfat floppies, but otherwise the floppy is read-only.
floppy -fstype=auto,user,exec,umask=000 :/dev/fd0
cdrom -fstype=auto,user,exec,ro :/dev/cdrom
# The following entries (if any) are auto-generated by knoppix-autoconfig
EOT
echo " Done".
# echo "Setting OpenOffice Link to default EN"
# rm -f /etc/alternatives/soffice.resource ; ln -sf /opt/openoffice/program/resource-en /etc/alternatives/soffice.resource
# rm -f /etc/alternatives/soffice.help ; ln -sf /opt/openoffice/help/help-en /etc/alternatives/soffice.help
echo -n "Zeoring available Package lists ..."
for i in $(find /var/lib/apt/lists -type f \( -name \*Packages -o -name \*Sources \) 2>/dev/null); do :>"$i"; done
dpkg --clear-avail
rm -f /var/cache/apt/*.bin
apt-cache gencaches
echo "Done."

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.findorphans"

#!/bin/sh
find /usr /bin /lib /etc | xargs -n 20 dpkg -S | egrep -e '(not found|nicht gefunden)'

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.mkcompressed"

#!/bin/bash

DEST="$1"

[ -z "$DEST" -o ! -d "$DEST" ] && { echo "Usage: $0 DESTINATIONDIR" >&2 ; exit 1; }
[ ! -x /usr/bin/create_compressed_fs ] && { echo "Need /usr/bin/create_compressed_fs." ; exit 1; }

# Compression blocksize (must be multiple of 512)
# All block headers must fit into a kmalloc segment (ca. 130000 bytes)
BLOCKSIZE=65536
# BLOCKSIZE=53248
# BLOCKSIZE=102400

echo -n "Update Bootfloppy file(s)? "
read answer
if [ "$answer" = "y" ]; then
cp -uv /KNOPPIX.build/Knoppix.System/bootdisk/Knoppix/boot-*.img "$DEST"/KNOPPIX/
( cd "$DEST"/KNOPPIX && ln -f -v boot-de.img boot.img ) || exit 1
fi

[ ! -f "$DEST"/KNOPPIX/boot.img ] && { echo "Missing required file $DEST/KNOPPIX/boot.img" >&2 ; exit 1; }

echo -n "Recreate KNOPPIX compressed FS? "
read answer
if [ "$answer" = "y" ]
then
rm -f "$DEST"/KNOPPIX/KNOPPIX

# Remove files that need to be autogenerated from source dir!
echo -n "Sweep/Clean system before remastering? "
read answer
[ "$answer" = "y" ] && { . /KNOPPIX.build/Knoppix.postupgrade; . /KNOPPIX.build/Knoppix.clean; }

cat >/etc/network/interfaces <<EOT
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback

EOT

cat >/etc/dhcpc/resolv.conf <<EOT
# Insert nameservers here
# nameserver 127.0.0.1
EOT

# Mount root read-only, so no files change while generating image
mount -o ro,remount / || { echo "Error: Cannot mount / read-only" >&2 ; exit 0; }

# Hide unwanted LOCALEs.
HIDELOCALE=""
HIDEMAN=""
MYLOCALE=$(awk -F'[="_]' '/^(LANG|LANGUAGE)=/{if(!/[$]/){x=x" "$3}}END{print x}' /etc/init.d/knoppix-autoconfig)
MYLOCALE="$MYLOCALE C en ja be da dk zh"
LOCALEDIR=/usr/share/locale
MANPAGEDIR=/usr/share/man
for LOCALE in `/bin/ls -1 $LOCALEDIR`; do
[ -d "$LOCALEDIR/$LOCALE/LC_MESSAGES" ] || continue
FOUND=""
for l in $MYLOCALE; do
case "$LOCALE" in $l*) FOUND="yes" ;; esac
done
if [ -z "$FOUND" ]; then
HIDELOCALE="$HIDELOCALE -m $LOCALEDIR/$LOCALE"
[ -d "$MANPAGEDIR/$LOCALE" ] && HIDELOCALE="$HIDELOCALE -m $MANPAGEDIR/$LOCALE"
fi
done

# -U implies: -d, -l, -L, -N, -relaxed-filenames, -allow-lowercase,
# -allow-multidot and -no-iso-translate
# -iso-level 3 -U -cache-inodes -no-bak -pad \
# -hide-rr-moved \
# -m /var/lib/dpkg/available\* \
SORT=""
[ -e /KNOPPIX.build/mkisofs.sort ] && SORT="-sort /KNOPPIX.build/mkisofs.sort"
# mkisofs -pad -R -l -v $SORT \
mkisofs -R -U -v $SORT \
-no-split-symlink-components -no-split-symlink-fields \
-V "KNOPPIX_FS" \
-P "KNOPPER.NET" \
-p "www.knopper.net" \
-hide-rr-moved -cache-inodes -no-bak -pad \
-m /proc/\* -m /tmp/\* -m /var/tmp/\* -m /home/\* -m /initrd/\* \
-m /KNOPPIX.build -m /mnt/\*/\* -m \*.dpkg-\* \
-m /mnt/hd/\* -m /mnt/hd\* -m /mnt/cdrom\* -m /etc/fstab\* \
-m /etc/exports -m /etc/dhcpc/dhcpcd\* \
-m /var/spool/mail/\* -m /var/spool/mqueue/\* \
-m /etc/driveprm -m .ssh -m .bash_history \
-m /etc/printcap\* -m /var/spool/cups/tmp/\* \
-m /etc/cups/certs/\* -m /etc/cups/\*.O -m /etc/cups/ppd/\* \
-m /etc/gpm.conf -m /etc/isapnp.\* -m /etc/minirc.dfl \
-m /var/cache/debconf/\*-old -m /var/lib/\*/\*- \
-m /var/lib/\*/\*old -m /var/log/XFree86.\* \
-m /var/samba/\*.pid -m /var/lib/samba/\* -m /var/cache/samba/\* \
-m /var/mail/\* -m /var/apt/cache/archives/lock \
-m /var/log/ksymoops\* -m /var/spool/exim/db/\* -m /etc/\*.old \
-m /etc/\*.save -m /etc/ssl/certs/\* -m \*.preserved \
-m .viminfo -m .\*.swp -m lost+found \
-m /.\?\?\* -m /root/.\?\?\* -m /etc/.\?\?\* \
-m /boot/map -m /boot/boot.0\* \
-m /usr/src/kernel\*.deb -m /usr/src/kernel\*.dsc -m /usr/src/kernel\*.changes -m /usr/src/kernel\*.tar.gz \
-m /usr/src/modules/pcmcia\* \
-m /usr/src/linux\*/arch \
-m /usr/src/linux\*/drivers \
-m /usr/src/linux\*/fs \
-m /usr/src/linux\*/init \
-m /usr/src/linux\*/mm \
-m /usr/src/linux\*/net \
-m /usr/src/linux\*/vmlinu\* \
-m /usr/src/linux\*/System.map \
-m /usr/src/linux\*/ipc \
-m /usr/src/linux\*/stamp-\* \
-m /usr/src/linux\*/C\* \
-m /usr/src/linux\*/M\* \
-m /usr/src/linux\*/R\* \
-m /usr/src/linux\*/debian \
-m /usr/src/linux\*/kernel \
-m /usr/src/linux\*/kdb \
-m /usr/src/linux\*/lib \
-m /usr/src/linux\*/scripts \
-m /usr/src/linux\*/conf.vars \
-m /usr/src/linux\*/.*depend \
-m /usr/src/linux\*/.*old \
$HIDELOCALE / \
| /usr/bin/create_compressed_fs - $BLOCKSIZE >"$DEST"/KNOPPIX/KNOPPIX || exit 1
# -o "$DEST"-tmp.iso / && \
# /usr/bin/compressloop -v -v -c 9 -b $BLOCKSIZE "$DEST"-tmp.iso "$DEST"/KNOPPIX/KNOPPIX && rm -f "$DEST"-tmp.iso || exit 1
mount -o rw,remount /
chmod 444 "$DEST"/KNOPPIX/KNOPPIX
# swapoff /dev/hdc2 2>/dev/null
fi

mkfinal(){
TARGET="$1.iso"
# Alternate boot record
# -eltorito-alt-boot \
# -b KNOPPIX/boot-en.img -c KNOPPIX/boot.cat \
mkisofs -pad -l -r -J -v \
-sort /tmp/knoppix.sort \
-V 'KNOPPIX' -A 'KNOPPIX LIVE LINUX CD' \
-P "KNOPPER.NET" \
-p "www.knopper.net" \
-b KNOPPIX/boot.img -c KNOPPIX/boot.cat \
-m "$DEST"/KNOPPIX/boot-\*.img \
-hide-rr-moved \
-o "$TARGET" "$DEST"
}

echo -n "Recreate KNOPPIX-DE isofile '$DEST.iso'? "
read answer
if [ "$answer" = "y" ]; then
# Make sure that the boot floppy file AND the boot catalog are at the beginning of the image.
# Some controllers seem to depend on this.
rm -f /tmp/knoppix.sort
echo "$DEST/KNOPPIX/boot.cat 100003" >/tmp/knoppix.sort
echo "$DEST/KNOPPIX/boot.img 100002" >>/tmp/knoppix.sort
echo "$DEST/KNOPPIX/KNOPPIX 100001" >>/tmp/knoppix.sort
echo "$DEST/Demos/Audio/*.mp3 -100000" >>/tmp/knoppix.sort
echo "$DEST/Demos/Audio/*.ogg -100000" >>/tmp/knoppix.sort
# Make final CD Image
mkfinal "$DEST"

echo -n "Recreate KNOPPIX-EN isofile '$DEST-EN.iso'? "
read answer
if [ "$answer" = "y" ]; then
( cd "$DEST"/KNOPPIX && ln -f -v boot-en.img boot.img ) || exit 1
mkfinal "$DEST-EN"
( cd "$DEST"/KNOPPIX && ln -f -v boot-de.img boot.img ) || exit 1
fi
rm -f /tmp/knoppix.sort
fi

echo -n "BURN german CD version? "
read answer
if [ "$answer" = "y" ]; then
cdrecord -v -dao -pad -eject driveropts=burnfree dev=0,1,0 speed=12 fs=24M "$DEST.iso"
fi

# Clean up
find /var/lib/apt/lists/ -type f -exec rm -f {} \;

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.mksortlist"

#!/bin/sh
find / -anewer /KNOPPIX.build/mkisofs.timestamp -not \( -type d -o -path /KNOPPIX.build\* -o -path /tmp\* -o -path /proc/\* -o -path /mnt/\* \) -printf '%p %A@\n' | sort -rn +1 -t' ' | awk -F' ' '{print $1 " " ++i}' > /KNOPPIX.build/mkisofs.sort

echo "/bin/mkdir 10090" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/chown 10080" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/cp 10070" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/ln 10060" >> /KNOPPIX.build/mkisofs.sort
echo "/bin/rm 10050" >> /KNOPPIX.build/mkisofs.sort
echo "/dev/* 20000" >> /KNOPPIX.build/mkisofs.sort
echo "/etc/* 30000" >> /KNOPPIX.build/mkisofs.sort

--PuGuTyElPB9bOcsM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Knoppix.postupgrade"

#!/bin/sh
# Remove unwanted init scripts and KDE-autostart files

STOP=""
for i in `ls -d1 /etc/rc?.d/* | egrep -v -e '(README|knoppix|xsession)'`; do
BASE=`basename $i`
BASE=${BASE##[KS]??}
case "$STOP" in *${BASE}*) ;; *) STOP="$STOP $BASE"; ;; esac
rm -vf $i
done

for i in $STOP; do
/etc/init.d/$i stop
done


for i in `ls -d1 /usr/share/autostart/* | egrep -v -e '(panel|kdesktop|khotkeys)\.desktop'`; do
rm -vf $i
done

chmod u+s /usr/bin/cdrecord /usr/bin/cdrdao
# /usr/bin/cdparanoia

# Some GTK programs HAVE to run as root. :-/

for i in `egrep -q -l -r -e '(xcdroast|ethereal)' /usr/share/applnk/.`; do
perl -pi -e 's|Exec=/|Exec=sudo /|g' "$i"
done

# Replace kdesu (needs password) by sudo (doesn't)
for i in `grep -q -l -r 'Exec=.*kdesu' /usr/share/applnk/.`; do
perl -pi -e 's|Exec=.*kdesu |Exec=sudo -H |g' "$i"
done

# Remove -ncp in xboard startup file
for i in `grep -q -l -r 'Exec=.*xboard.*-ncp' /usr/share/applnk/.`; do
perl -pi -e 's| -ncp||g' "$i"
done

# Almost everything is wrong in this menu file
rm -f /usr/lib/menu/evolution1.3

# Change Debians OpenOffice settings to default font Helmet
#for i in `find /usr/lib/openoffice -name Writer.xml`; do
# for j in Standard Heading List Caption Index; do
# perl -pi -e 's|<'"$j"' cfg:type="string" xsi:null="true"/>|<'"$j"' cfg:type="string">Helmet</'"$j"'>|g' $i
# done
#done

for i in "alias net-pf-17 af_packet" "alias ide_cs ide-cs" "alias usbcore off" "alias autofs autofs4"; do
grep -q "$i" /etc/modutils/aliases || { echo "$i" >> /etc/modutils/aliases; update-modules; }
done

# Make acrobat the default PDF viewer, if present.
for i in `find /usr/share/applnk -iname Acrobat_Reader.desktop`; do
egrep 'MimeType=application/pdf' "$i" >/dev/null ||
echo "InitialPreference=4
MimeType=application/pdf;Application" >> "$i"
done

# Change desktop icon for Mozilla
for i in /usr/share/applnk/*/*/Mozilla_Browser.desktop; do
perl -pi -e 's|Icon=.*$|Icon=mozilla|g' "$i"
done

#for i in "vendor 0x055d product 0x9001 module pwc"; do
#grep -q "$i" /etc/usbmgr/usbmgr.conf || echo "$i" >> /etc/usbmgr/usbmgr.conf
#done

# Euro font stuff
perl -pi -e 's/iso8859-1( |$)/iso8859-15$1/g' /etc/X11/fonts/misc/xfonts-base.alias && update-fonts-alias /usr/lib/X11/fonts/misc

--PuGuTyElPB9bOcsM--

mzilikazi
05-28-2004, 12:09 AM
Can some one write brief instructions on how to use this sort script for sorting so we can actually use it. In addition, where it syas "KNOPPIX.build" in the script, is that the location of your KNOPPIX chrooted environment ?.

Well no it isn't since they do not use chroot to remaster! You must actually boot into your remastering environment. ;) Now I have not yet figured out the sorting scripts either and I also know that it is possible to use only one partition for remastering but I use 2. I am fully aware that there is still much room for improvement in this method. Also notice that I use Kanotix so adjust accordingly for Knoppix.

This is very easy to do and here's how I do it. (Thought about adding this to the wiki but the docs there get hosed up really quickly!!) Anyway........

#Substitue your own drives for /hda11 & /hda12 throughout.
#/hda11 will be the SOURCE direcotory- the directory we install Kanotix to.
#/hda11 is: 1 partition of 3G (or more if you want to make a dvd)
#/hda12 will be the BUILD directory containing the compressed KNOPPIX fs,
# boot.img & final image (kanotix.iso).
#/hda12 is: 1 partition of 1G (more if you're making a dvd).
_______________________________
#BOOT & INSTALL KANOTIX
sudo kanotix-installer
use /dev/hda11 for /
Select 'knoppix' type install!
edit .knofig to install grub to partition
(of course you can install to mbr if you don't wish to boot another OS)
______________________________
#SET UP BUILD DIRECTORY

mount /dev/hda12 /mnt/hda12
mkdir /mnt/hda12/KNOPPIX
cp /cdrom/KNOPPIX/boot.img /mnt/hda12/KNOPPIX

_______________________________
#EDIT YOUR BOOT LOADER
#EXAMPLE: /boot/grub/menu.lst entry

title remaster
root (hd0,10)
kernel /boot/vmlinuz root=/dev/hda11 ro ramdisk_size=100000 init=/etc/init lang=us apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi nomce quiet alsa mem=1015728K vga=791
savedefault
boot
__________________________________________________ _______________
#AND NOW THE MOMENT YOU'VE BEEN WAITING FOR.....
REBOOT INTO YOUR REMASTERING ENVIRONMENT>>>
Be sure to use:
desktop=twm
IF you intend on removing KDE and/or IceWM
or boot into run level 2
___________________________
DO KANOTIX YOUR WAY
su
install-keymap us
tar -czf skel.tar.gz skel
(save it somewhere else if you think you might need it)
rm -rf /etc/skel

______________________
#APT-GET INSTALL
apt-get install synaptic blah blah blah
________________________
TWEAK THE DESKTOP
#Your configurations are saved in /home/knoppix
#which eventually becomes /etc/skel
#When you are COMPLETELY FINISHED tweaking the desktop
su
mv /home/knoppix /etc/skel
touch /home/knoppix
chown knoppix:knoppix /home/knoppix
chown -R root:root /etc/skel
updatedb
ldconfig
update-modules
_____________________________________
REBOOT INTO YOUR PRIMARY OS
su
mount /dev/hda11 /source
chroot /source

Now you need to clean up. I have a customized version of a script I found somewhere (sorry I forget where) it's at the bottom (maybe by charan??)
ctrl+d (to leave chroot)
__________________________________________________ __________________________________________________ ______________________________________________
#MAKE THE COMPRESSED KNOPPIX FILE SYSTEM
cd /source
/source# mkisofs -RUV "KNOPPIX.net filesystem" -P "mzilikazix.org" -cache-inodes -no-bak -pad /hda11 | nice -5 create_compressed_fs - 65536 > /build/KNOPPIX/KNOPPIX
__________________________________________________ __________________________________________________ __________________________________________________ _________________________________
#SORT THE FILES

ls -U /build/KNOPPIX
boot.img KNOPPIX
cd /build
__________________________________________________ __________________________________________________ ________________
#MAKE THE ISO IMAGE

/build# mkisofs -l -r -J -V "KanotiXFCE4" -b KNOPPIX/boot.img -c KNOPPIX/boot.cat -o kanotixfce4.iso /build

Of course you must make adjustments for Knoppix!! Here's the script:


#!/bin/sh
umask 022

/etc/init.d/autofs stop

# remove only "temporary" or saved files in the given directories
nuke(){
for i in `find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 2>/dev/null`; do
rm -f "$i"
done
}

# set all files in the given directories to a length of zero
zero(){
for i in `find "$@" -type f -size +0 -not -name \*.ini 2>/dev/null`; do
:> "$i"
done
}

rmdir /mnt/cdrom?* /mnt/hd?* 2>/dev/null
rm -f /etc/X11/XF86Config /etc/X11/XF86Config-4 \
/etc/XF86Config /etc/XF86Config-4 /etc/sysconfig/* \
/etc/ssh/*key* \
#added by mzilikazi@mzilikazix.org
/home/knoppix/*
/etc/samba/*.SID /etc/samba/*.tdb \
/dev/mouse* /dev/cdrom* /dev/cdwriter* \
/var/run/*/* /var/run/* /var/log/ksymoops/* /var/lock/*/* /var/lock/* \
/var/state/*/* /var/state/* /var/log/nessus/* /var/lib/nessus/* \
/halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \
/etc/resolv.conf /etc/*passwd- /etc/*shadow- /etc/*group- 2>/dev/null
mkdir -p /etc/sysconfig/network-scripts /etc/sysconfig/provider
cat >/etc/dhcpc/resolv.conf <<EOT
# insert nameservers here
# nameserver 127.0.0.1
EOT
chmod 644 /etc/dhcpc/resolv.conf
ln -s /etc/dhcpc/resolv.conf /etc/
rm -rf /tmp/* /var/tmp/* /var/backups/* /.ssh /root/.ssh /home/*/.ssh \
/root/.bash_history /home/*/.bash_history \
/home/knoppix/* /home/knoppix/.??* /var/lib/texmf/ls-R \
/var/spool/texmf/ls-R
nuke /var/log /var/cache
zero /var/local /var/log /var/spool \
/var/lib/games /var/cache/man /var/lib/wine \
/var/lib/nfs /var/lib/xkb

for i in `find /usr/*/man -name \*.\[0-9ln\]` ; do
[ -f "$i".gz -o -f "$i".bz2 ] && rm -f "$i"
done

#added by mzilikazi@mzilikazix.org
# delete dowloaded debian packages
echo -n "Removing .debs..."
apt-get clean
echo " Done."

# Recreate /etc/resolv.conf
echo -n "Recreating /etc/resolv.conf..."
cat >/etc/resolv.conf <<EOT
# insert nameservers here
# nameserver 127.0.0.1
EOT
chmod 644 /etc/resolv.conf
echo " Done."

# Recreate empty utmp and wtmp
:>/var/run/utmp
:>/var/run/wtmp
# regenerate module dependencies and ls.so.cache
echo -n "Updating ld.so.cache..."
ldconfig
echo " Done."
echo -n "Updating modules.dep..."
depmod -a 2>/dev/null
echo " Done."
echo -n "Updating texhash..."
mktexlsr
echo " Done."
echo -n "Updating mandb..."
mandb -c
man doesnotexist >/dev/null 2>&1
echo " Done."
echo -n "Updating menus..."
/usr/sbin/mkmenusfromkde
#added by mzilikazi@mzilikazix.org
echo -n "Updating Debian menus"
update-menus -v
echo " Done."
echo -n "Updating locate-database..."
updatedb --prunepaths="/KNOPPIX.build /mnt/hd /mnt/cdrom /tmp /usr/tmp /var/tmp"
echo " Done."

echo -n "Fixing permissions in /dev/..."
chown root.root /dev/ttyp*
chmod 666 /dev/ttyp* /dev/sg*
echo " Done".
#added by mzilikazi@mzilikazix.org
#only enable this if you really know what you;re doing!!
#echo -n "Cleaning up orphans..."
#deborphan | xargs apt-get -y remove
#echo " Done".

echo -n "Cleaning up config files..."
COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs dpkg -P
echo " Done".

echo -n "Removing unused architecture Kernel sources: "
for i in `ls -1 /usr/src/linux/arch/ | grep -v i386`; do
echo -n "$i "; rm -rf /usr/src/linux/arch/"$i" /usr/src/linux/include/asm-"$i"
done

So hopefully this thread is the start of a very complete and very easy remastering howto. The chroot method is ok if you just want to make some small changes but if you're not running the same kernel you have problems plus other unnecessary issues to deal with.

Of course you can just boot Knoppix, cd KNOPPIX and do cp -a * /mnt/point and then boot into it as well.

mzilikazi
05-28-2004, 04:59 AM
Seems we just feed it to mkisofs as Fabianx once told me. :)
man mkisofs

-sort sort file
Sort file locations on the media. Sorting is controlled by a
file that contains pairs of filenames and sorting offset weight-
ing. If the weighting is higher, the file will be located
closer to the beginning of the media, if the weighting is lower,
the file will be located closer to the end of the media. There
must be only one space or tabs character between the filename
and the weight and the weight must be the last characters on a
line. The filename is taken to include all the characters up to,
but not including the last space or tab character on a line.
This is to allow for space characters to be in, or at the end of
a filename. This option does not sort the order of the file
names that appear in the ISO9660 directory. It sorts the order
in which the file data is written to the CD image - which may be
useful in order to optimize the data layout on a CD. See
README.sort for more details.


The other scripts tidy everything up quite nicely. Simple! :)

probono
05-28-2004, 06:42 AM
It would be nice if you could add step-by-step instructions to the remastering howto on this website once you have it running.

Ghandalfar
05-28-2004, 11:14 AM
you could run your remaster inside user-mode-linux so you wouldn't have to boot. I have yet to find time to write script that would do that.