summaryrefslogtreecommitdiffstats
path: root/install-usb
blob: 90c78157a8cb9a240bb3d784b5d244d55cdc7c41 (plain) (blame)
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
#!/bin/bash

ROOT_DIR=$(dirname $(readlink -f $0))

if [ $(whoami) != "root" ]; then
  echo "you should be root"
  exit 1;
fi

OUT_DEV=$1
SYSLINUX=$ROOT_DIR/contrib/syslinux/latest

PATH="$PATH:$ROOT_DIR/bin/"

[ ! -f $SYSLINUX/Makefile ] && env.setup-syslinux.sh

if [ -z $OUT_DEV ]; then
    echo "no dev"
    exit 1
fi

for i in 1 2 3 4 5 6 7 8 9; do
   umount /dev/${OUT_DEV}$i &> /dev/null
done

cat $SYSLINUX/mbr/mbr.bin > /dev/${OUT_DEV}
mkfs.ext2 -L openslx-stick /dev/${OUT_DEV}1

mkdir -p /media/openslx-stick
mount /dev/${OUT_DEV}1 /media/openslx-stick

mkdir -p /media/openslx-stick/boot

$SYSLINUX/extlinux/extlinux -i /media/openslx-stick/boot

[ ! -f $ROOT_DIR/build/kernel-preboot-latest ] && build.kernel.sh
cp -v $ROOT_DIR/build/kernel-preboot-latest /media/openslx-stick/boot/kernel

#[ ! -f $ROOT_DIR/build/initramfs-default ] && build.initramfs.sh
build.initramfs.sh
cp -v $ROOT_DIR/build/initramfs-default /media/openslx-stick/boot/init

cp -v $SYSLINUX/com32/menu/menu.c32 /media/openslx-stick/boot/
cp -v $SYSLINUX/com32/menu/vesamenu.c32 /media/openslx-stick/boot/

cp -v $ROOT_DIR/config/extlinux/* /media/openslx-stick/boot

sync
umount /media/openslx-stick