Results 1 to 4 of 4

Thread: request: HOWTO remaster from HD-install

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jun 2003
    Posts
    9

    request: HOWTO remaster from HD-install

    I have made a HD-install from knoppix, and adjusted it to my needs. I have added some packages, and removed a lot of packages. Change the default theme and icon set.
    Now i want to write this configuration to a bootable CD-rom.
    I have found verry little information about this.

    There are some scripts that Klaus Knopper gave to the public, but i have no idea on how to use those.

    Are there any document describing the step to take to make a booteble cd from a customized HD-install???

    Thanks,

    spoetnik

  2. #2
    Junior Member
    Join Date
    Jun 2003
    Posts
    9
    I ran this script, but it killed my installation (glad i had a backup of the system)
    could someone shine a light please??
    Code:
    #!/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 -o -name \*.0.log -o -name browse.dat 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* \
          /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/* /.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 /var/run/screen/*
    nuke /var/log /var/cache
    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
    
    # 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"
    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 "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."
    
    echo -n "Creating auto.mnt..."
    cat >/etc/auto.mnt <<EOT
    # Knoppix automounter file for Directory /mnt/auto
    floppy	-fstype=auto,user,exec	:/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
    
    #!/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
    
    for i in "alias net-pf-17 af_packet" "alias ide_cs ide-cs" "alias usbcore off" "alias autofs4 autofs"; do
    grep -q "$i" /etc/modutils/aliases || { echo "$i" >> /etc/modutils/aliases; update-modules; }
    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
    
    #!/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 uk fi ja be"
    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 \
    	-V "KNOPPIX ISO9660 Filesystem" \
    	-P "Knopper.Net http://www.knopper.net/" \
    	-p "Klaus Knopper <[email protected]>" \
    	-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/sysconfig/\* -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/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\*/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\*/kernel \
    	-m /usr/src/linux\*/lib \
    	-m /usr/src/linux\*/Rules.make \
    	-m /usr/src/linux\*/scripts \
    	$HIDELOCALE \
    	/ \
    	| nice -5 /usr/bin/create_compressed_fs - $BLOCKSIZE \
    	>"$DEST"/KNOPPIX/KNOPPIX || 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 CD-ROM' \
            -P "KNOPPER.NET http://www.knopper.net/" \
            -p "KNOPPIX CD-ROM Taskforce <[email protected]>" \
            -b KNOPPIX/boot.img -c KNOPPIX/boot.cat \
            -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 is at the beginning of the image.
    # Some controllers seem to depend on this.
    rm -f /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 -pad -eject dev=0,1,0 speed=16 fs=24M "$DEST.iso"
    fi

  3. #3
    Senior Member registered user
    Join Date
    Nov 2002
    Posts
    100

    Killed your system...

    hehe...that reminds me of the time I ran the "knoppix.clean" script out of chroot and wipped out my real /proc...had to reinstall.

    Not long ago I was running slackware and gentoo in chroot from debian and had mount --bind my real /etc to one of them.I forgot about doing that and and went to delete one of the copies with the good old rm -fr dirname and it deleted my real /etc all the way down to the only file that was in use "mtab"...guess what my system said to me when I tried to issue a command after that??

    "You do not exsist.Go away!"

    Some scripts are best run only in chroot.

    You may be able to make a remaster from that hd install but it's a whole lot easier to just install knoppix to hd and make a directory to build in...extract the KNOPPIX file there then chroot and get busy.My newest info is here - http://home.bellsouth.net/p/s/commun...geid=91614&ck=

    Have fun,

    ken

  4. #4
    Senior Member registered user
    Join Date
    Feb 2003
    Location
    Nova Scotia, Canada
    Posts
    2,479

    Re: Killed your system...

    Quote Originally Posted by Tech2k
    "You do not exsist.Go away!"
    Ah that brings back fond memories of a badly issued sed command I did a couple of weeks ago.

Similar Threads

  1. HOWTO: Remaster the easy way using menu based scripts
    By UnderScore in forum Customising & Remastering
    Replies: 102
    Last Post: 10-19-2007, 02:04 PM
  2. "Remaster From Hd Install HowTo" - Don't waste you
    By roguesupport in forum Customising & Remastering
    Replies: 8
    Last Post: 04-13-2005, 06:38 PM
  3. Howto install
    By sivaraj in forum Hdd Install / Debian / Apt
    Replies: 1
    Last Post: 05-13-2004, 06:15 PM
  4. Howto install flonix
    By edgarin_g in forum Hdd Install / Debian / Apt
    Replies: 3
    Last Post: 01-08-2004, 02:14 PM
  5. Replies: 6
    Last Post: 05-30-2003, 06:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


TP-Link TL-SG105 5-Port Gigabit Ethernet Unmanaged Metal Desktop Network Switch picture

TP-Link TL-SG105 5-Port Gigabit Ethernet Unmanaged Metal Desktop Network Switch

$19.99



TP-Link TL-SG1048 48-Port Gigabit Rackmount Switch New Factory Sealed picture

TP-Link TL-SG1048 48-Port Gigabit Rackmount Switch New Factory Sealed

$199.99



Cisco WS-C3650-12X48UR-L 48-Port Stackable Layer 3 8x10G SFP+ Port Switch picture

Cisco WS-C3650-12X48UR-L 48-Port Stackable Layer 3 8x10G SFP+ Port Switch

$129.99



NETGEAR GS308EP Essential Series 8-Port Gigabit PoE+ Unmanaged Switch picture

NETGEAR GS308EP Essential Series 8-Port Gigabit PoE+ Unmanaged Switch

$49.99



5 Port Gigabit Unmanaged Ethernet Switch, Home Network Hub, Office Ethernet S... picture

5 Port Gigabit Unmanaged Ethernet Switch, Home Network Hub, Office Ethernet S...

$9.64



TP-Link TL-SG105, 5 Port Gigabit Unmanaged Ethernet Switch, Network Hub, Ethern picture

TP-Link TL-SG105, 5 Port Gigabit Unmanaged Ethernet Switch, Network Hub, Ethern

$15.25



10-Port Gigabit PoE Network Switch with 8 PoE+ Ports with 2 Combo SFP Slots 125W picture

10-Port Gigabit PoE Network Switch with 8 PoE+ Ports with 2 Combo SFP Slots 125W

$39.99



NETGEAR 5-Port Gigabit Ethernet Unmanaged Switch (Gs305) - Desktop Quiet Fanless picture

NETGEAR 5-Port Gigabit Ethernet Unmanaged Switch (Gs305) - Desktop Quiet Fanless

$16.41



D-Link DGS-1210-28P 28-Port PoE Gigabit Web Smart Switch With Cord picture

D-Link DGS-1210-28P 28-Port PoE Gigabit Web Smart Switch With Cord

$49.99



5Ports Gigabit Network Switch w/ 4 PoE+ Ports Total 52W each port 30W Plug&Play picture

5Ports Gigabit Network Switch w/ 4 PoE+ Ports Total 52W each port 30W Plug&Play

$31.99