minix/releasetools/fetch.functions
Jean-Baptiste Boric da7dc4d54c PXE boot generation script
Leveraging the new image generation framework, MINIX has now turn-key
PXE booting capability. The booting process uses SYSLINUX, licensed
under GPL2+.

Due to the lack of NFS support, a ramdisk is provided as a root device.
The generated ramdisk is quite huge for a network boot, but it can be
trimmed down at a later date.
2016-03-17 17:24:53 +01:00

59 lines
941 B
Bash

#!/bin/sh
#
# Common logic to perform checkout of repos
#
# -o output dir
OUTPUT_DIR=""
GIT_VERSION=""
while getopts "o:n:?" c
do
case "$c" in
\?)
echo "Usage: $0 -o output dir -n version " >&2
exit 1
;;
o)
OUTPUT_DIR=$OPTARG
;;
n)
GIT_VERSION=$OPTARG
;;
esac
done
#
# check arguments
#
if [ -z "$OUTPUT_DIR" -o -z "$GIT_VERSION" ]
then
echo "Missing required parameters OUTPUT_DIR=$OUTPUT_DIR GIT_VERSION=$GIT_VERSION"
echo "Usage: $0 -o output dir -n version " >&2
exit 1
fi
#
# if the file doesn't exist it's easy , to a checkout
#
if [ ! -e "$OUTPUT_DIR" ]
then
git clone ${REPO_URL} -b minix $OUTPUT_DIR
fi
(
cd "$OUTPUT_DIR"
#
# perform an update
#
CURRENT_VERSION=`git rev-parse HEAD`
if [ "$CURRENT_VERSION" != "$GIT_VERSION" ]
then
echo "Current version $CURRENT_VERSION does not match wanted $GIT_VERSION performing update and checkout"
git fetch -v
git checkout $GIT_VERSION
fi
)