Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 beyerle@PS 1
#!/bin/bash
2
#
3
# run this script to create a LiveCD in /tmp/livecd.iso
4
# Your kernel image has to be in $ROOT/boot/vmlinuz or $ROOT/vmlinuz
5
# 
6
# Urs Beyerle, PSI:
7
# - add x86_64 support
8
# - add support to build for UP and SMP kernel
9
#   SMP kernel is added to LiveCD, if variable $SMP is set
26 beyerle@PS 10
# - copy /boot/System.map-* and /boot/config-* to $CDDATA/boot
11
#   copy /boot/grub/splash.xpm.gz to $CDDATA/boot/grub
12
#   copy /boot/message* $CDDATA/boot/
13
#   copy /boot/symvers-* $CDDATA/boot/
14
#   all needed for install LiveCD in local harddisk
23 beyerle@PS 15
# - config no longer sourced, we take ../livecd.conf
1 beyerle@PS 16
#
17
 
18
export LANG=C
19
 
20
ARCH=$( /bin/arch )
21
[ "$ARCH" != "x86_64" ] && ARCH=i686
22
 
23
# export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/
24
export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/:.:./tools:../tools
25
 
26
CHANGEDIR="`dirname \`readlink -f $0\``"
27
echo "Changing current directory to $CHANGEDIR"
28
cd $CHANGEDIR
29
 
69 beyerle@PS 30
. initrd/liblinuxlive || exit 1
23 beyerle@PS 31
# . config || exit 1
32
. ../livecd.conf || exit 1
1 beyerle@PS 33
 
34
./install $ROOT
35
 
36
VMLINUZ=$ROOT/boot/vmlinuz
37
if [ -L "$VMLINUZ" ]; then VMLINUZ=`readlink -f $VMLINUZ`; fi
38
if [ "`ls $VMLINUZ 2>/dev/null`" = "" ]; then echo "cannot find $VMLINUZ"; exit 1; fi
39
 
40
if [ $SMP ]; then
41
    VMLINUZ_SMP=$ROOT/boot/vmlinuz${SMP}
42
    if [ -L "$VMLINUZ_SMP" ]; then VMLINUZ_SMP=`readlink -f $VMLINUZ_SMP`; fi
43
    if [ "`ls $VMLINUZ_SMP 2>/dev/null`" = "" ]; then echo "cannot find $VMLINUZ_SMP"; exit 1; fi
44
fi
45
 
46
header "Creating LiveCD from your Linux"
47
 
48
mkdir -p $CDDATA/base
49
mkdir -p $CDDATA/modules
50
mkdir -p $CDDATA/optional
51
mkdir -p $CDDATA/rootcopy
52
 
53
echo "copying livecd.conf to $CDDATA"
54
cp -a ../livecd.conf $CDDATA/
55
 
56
echo "copying cd-root to $CDDATA"
57
cp -R cd-root/* $CDDATA
58
if [ ! $SMP ]; then
59
    # delete line with "SMP kernel" in boot/splash.cfg
60
    sed -i "/SMP kernel/d" $CDDATA/boot/splash.cfg
61
    # delete 'or "smp" ' in  boot/help*.txt
62
    sed -i 's/or "smp" //' $CDDATA/boot/help*.txt
63
fi
64
 
65
# cp -R tools $CDDATA
69 beyerle@PS 66
# cp -R info/* $CDDATA
67
cp -a ../COPYING $CDDATA
68
cp -a ../LICENSE $CDDATA
1 beyerle@PS 69
 
16 beyerle@PS 70
# copy splash.xpm.gz to LiveCD
71
mkdir -p $CDDATA/boot/grub
130 beyerle@PS 72
cp -aL $ROOT/boot/grub/splash.xpm.gz $CDDATA/boot/grub/
16 beyerle@PS 73
 
74
# copy kernel(s) to LiveCD
1 beyerle@PS 75
echo "using kernel from $VMLINUZ"
76
echo "and kernel modules from /lib/modules/$KERNEL"
16 beyerle@PS 77
cp -a $VMLINUZ $CDDATA/boot/vmlinuz
1 beyerle@PS 78
if [ $SMP ]; then 
79
    echo "using kernel from $VMLINUZ_SMP"
80
    echo "and kernel modules from /lib/modules/${KERNEL}smp"
16 beyerle@PS 81
    cp -a $VMLINUZ_SMP $CDDATA/boot/vmlinuz${SMP}
1 beyerle@PS 82
fi
83
 
26 beyerle@PS 84
# copy System.map, config, etc. to LiveCD /boot
16 beyerle@PS 85
cp -a $ROOT/boot/System.map-* $CDDATA/boot/
26 beyerle@PS 86
cp -a $ROOT/boot/config-*  $CDDATA/boot/
70 beyerle@PS 87
cp -a $ROOT/boot/message*  $CDDATA/boot/ 2>/dev/null
26 beyerle@PS 88
cp -a $ROOT/boot/symvers-* $CDDATA/boot/ 2>/dev/null
16 beyerle@PS 89
 
70 beyerle@PS 90
# remove $CDDATA/boot/.svn dir
91
rm -rf $CDDATA/boot/.svn
92
 
1 beyerle@PS 93
BUILD_KERNELS="$KERNEL"
94
[ $SMP ] && BUILD_KERNELS="$BUILD_KERNELS ${KERNEL}smp"
95
 
96
echo "creating initrd image..."
97
 
98
for BUILD_KERNEL in $BUILD_KERNELS; do
99
 
100
    cd initrd
23 beyerle@PS 101
    ./initrd_create $BUILD_KERNEL
1 beyerle@PS 102
    if [ "$?" -ne 0 ]; then exit; fi
103
    cd ..
104
    if [ "$BUILD_KERNEL" = "$KERNEL" ]; then
23 beyerle@PS 105
	echo "add initrd.gz for kernel $BUILD_KERNEL"
1 beyerle@PS 106
	cp initrd/$INITRDIMG.gz $CDDATA/boot/initrd.gz        # UP Kernel
107
    else
23 beyerle@PS 108
	echo "add initrd${SMP}.gz for kernel $BUILD_KERNEL"
1 beyerle@PS 109
	cp initrd/$INITRDIMG.gz $CDDATA/boot/initrd${SMP}.gz  # SMP Kernel
110
    fi
111
    rm initrd/$INITRDIMG.gz
112
 
113
done
114
 
115
echo "creating compressed images..."
116
 
117
# home not longer in the list, will be created on the fly
118
#
119
if [ "$ARCH" = "x86_64" ]; then
101 beyerle@PS 120
    dirs="bin etc lib lib64 root usr sbin var opt"
1 beyerle@PS 121
else
101 beyerle@PS 122
    dirs="bin etc lib root usr sbin var opt"
1 beyerle@PS 123
fi
124
 
125
for dir in $dirs; do
126
    if [ -d $ROOT/$dir ]; then
127
      echo "base/$dir.mo"
128
      create_module $ROOT/$dir $CDDATA/base/$dir.mo -keep-as-directory
129
      if [ $? -ne 0 ]; then exit; fi
130
    fi
131
done
132
 
2 beyerle@PS 133
# remove any .svn folders from the CD
134
find $CDDATA -type d -name .svn -exec rm -f {} \;
135
 
1 beyerle@PS 136
echo "creating LiveCD ISO image..."
137
cd $CDDATA
138
./make_iso.sh /tmp/livecd.iso
139
 
140
cd /tmp
141
header "Your ISO is created in /tmp/livecd.iso"