Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v1.4
Fetching contributors…

Cannot retrieve contributors at this time

executable file 72 lines (58 sloc) 2.018 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#!/bin/bash
# Linux Live Kit version 7

export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/

CHANGEDIR=$(dirname $(readlink -f $0))
echo "Changing current directory to $CHANGEDIR"
cd $CHANGEDIR

. ./.config || exit 1
. ./livekitlib || exit 1

# only root can continue, because only root can read all files from your system
allow_only_root

# check for mksquashfs with xz compression
if [ "$(mksquashfs 2>&1 | grep "Xdict-size")" = "" ]; then
   echo "mksquashfs not found or doesn't support -comp xz, aborting, no changes made"
   exit 1
fi

# build initramfs image
echo "Building intramfs image..."
cd initramfs
INITRAMFS=$(./initramfs_create "$LIVEKITNAME")
cd ..

# create live kit filesystem (cpio archive)
rm -Rf "$LIVEKITDATA"
BOOT="$LIVEKITDATA"/"$LIVEKITNAME"/boot
mkdir -p "$BOOT"
mkdir -p "$BOOT"/../changes
mv "$INITRAMFS" $BOOT/initrfs.img
cp bootfiles/* $BOOT
cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" > $BOOT/syslinux.cfg
cat bootfiles/bootinst.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" > $BOOT/bootinst.bat
cp /boot/vmlinuz $BOOT/

if [ -d sb ]; then
   cp sb/* $LIVEKITDATA/$LIVEKITNAME/
else
   # create compressed bundles
   for i in $MKMOD; do
      mksquashfs /$i $LIVEKITDATA/$LIVEKITNAME/$i.$BEXT -comp xz -b 512k -keep-as-directory
   done
fi

# copy rootcopy folder
if [ -d rootcopy ]; then
   cp -a rootcopy $LIVEKITDATA/$LIVEKITNAME/
fi


# create ISO for CD image
echo "Creating ISO file for CD boot..."
cd "$LIVEKITDATA"
TARGET=/mnt/z
if [ ! -d $TARGET ]; then
   TARGET=/tmp
fi

mkisofs -o "$TARGET/$LIVEKITNAME-$(uname -m).iso" -v -J -R -D -A "$LIVEKITNAME" -V "$LIVEKITNAME" \
-no-emul-boot -boot-info-table -boot-load-size 4 \
-b "$LIVEKITNAME"/boot/isolinux.bin -c "$LIVEKITNAME"/boot/isolinux.boot . \
>/dev/null 2>/dev/null

echo "Creating TAR for USB boot..."
tar -c ./* > "$TARGET/$LIVEKITNAME-$(uname -m).tar"

cd ..
rm -Rf "$LIVEKITDATA"
echo "finished. Find your result in $TARGET"
Something went wrong with that request. Please try again.