#!/bin/bash

# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/target/lvp/x86/build.sh
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
# 
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---

echo_status "Copying release_skeleton files"
cd ${releasedir}
cp -r ${base}/target/${target}/${arch}/release_skeleton/* .

unset opt_text
case "${ROCKCFG_X86_OPT}" in
	generic)	opt_text="for all x86 machines";;
	i386)		opt_text="for Intel 386";;
	i486)		opt_text="for Intel 486";;
	via-c3)		opt_text="for VIA CyrixIII/VIA-C3";;
	via-c3-2)	opt_text="for VIA-C3-2 Nemiah";;
	pentium)	opt_text="for Intel Pentium";;
	pentium-mmx)	opt_text="for Intel Pentium with MMX";;
	pentiumpro)	opt_text="for Intel Pentium-Pro";;
	pentium2)	opt_text="for Intel Pentium 2";;
	pentium3)	opt_text="for Intel Pentium 3";;
	pentium4)	opt_text="for Intel Pentium 4";;
	k6)		opt_text="for AMD K6";;
	k6-2)		opt_text="for AMD K6-2";;
	k6-3)		opt_text="for AMD K6-3";;
	athlon)		opt_text="for AMD Athlon";;
	athlon-tbird)	opt_text="for AMD Athlon Thunderbird";;
	athlon4)	opt_text="for AMD Athlon 4";;
	athlon-xp)	opt_text="for AMD Athlon XP";;
	athlon-mp)	opt_text="for AMD Athlon MP" ;;
	*)		opt_text="for unknown optimisation" ;;
esac

sed -i -e "s,COMPILEDFOR,${opt_text},g" README
echo "LVP Version ${lvp_ver}" > VERSION

find ${releasedir} -name .svn -exec rm -rf {} \; 2>/dev/null

echo_status "Extracting isolinux boot loader."
mkdir -p isolinux
tar --use-compress-program=bzip2 \
    -O -xf ${base}/download/mirror/s/syslinux-${syslinux_ver}.tar.bz2 \
    syslinux-${syslinux_ver}/isolinux.bin > ${releasedir}/isolinux/isolinux.bin

echo_status "Creating isolinux config file."
cp ${base}/target/${target}/x86/isolinux.cfg ${releasedir}/isolinux/
cp ${base}/target/${target}/x86/help?.txt ${releasedir}/isolinux/
cp ${rootdir}/boot/vmlinuz ${releasedir}/isolinux/