From 8606d9a2a8b071dbaced3b06cc9e3b53e6454c24 Mon Sep 17 00:00:00 2001 From: Jake Day Date: Wed, 6 Jun 2018 22:15:26 -0400 Subject: [PATCH] adding ability to let setup script download and install kernel --- README.md | 10 ++++++---- setup.sh | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b157df415..a602526bb 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ You will need to download the image, headers and libc-dev deb files for the vers ### Instructions -0. (Prep) Install Git: +0. (Prep) Install Dependencies: ``` - sudo apt install git + sudo apt install git curl wget sed ``` 1. Clone the linux-surface repo: ``` @@ -60,11 +60,13 @@ You will need to download the image, headers and libc-dev deb files for the vers ``` sudo sh setup.sh ``` -4. Install the headers, kernel and libc-dev (make sure you cd to your download location first): +5. Reboot on installed kernel. + +The setup script will handle installing the latest kernel for you. You can also choose to download any version you want and install yourself: +Install the headers, kernel and libc-dev (make sure you cd to your download location first): ``` sudo dpkg -i linux-headers-[VERSION].deb linux-image-[VERSION].deb linux-libc-dev-[VERSION].deb ``` -5. Reboot on installed kernel. ### Compiling the Kernel from Source diff --git a/setup.sh b/setup.sh index b40509448..aaf8f67fb 100644 --- a/setup.sh +++ b/setup.sh @@ -139,4 +139,21 @@ echo "Installing marvell firmware...\n" mkdir -p /lib/firmware/mrvl/ unzip -o firmware/mrvl_firmware.zip -d /lib/firmware/mrvl/ +read -rp "Do you want this script to download and install the latest kernel for you? (type yes or no) " autoinstallkernel;echo + +if [ "$autoinstallkernel" = "yes" ]; then + echo "Downloading latest kernel...\n" + + urls=$(curl --silent "https://api.github.com/repos/jakeday/linux-surface/releases/latest" | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/') + + resp=$(wget -P tmp $urls) + + echo "Installing latest kernel...\n" + + dpkg -i tmp/*.deb + rm -rf tmp +else + echo "Not downloading latest kernel" +fi + echo "\nAll done! Please reboot."