UpgradeKernel.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. #Replace the PrawnOS linux kernel that is installed on the internal emmc storage with
  3. #the PrawnOS linux kernel from the booted usb device or sd card
  4. # This file is part of PrawnOS (http://www.prawnos.com)
  5. # Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
  6. # PrawnOS is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License version 2
  8. # as published by the Free Software Foundation.
  9. # PrawnOS is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
  15. RESOURCES=/InstallResources
  16. # Grab the boot device, which is either /dev/sda for usb or /dev/mmcblk0 for an sd card
  17. BOOT_DEVICE=$(mount | head -n 1 | cut -d '2' -f 1)
  18. read -p "This will replace the kernel installed on the internal storage (EMMC) with the one on the booted USB drive or SD card and reboot when finished, do you want to continue? [Y/n]" -n 1 -r
  19. echo
  20. if [[ $REPLY =~ ^[Yy]$ ]]
  21. then
  22. echo Writing kernel partition
  23. dd if=/dev/zero of=/dev/mmcblk2p1 bs=512 count=65536
  24. dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1
  25. echo You can now reboot
  26. fi
  27. echo Exiting