Skip to content

Commit fc3ba9e

Browse files
author
Juan RP
authored
Merge pull request #60 from Noah-Huppert/mklive-kver-opt
mklive: added -v kerver option
2 parents 59274b0 + 7ca1cbc commit fc3ba9e

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

mklive.sh.in

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ directory if unset).
8181
8282
-C "cmdline args" Add additional kernel command line arguments.
8383
-T "title" Modify the bootloader title.
84+
-v linux<version> Install a custom Linux version on ISO image (linux meta-package if unset).
8485
-K Do not remove builddir.
8586
8687
The $PROGNAME script generates a live image of the Void Linux distribution.
@@ -288,7 +289,7 @@ generate_iso_image() {
288289
#
289290
# main()
290291
#
291-
while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:h" opt; do
292+
while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:v:h" opt; do
292293
case $opt in
293294
a) BASE_ARCH="$OPTARG";;
294295
b) BASE_SYSTEM_PKG="$OPTARG";;
@@ -305,6 +306,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:h" opt; do
305306
p) PACKAGE_LIST="$OPTARG";;
306307
C) BOOT_CMDLINE="$OPTARG";;
307308
T) BOOT_TITLE="$OPTARG";;
309+
v) LINUX_VERSION="$OPTARG";;
308310
h) usage;;
309311
*) usage;;
310312
esac
@@ -370,10 +372,26 @@ copy_void_keys "$VOIDHOSTDIR"
370372
XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
371373
XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
372374

373-
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux|head -1)
375+
# Get linux version for ISO
376+
# If linux version option specified use
377+
if [ -n "$LINUX_VERSION" ]; then
378+
if ! echo "$LINUX_VERSION" | grep "linux[0-9._]*"; then
379+
die "-v option must be in format linux<version>"
380+
fi
381+
382+
_linux_series="$LINUX_VERSION"
383+
PACKAGE_LIST="$PACKAGE_LIST $LINUX_VERSION"
384+
else # Otherwise find latest stable version from linux meta-package
385+
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux|head -1)
386+
fi
387+
374388
_kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
375389
KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
376390

391+
if [ "$?" -ne "0" ]; then
392+
die "Failed to find kernel package version"
393+
fi
394+
377395
: ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date +%Y%m%d).iso"}
378396

379397
print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."

0 commit comments

Comments
 (0)