add support to install from system path
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
This commit is contained in:
107
ipxe-update.sh
107
ipxe-update.sh
@@ -11,38 +11,101 @@ EFI=bin-${ARCH}-efi/ipxe.efi
|
||||
PCBIOS_output=`pwd`/staticfiles/${ARCH}.kpxe
|
||||
EFI_output=`pwd`/staticfiles/${ARCH}.efi
|
||||
|
||||
set -xe
|
||||
|
||||
SYSBIOS="/usr/share/ipxe/undionly.kpxe"
|
||||
SYSEFI="/usr/share/ipxe/ipxe-${ARCH}.efi"
|
||||
|
||||
TMPDIR=`mktemp -d /tmp/ipxebuild.XXXXXX`
|
||||
if [ -f "$1" ] ; then
|
||||
WRKDIR=`pwd`
|
||||
cd "$TMPDIR"
|
||||
tar xzf $WRKDIR/$1
|
||||
else
|
||||
|
||||
usage() {
|
||||
echo "Usage: $(basename $0)
|
||||
[-s] (install efi and bios from system location)
|
||||
[-g] (build from git repo and install built efi and bios)
|
||||
[-h] (help)
|
||||
[-f] ipxe_source_gz_file (build from given tar.gz ipxe file and install built efi and bios)
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
|
||||
sysbuild() {
|
||||
if [ -f "${SYSEFI}" ] ; then
|
||||
cp $SYSEFI $EFI_output
|
||||
else
|
||||
echo "No such file or directory: ${SYSEFI}, try 'dnf install ipxe-bootimgs-x86'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "${SYSBIOS}" ] ; then
|
||||
cp $SYSBIOS $PCBIOS_output
|
||||
else
|
||||
echo "No such file or directory: ${SYSBIOS}, try 'dnf install ipxe-bootimgs-x86'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "copy ${SYSEFI} and ${SYSBIOS} done"
|
||||
}
|
||||
|
||||
gitbuild() {
|
||||
cd "$TMPDIR"
|
||||
git clone --depth 1 --branch $VERSION https://github.com/ipxe/ipxe.git
|
||||
fi
|
||||
build
|
||||
}
|
||||
|
||||
cd ipxe*/src
|
||||
filebuild() {
|
||||
TARGET_PATH=$1
|
||||
case $TARGET_PATH in
|
||||
/*) ;;
|
||||
*)
|
||||
TARGET_PATH=`pwd`/$TARGET_PATH
|
||||
;;
|
||||
esac
|
||||
if [ -f "${TARGET_PATH}" ] ; then
|
||||
cd "$TMPDIR"
|
||||
tar xzf $TARGET_PATH
|
||||
build $TARGET_PATH
|
||||
else
|
||||
echo "No such file $TARGET_PATH"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
sed -i.bak \
|
||||
-e 's,//\(#define.*CONSOLE_SERIAL.*\),\1,' \
|
||||
-e 's,//\(#define.*CONSOLE_FRAMEBUFFER.*\),\1,' \
|
||||
config/console.h
|
||||
build() {
|
||||
cd ipxe*/src
|
||||
|
||||
sed -i.bak \
|
||||
-e 's,//\(#define.*IMAGE_ZLIB.*\),\1,' \
|
||||
-e 's,//\(#define.*IMAGE_GZIP.*\),\1,' \
|
||||
-e 's,//\(#define.*VLAN_CMD.*\),\1,' \
|
||||
config/general.h
|
||||
sed -i.bak \
|
||||
-e 's,//\(#define.*CONSOLE_SERIAL.*\),\1,' \
|
||||
-e 's,//\(#define.*CONSOLE_FRAMEBUFFER.*\),\1,' \
|
||||
config/console.h
|
||||
|
||||
make -j 8 $PCBIOS "$@"
|
||||
make -j 8 $EFI "$@"
|
||||
sed -i.bak \
|
||||
-e 's,//\(#define.*IMAGE_ZLIB.*\),\1,' \
|
||||
-e 's,//\(#define.*IMAGE_GZIP.*\),\1,' \
|
||||
-e 's,//\(#define.*VLAN_CMD.*\),\1,' \
|
||||
config/general.h
|
||||
|
||||
make -j 8 $PCBIOS "$@"
|
||||
make -j 8 $EFI "$@"
|
||||
|
||||
cp $PCBIOS $PCBIOS_output
|
||||
cp $EFI $EFI_output
|
||||
cp $PCBIOS $PCBIOS_output
|
||||
cp $EFI $EFI_output
|
||||
|
||||
echo "copy ${PCBIOS} and ${EFI} done"
|
||||
}
|
||||
|
||||
while getopts 'sghdf:' c
|
||||
do
|
||||
case $c in
|
||||
s) sysbuild
|
||||
break
|
||||
;;
|
||||
g) gitbuild
|
||||
break
|
||||
;;
|
||||
f) filebuild $OPTARG
|
||||
break
|
||||
;;
|
||||
h|*) usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
Reference in New Issue
Block a user