summaryrefslogtreecommitdiffstats
path: root/build_tools/clarch/larch/run/usb2bootiso
blob: cb2190a1130a5401ba215b8059e756e002fc214e (plain)
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
#!/bin/bash

# usb2bootiso

# For use after a completed run of mklarch or larchify which has produced
# a larch USB-stick with syslinux boot. It will generate a boot iso for
# use on computers which can't boot from the USB-stick.

# $1 is the base of the 'livified' Arch installation (larchroot)
# If no path is given, a directory (or symlink) 'larchroot' in the
# working directory will be used.
#===================================================================
# 2008.06.22

APP="$( basename $0 )"
# Get path to larch base directory, via the location of this script
FULLPATH="$( readlink -f $0 )"
SCRIPTDIR="$( dirname ${FULLPATH} )"

mkiso ()
{
    mkisofs -r -l $1 \
        -no-emul-boot -boot-load-size 4 -boot-info-table \
        -input-charset=UTF-8 \
        -publisher "designed by gradgrind, licence: GPL" \
        -A "larch-5" \
        -o "bootcd.iso" "${CDDATA}"

    if [ $? -eq 0 ]; then
        echo "// Your ISO has been created as bootcd.iso"
    else
        echo "ERROR: iso build failed" 1>&2
        return 1
    fi
}

if [ -z "$1" ]; then
    if [ -d larchroot ]; then
        MP="$( readlink -f larchroot )"
    else
        echo "Must pass Arch root directory as argument"
        exit 1
    fi
else
    if ! [ -d $1 ]; then
        echo "$1 is not a directory"
        exit 1
    fi
    MP="$( readlink -f $1 )"
fi

CDDATA=$( pwd )/bootcd
rm -rf ${CDDATA}
mkdir -p ${CDDATA}/isolinux

if ! cp -r ${MP}/.larch/cd/isolinux ${CDDATA} &>/dev/null; then
    echo "No larch boot files found at ${MP}/.larch/cd/isolinux"
    exit 1
fi
if ! cp ${MP}/usr/lib/syslinux/isolinux.bin ${CDDATA}/isolinux; then
    echo "Couldn't find isolinux.bin"
    exit 1
fi

mkiso "-b isolinux/isolinux.bin -c isolinux/isolinux.boot"