From: Kern Sibbald Date: Wed, 5 Apr 2006 07:51:24 +0000 (+0000) Subject: Add new knoppix directory X-Git-Tag: Release-2.0.0~978 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8c76fd690aabcb43033574d22963d24b875b9d8f;p=bacula%2Frescue Add new knoppix directory --- diff --git a/rescue/autoconf/configure.in b/rescue/autoconf/configure.in index 41e9e20..8045980 100644 --- a/rescue/autoconf/configure.in +++ b/rescue/autoconf/configure.in @@ -274,6 +274,8 @@ AC_OUTPUT([ \ linux/cdrom/Makefile \ linux/cdrom/bacula/Makefile \ linux/cdrom/cdtree/boot/isolinux/boot.msg \ + knoppix/cdrom/Makefile \ + knoppix/cdrom/bacula/Makefile \ freebsd/Makefile \ solaris/Makefile \ $PFILES ], diff --git a/rescue/configure b/rescue/configure index 7f7c85f..8e2da6b 100755 --- a/rescue/configure +++ b/rescue/configure @@ -2457,7 +2457,7 @@ MCOMMON=./autoconf/Make.common - ac_config_files="$ac_config_files autoconf/Make.common Makefile linux/Makefile linux/cdrom/Makefile linux/cdrom/bacula/Makefile linux/cdrom/cdtree/boot/isolinux/boot.msg freebsd/Makefile solaris/Makefile $PFILES" + ac_config_files="$ac_config_files autoconf/Make.common Makefile linux/Makefile linux/cdrom/Makefile linux/cdrom/bacula/Makefile linux/cdrom/cdtree/boot/isolinux/boot.msg knoppix/cdrom/Makefile knoppix/cdrom/bacula/Makefile freebsd/Makefile solaris/Makefile $PFILES" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -3019,6 +3019,8 @@ do "linux/cdrom/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/cdrom/Makefile" ;; "linux/cdrom/bacula/Makefile" ) CONFIG_FILES="$CONFIG_FILES linux/cdrom/bacula/Makefile" ;; "linux/cdrom/cdtree/boot/isolinux/boot.msg" ) CONFIG_FILES="$CONFIG_FILES linux/cdrom/cdtree/boot/isolinux/boot.msg" ;; + "knoppix/cdrom/Makefile" ) CONFIG_FILES="$CONFIG_FILES knoppix/cdrom/Makefile" ;; + "knoppix/cdrom/bacula/Makefile" ) CONFIG_FILES="$CONFIG_FILES knoppix/cdrom/bacula/Makefile" ;; "freebsd/Makefile" ) CONFIG_FILES="$CONFIG_FILES freebsd/Makefile" ;; "solaris/Makefile" ) CONFIG_FILES="$CONFIG_FILES solaris/Makefile" ;; "$PFILES" ) CONFIG_FILES="$CONFIG_FILES $PFILES" ;; diff --git a/rescue/knoppix/cdrom/.cvsignore b/rescue/knoppix/cdrom/.cvsignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/rescue/knoppix/cdrom/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/rescue/knoppix/cdrom/Makefile.in b/rescue/knoppix/cdrom/Makefile.in new file mode 100644 index 0000000..972dacc --- /dev/null +++ b/rescue/knoppix/cdrom/Makefile.in @@ -0,0 +1,79 @@ +# +# Makefile for building a Bacula Rescue CDROM or remastering +# a CDROM or ISO image adding the Bacula files. +# + +.PATH: . + + +first_rule: all +dummy: + +#------------------------------------------------------------------------- + +# Make an iso boot image +iso: + ./build-iso + +cdimage: + makecdimage --type=@type@ --where=@where@ + +# try booting it with qemu emulator +boot: + qemu -cdrom bacula-knoppix.iso + +initrd: + ./makeinitrd + +kernel: + ./makekernel @KERNEL@ + +binaries: + ./makebinaries + +static-bacula: dummy + @(cd bacula; make copy-static-fd) + +bacula: dummy + @(cd bacula; make) + +copy-bacula: + cp -a bacula/ cdimage/ + +knoppix: environment fillknoppix iso + +environment: + ./makeenv + +fillknoppix: + ./copy-to-knoppix + +#all: kernel binaries bacula initrd iso +all: bacula + +copy-static-fd: kernel binaries static-bacula initrd iso + + +# This needs to be customized for your burner. +burn: + cdrecord dev=ATA:@CDSTL@ gracetime=2 fs=4096k driveropts=burnfree -v \ + -useinfo speed=48 -dao -eject -pad -data "bacula-knoppix.iso" + +# Blank the CDROM assuming it is +rw +blank: + cdrecord dev=ATA:@CDSTL@ gracetime=2 -v blank=fast -useinfo speed=48 + +scan: + cdrecord -scanbus + +distclean: +clean: +# +# Clean out files that are rebuilt +# + @rm -f bacula-knoppix.iso + @rm -rf roottree/bacula-* + @(cd bacula; make distclean) + @echo + @echo " Please delete manually the REMASTER_PATH" + @echo diff --git a/rescue/knoppix/cdrom/README b/rescue/knoppix/cdrom/README new file mode 100644 index 0000000..4ec5e3b --- /dev/null +++ b/rescue/knoppix/cdrom/README @@ -0,0 +1,50 @@ +This folder knoppix/cdrom was created by Mikael Kermorgant on Thu, 30 Mar 2006 + +It contains scripts aimed at creating a bootable rescue cd based on knoppix (see http://www.knoppix.org). +The first aim I had when building this cd was to make rescue cds for the debian servers I backup with bacula, which I failed to do with the original rescue cd. + +Requirements: + - A Linux system (tested on Debian 3.1 and Mandrake 10.0) + - 1,5 Go space on hard drive + - It should boot on any hardware that Knoppix can boot on + - cloop-utils version > 2.0 (only on the machine you build the iso) + + +A - To build an ISO image for burning a CD, do the following : + + cd + ./configure (your-options) + make + + download knoppix's modified source archive + cd bacula-rescue- + ./configure --with-bacula= + cd knoppix/cdrom + vi config + make bacula + make knoppix + + to cleanup, do: + + make clean + + you'll have to manually remove the knoppix source file and the directory where the source has been extracted. + +B - Build an iso image for multiple clients + + This requires you have already built one rescue cd (see step A). + You'll have to follow nearly the same steps : + + cd + ./configure (your-options) + make + + cd bacula-rescue- + ./configure --with-bacula= + cd knoppix/cdrom + make bacula + tar -cvzf bacula-.tar.gz roottree/bacula- + + Copy bacula-.tar.gz on the machine you built the iso and extract it in bacula-rescue-/knoppix/cdrom/roottree and execute : + + make knoppix \ No newline at end of file diff --git a/rescue/knoppix/cdrom/build-iso b/rescue/knoppix/cdrom/build-iso new file mode 100644 index 0000000..6070965 --- /dev/null +++ b/rescue/knoppix/cdrom/build-iso @@ -0,0 +1,22 @@ +#!/bin/sh + +if [ ! -f `which create_compressed_fs` ]; then + echo "You will need the create_compressed_fs script" + echo "Please check your install (cloop)" + exit +else + CCFS=`which create_compressed_fs` +fi + +rm -f bacula-knoppix.iso +. config + + +mkisofs -R -U -V "KNOPPIX.net fs" -publisher "BACULA www.bacula.org" \ + -hide-rr-moved -cache-inodes -no-bak -pad $REMASTER_PATH/source/KNOPPIX \ + | nice -5 $CCFS - 65536 > $REMASTER_PATH/master/KNOPPIX/KNOPPIX + + +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 bacula-knoppix.iso $REMASTER_PATH/master diff --git a/rescue/knoppix/cdrom/config b/rescue/knoppix/cdrom/config new file mode 100644 index 0000000..f8bb632 --- /dev/null +++ b/rescue/knoppix/cdrom/config @@ -0,0 +1,6 @@ +# settings for the remastering process +# you will need 1Gb swap and 2Gb space + +REMASTER_PATH=/baie/knx +KNOPPIX_SOURCE=/tmp/knoppix.source3.tar.bz2 +ISO_DESTPATH=/baie/knx diff --git a/rescue/knoppix/cdrom/copy-to-knoppix b/rescue/knoppix/cdrom/copy-to-knoppix new file mode 100644 index 0000000..640e9ee --- /dev/null +++ b/rescue/knoppix/cdrom/copy-to-knoppix @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config + +for d in `find ./roottree -type d -mindepth 1 -maxdepth 1` +do + cp -a $d $REMASTER_PATH/source/KNOPPIX/var/bacula/ +done diff --git a/rescue/knoppix/cdrom/isolinux.tar.bz2 b/rescue/knoppix/cdrom/isolinux.tar.bz2 new file mode 100644 index 0000000..298173b Binary files /dev/null and b/rescue/knoppix/cdrom/isolinux.tar.bz2 differ diff --git a/rescue/knoppix/cdrom/makebinaries b/rescue/knoppix/cdrom/makebinaries new file mode 100644 index 0000000..97b6c06 --- /dev/null +++ b/rescue/knoppix/cdrom/makebinaries @@ -0,0 +1,160 @@ +#!/bin/sh + +# this script finds all binaries and updates them with the ones +# from your system, in order to maintain them more easily. +# Be careful. If you have specially made binaries (perhaps lean ones), +# they will be overwritten. + +TOPDIR=`pwd` +R=roottree +PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH" + + +# Cleanup and make necessary directories +rm -rf $R/sbin +mkdir -p $R/etc $R/initrd $R/lib $R/mnt $R/mnt/cdrom +mkdir -p $R/proc $R/root $R/sbin $R/tmp $R/var +mkdir -p $R/dev $R/sys $R/initrd $R/sysroot +mkdir -p $R/etc/terminfo $R/etc/terminfo/l +mkdir -p $R/var/lib $R/var/log $R/var/run $R/var/state +mkdir -p $R/var/lib/nfs +mkdir -p $R/var/log/news +touch $R/var/log/news/news.crit $R/var/log/news/news.err $R/var/log/news.notice + +cd $R +ln -sf sbin bin +cd $TOPDIR + +# +# Some users have a different shell for root, so be +# sure to add it to the rootsbin list. Note, the shell may +# be copied twice, but it is not worth the effort to run uniq +# here. +# +TMPFILE=`mktemp -t bin.XXXXXXXXXX` +if [ $? != 0 ]; then + echo "Could not make temp file" + exit 1 +fi +cat rootsbin.list >${TMPFILE} +command=`grep ^root: /etc/passwd | cut -d ':' -f 7` +command=`basename $command` +if [ x$command != "xbash" ] ; then + echo "roottree/sbin/$command" >>${TMPFILE} +fi + +echo "Building root /sbin. Some Could not find messages are normal ..." +for file in `cat ${TMPFILE}` ; do + command=`basename $file` + fullfile=`which $command 2> /dev/null` + if [ x$fullfile != x ] ; then +# echo "updating $command in roottree with $fullfile" + cp -fpd $fullfile $file + if [ $? != 0 ] ; then + echo "Update failed." + exit 1 + fi + strip $file 2>/dev/null + else + echo "==== Could not find $command on your system ====" + rm -f $file + fi +done +rm -f ${TMPFILE} + +cd roottree/sbin +ln -sf halt reboot +# Eliminate recursive link +rm -f sbin +cd $TOPDIR + +# Copy all needed shared libraries +echo "Building root shared libaries ..." +rm -f `find roottree/lib/ -maxdepth 1 -type f 2>/dev/null` +# +# Statically linked binaries create an error +# message from ldd, so we ignore those +# +for lib in `find roottree/sbin/ -type f -exec ldd {} \; | awk '{print $3}' | sort | uniq` ; do + if [ -e $lib ] ; then + cp -fp $lib roottree/lib/ + if [ $? != 0 ] ; then + echo "Update failed." + exit 1 + fi + fi +done +# +# Wouldn't you know, there is one so that is critical to have or +# nothing will load on 2.6 kernels. +# +cp -fp /lib/ld-linux.so.* roottree/lib/ +strip `find roottree/lib/ -maxdepth 1 -type f` 2>/dev/null + +# Grub crap +mkdir -p roottree/usr/share/grub +cp -fpr /usr/share/grub/* roottree/usr/share/grub + +# +# Get a bunch of stuff from /etc +# +echo "Building /etc ..." +cp -p /etc/services roottree/etc/ +if [ $? != 0 ] ; then + echo "Update failed." + exit 1 +fi + +for file in `cat rootetc.list` ; do + if [ -e $file ] ; then + cp -fp $file roottree/etc/ + else + echo "==== Could not find $file in /etc ====" + fi +done +if [ -e /etc/modules.conf ] ; then + cp -fp /etc/modules.conf roottree/etc/ +fi +if [ -e /etc/modprobe.conf ] ; then + cp -fp /etc/modprobe.conf roottree/etc/ +fi +rm -rf roottree/etc/pam.d +if [ -e /etc/pam.d ] ; then + cp -a /etc/pam.d roottree/etc/ + if [ -e /etc/pam.conf ] ; then + cp -fp /etc/pam.conf roottree/etc/ + fi +fi + +if [ -e /etc/init.d ] ; then + rm -rf roottree/etc/init.d + cp -aL /etc/init.d roottree/etc/ +fi + +if [ -e /etc/udev ] ; then + rm -rf roottree/etc/udev + cp -aL /etc/udev roottree/etc/ +fi + + +if [ -e /etc/ssh ] ; then + cp -a /etc/ssh roottree/etc/ + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!! !!!!" + echo "!!!! Warning your /etc/ssh directory was copied. !!!!" + echo "!!!! Keep this directory and the CDROM secure. !!!!" + echo "!!!! !!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" +fi +if [ -e /etc/security ] ; then + cp -a /etc/security roottree/etc/ +fi + +# +# Pull a few files needed by PAM +# +if [ -f /lib/libnss_files.so.1 ] ; then + cp -fp /lib/libnss_files.so.1 roottree/lib/ +fi +cp -fp /lib/libnss_files.so.* roottree/lib/ +cp -a /lib/security roottree/lib/ diff --git a/rescue/knoppix/cdrom/makecdimage b/rescue/knoppix/cdrom/makecdimage new file mode 100644 index 0000000..7e1128d --- /dev/null +++ b/rescue/knoppix/cdrom/makecdimage @@ -0,0 +1,110 @@ +#! /bin/sh + +# This script makes a copy of an existing boot cd or iso on +# disk so that we can add the Bacula code to it for remastering +# +# When we are done if there is no error, we should have the +# cdrom image in cdimage +# + +export LANG=C + +# Print Usage message +usage () { + cat < knoppix.source.tar.bz2 + else + "could not download $KNOPPIX_SOURCE, please do it by hand and edit config" + fi + else + echo "problem with accessing knoppix source file" + fi +fi diff --git a/rescue/knoppix/cdrom/makeinitrd b/rescue/knoppix/cdrom/makeinitrd new file mode 100644 index 0000000..e543af8 --- /dev/null +++ b/rescue/knoppix/cdrom/makeinitrd @@ -0,0 +1,104 @@ +#!/bin/sh + +TOPDIR=`pwd` + +LOOP2=/tmp/bacula_rescue_loop2 +rm -rf $LOOP2 +mkdir -p $LOOP2 + +# Assume that everything to be loaded into memory with the +# RAM disk image (initrd) is is in the roottree directory. + +echo "Creating the Initial RAM disk image.... " + +# first find out how much space we need. +ISIZE=`du -s -k roottree/ | awk '{print $1}'` + +# add 2 Meg for extra +ISIZE=`expr $ISIZE + 2048` +echo "Initial RAM disk contents will be $ISIZE KB" + +# delete the existing RAM disk image, if there is one +rm -f root + +dd if=/dev/zero of=$TOPDIR/root bs=1k count=$ISIZE + +# cleanup any prior left over stuff +umount $LOOP2 2>/dev/null >/dev/null +losetup -d /dev/loop2 2>/dev/null >/dev/null + +# associate it with /dev/loop2 +losetup /dev/loop2 $TOPDIR/root + +# make an ext2 filesystem on it. Set reserve to 0 +mke2fs -q -m 0 /dev/loop2 $ISIZE +if [ $? != 0 ] ; then + echo "Build failed." + exit 1 +fi + +# we mount it... +mount /dev/loop2 $LOOP2 +# ... and delete the lost+found directory +rm -rf $LOOP2/lost+found + +# then we copy the contents of our roottree to this filesystem +cp -dpR roottree/* $LOOP2/ +cprtn=$? + +# and unmount and divorce /dev/loop2 +umount $LOOP2 +losetup -d /dev/loop2 +rm -rf $LOOP2 + +# If above copy failed, bail out +if [ $cprtn != 0 ] ; then + echo "RAM disk build failed." + exit 1 +fi + +# This is a newer way of creating a ramfs, which we don't use +# (cd roottree; find . | cpio --quiet -c -o) >root + +echo "Building initial RAM disk done" + +# Now we have the image of the RAM disk in $TOPDIR/loopfiles/root. We +# compress this one and write the compressed image to the boot tree: + +echo "Compressing the RAM disk image.... " + +# delete any existing one +rm -f cdtree/boot/isolinux/initrd.img + +# and gzip our RAM disk image and put it in the right place. +gzip -9 -c root >cdtree/boot/isolinux/initrd.img +if [ $? != 0 ] ; then + echo "Build failed" + exit 1 +fi + +rdsize=`expr $ISIZE \* 1024` +echo "Ramdisk size is $rdsize" + +echo "Making isolinux.cfg" +cat >cdtree/boot/isolinux/isolinux.cfg <