Difference between revisions of "Debootstrap to LiveCD"


From Knoppix Documentation Wiki
Jump to: navigation, search
(CONVENTIONS USED)
(Setup The Environment)
Line 22: Line 22:
 
  #!/bin/bash
 
  #!/bin/bash
 
*Script Variables:
 
*Script Variables:
  SOURCEDIR=`pwd`/source/KNOPPIX
+
  SOURCEDIR=[` http://tldp.org/LDP/abs/html/commandsub.html#BACKQUOTESREF]pwd[http://tldp.org/LDP/abs/html/commandsub.html#BACKQUOTESREF `]/source/KNOPPIX
 
  MASTERDIR=`pwd`/master
 
  MASTERDIR=`pwd`/master
 
  ARCH=i386  
 
  ARCH=i386  

Revision as of 00:29, 26 January 2007

PREAMBLE

  • Debian Releases:
    • sarge = stable realease
    • etch = testing release
    • sid = unstable release

CONVENTIONS USED

The following conventions are used, within dotted box:

Commands & paramaters
Text can be directly input into a script.

Some commands are linked, if you require further explanation click the link :)

apt-get

SCRIPT

Setup The Environment

  • As required at the beginning of a script (UNIX), a Hash Bang
#!/bin/bash
  • Script Variables:
SOURCEDIR=[` http://tldp.org/LDP/abs/html/commandsub.html#BACKQUOTESREF]pwd`/source/KNOPPIX
MASTERDIR=`pwd`/master
ARCH=i386 
DEBIAN_RELEASE=sid
DEBIAN_MIRROR=http://http.us.debian.org/debian
  • Another Variable, specific Knoppix packages & Kernel modules:
KNOPPIX_PACKAGES="\
  ash-knoppix-26 \
  hwsetup \
  hwdata-knoppix \
  cloop-module \
  linux-image-2.6.17 \
  loop-aes-module-2.6.17 \
  madwifi-modules-2.6.17 \
  ndiswrapper-modules-2.6.17 \
  ndiswrapper-utils \
  rt2x00-modules-2.6.17 \
  unionfs-knoppix-modules-2.6.17 \
  zr364xx-modules-2.6.17 \
  zydas-modules-2.6.17 \
  linux-image-2.6.17 \
  linux-kernel-headers-knoppix \
  knoppix-udev-config \
  knoppix-initscripts \
  knoppix-remountrw \
  knoppix-setrootpassword \
  linux-kernel-headers-knoppix \
  startsyslog-knoppix \
  scanpartitions-knoppix \
  rebuildfstab-knoppix \
  network-setup-knoppix \
  usleep-knoppix \
  netcardconfig-knoppix \
  kudzu-knoppix-dev \
  automount-knoppix"

mkdir -p ${SOURCEDIR}
mkdir -p ${SOURCEDIR}/knxfiles

debootstrap --arch ${ARCH} ${DEBIAN_RELEASE} ${SOURCEDIR} ${DEBIAN_MIRROR}
cd /KNOPPIX/usr/src/ &&
cp -Rp \
  Makefile \
  kernel.conf \
  knoppix-kernel.README \
  knoppix-kernel.patch \
  linux \
  linux-2.6.17 \
  ${SOURCEDIR}/usr/src/.

cd ${SOURCEDIR}/knxfiles &&
for PACKAGE in ${KNOPPIX_PACKAGES};
{
  dpkg-repack ${PACKAGE}
};

chroot ${SOURCEDIR} \
  /usr/bin/env -i \
  HOME=/root \
  TERM=$TERM \
  PS1='\u:\w\$ ' \
  PATH=/bin:/usr/bin:/sbin:/usr/sbin \
  /bin/bash --login

Within chroot

  • Install Dependencies required for Knoppix
apt-get install \
  gawk \
  perl \
  libdb4.4 \
  perl-modules \
  console-tools \
  console-data \
  console-common \
  pciutils \
  libpci2 \
  udev \
  libvolume-id0 \
  pump \
  dhcp3-common \
  linux-sound-base \
  ndiswrapper-utils \
  ndiswrapper-common \
  ndiswrapper-utils-1.1 \
  binutils \
  debhelper \
  dpkg-dev \
  file \
  gettext \
  html2text \
  intltool-debian \
  libmagic1 \
  make \
  patch \
  po-debconf

useradd -m knoppix
echo 'deb-src http://debian-knoppix.alioth.debian.org ./' >> /etc/apt/sources.list
echo 'deb http://debian-knoppix.alioth.debian.org ./' >> /etc/apt/sources.list

apt-get update
cd /knxfiles &&
  dpkg -i * &&
  cd / && rm -rf /knxfiles
apt-get clean

exit

Exit Chroot & Finalize

Prep startup rc startup scripts, inittab

cd ${SOURCEDIR}/etc &&
  rm -rf rc* &&
  cd /KNOPPIX/etc && 
  cp -ax inittab rc* ${SOURCEDIR}/etc/.
umount ${SOURCEDIR}/proc

Build The CD

  • Make the compressed KNOPPIX CLOOP file
mkisofs \
-R \
-U \
-V "Knoppix" \
-publisher "rjenniss" \
-hide-rr-moved \
-cache-inodes \
-no-bak \
-pad ${SOURCEDIR} | \
nice -5 /usr/bin/create_compressed_fs - 65536 >  ${MASTERDIR}/KNOPPIX/KNOPPIX
  • Create the knoppix.iso file
mkdir -p ${MASTERDIR}/KNOPPIX
cd /cdrom && find . -size -10000k -type f -exec cp -p --parents '{}' ${MASTERDIR} \;
mkisofs \
-pad \
-l \
-r \ 
-J \ 
-v \ 
-V "KNOPPIX" \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \ 
-b boot/isolinux/isolinux.bin \
-c boot/isolinux/boot.cat \
-hide-rr-moved \ 
-o knoppix.iso ${MASTERDIR}

SPECIAL THANKS & SUPPORT

  • If this was of help, feel free to post a message
  • Support
  • How do I find what files belong to what packages? answer