hvk: autodetermine archive name based on release
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 9 Oct 2024 16:19:41 +0000 (12:19 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 17 Oct 2024 15:20:10 +0000 (11:20 -0400)
scripts/hvk-compile.sh

index b915b87..836000c 100755 (executable)
@@ -6,7 +6,6 @@ SCRIPTPATH=$(dirname ${SCRIPT})
 source ${SCRIPTPATH}/hvk-common.sh
 
 DEPLOYDIR=rootfs
-ARCHIVE=kernel.tar.xz
 
 print_usage()
 {
@@ -115,8 +114,17 @@ function rootfs_install() {
 }
 
 function rootfs_archive() {
+    if [ -f "include/config/kernel.release" ]; then
+        archive="linux-$(cat include/config/kernel.release).tar.xz"
+    fi
+
+    if [ "${archive}" = "" ]; then
+        echo "${PROG_NAME}: Unable to determine kernel release"
+        exit 1
+    fi
+
     pushd ${deploydir}
-    tar cf - * | xz > ../${ARCHIVE}
+    tar cf - * | xz > ../${archive}
     popd
 }
 
@@ -129,8 +137,8 @@ if [ "${EVK_IP}" != "" ]; then
     rootfs_install
     rootfs_archive
 
-    scp ${ARCHIVE} root@${EVK_IP}:/tmp
-    ssh root@${EVK_IP} "cd / && tar -xf /tmp/${ARCHIVE}"
+    scp ${archive} root@${EVK_IP}:/tmp
+    ssh root@${EVK_IP} "cd / && tar -xf /tmp/${archive}"
 
     # Determine if using extlinux on target:
     ssh -q root@${EVK_IP} [[ -f /boot/extlinux/extlinux.conf ]] && EXTLINUX=1 || EXTLINUX=0;