浏览代码

adding ability to let setup script download and install kernel

Jake Day 7 年之前
父节点
当前提交
8606d9a2a8
共有 2 个文件被更改,包括 23 次插入4 次删除
  1. 6 4
      README.md
  2. 17 0
      setup.sh

+ 6 - 4
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
 

+ 17 - 0
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."