Linux Lite Forums

Development => Linux Lite Software Development => Topic started by: Jerry on May 28, 2016, 04:14:37 AM

Title: Select Kernel Installer
Post by: Jerry on May 28, 2016, 04:14:37 AM
This is a very simple kernel installer I've started working on. At this stage, I haven't decided if this will develop into a LL package, but people have asked for it.

The code so far:
Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Lite Kernel Select
# Description: Select a Linux Kernel to install on Linux Lite.
# Authors:  Jerry Bezencon
# Website: https://www.linuxliteos.com
#--------------------------------------------------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
fi

if [ ! -z "$(pgrep gdebi-gtk)" ]
then
   killall -9 gdebi-gtk
fi

# Set the window icon variable
ic="/usr/share/icons/zenity-llcc.png"

# Set the Title bar variable
tb="Lite Kernel Select"

# Download message variable
dl="Downloading and installing Kernel"

# Update package list
zenity --question --title="$tb" --window-icon="$ic" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

    APTUPDATE=$(grep '^deb' -c /etc/apt/sources.list) # Total of repositories registered, this is approximated
    sudo apt-get update 2>&1 | awk -v total=$APTUPDATE '/^Ign|^ Get/{count++;$1=""} FNR { if (total != 0){percentage=int (100*count/total);print (percentage < 90?percentage:90),"\n#",substr($0, 0, 128) }; fflush(stdout)}' \
      | zenity --progress --text="Updating package lists..." --window-icon=$ic --title="Updating Software Sources - please wait..." --percentage=0 --auto-close --width=600

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then

                                        unset APTUPDATE
                                        zenity --error \
                                        --title="Error" --text="$APPNAME couldn't fetch the package cache information lists."

                                        exit 1
                                fi
unset APTUPDATE

KERNLIST=$(zenity --title="Select a Kernel from the list" \
--height=300 --width="320" \
--list --radiolist --text "Select a Kernel to install:" \
--column "Select" --column "Kernel Version" \
FALSE "Kernel 3.15.0" \
FALSE "Kernel 3.16.0" \
FALSE "Kernel 3.17.0" \
FALSE "Kernel 3.18.0" \
FALSE "Kernel 3.19.0" \
FALSE "Kernel 4.0.0" \
FALSE "Kernel 4.1.0" \
FALSE "Kernel 4.2.0" \
FALSE "Kernel 4.3.0" \
FALSE "Kernel 4.4.0" \
FALSE "Kernel 4.5.0" \
FALSE "Kernel 4.6.0")

if [[ "$KERNLIST" =~ "Kernel 3.15.0" ]]; then
    apt-get install linux-headers-linuxlite-3.15.0 linux-image-linuxlite-3.15.0 -y | zenity --progress --title="$tb" --text="$dl 3.15.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.16.0" ]]; then
    apt-get install linux-headers-linuxlite-3.16.0 linux-image-linuxlite-3.16.0 -y | zenity --progress --title="$tb" --text="$dl 3.16.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.17.0" ]]; then
    apt-get install linux-headers-linuxlite-3.17.0 linux-image-linuxlite-3.17.0 -y | zenity --progress --title="$tb" --text="$dl 3.17.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.18.0" ]]; then
    apt-get install linux-headers-linuxlite-3.18.0 linux-image-linuxlite-3.18.0 -y | zenity --progress --title="$tb" --text="$dl 3.18.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.19.0" ]]; then
    apt-get install linux-headers-linuxlite-3.19.0 linux-image-linuxlite-3.19.0 -y | zenity --progress --title="$tb" --text="$dl 3.19.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.0.0" ]]; then
    apt-get install linux-headers-linuxlite-4.0.0 linux-image-linuxlite-4.0.0 -y | zenity --progress --title="$tb" --text="$dl 4.0.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.1.0" ]]; then
    apt-get install linux-headers-linuxlite-4.1.0 linux-image-linuxlite-4.1.0 -y | zenity --progress --title="$tb" --text="$dl 4.1.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.2.0" ]]; then
    apt-get install linux-headers-linuxlite-4.2.0 linux-image-linuxlite-4.2.0 -y | zenity --progress --title="$tb" --text="$dl 4.2.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.3.0" ]]; then
    apt-get install linux-headers-linuxlite-4.3.0 linux-image-linuxlite-4.3.0 -y | zenity --progress --title="$tb" --text="$dl 4.3.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.4.0" ]]; then
    apt-get install linux-headers-linuxlite-4.4.0 linux-image-linuxlite-4.4.0 -y | zenity --progress --title="$tb" --text="$dl 4.4.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.5.0" ]]; then
    apt-get install linux-headers-linuxlite-4.5.0 linux-image-linuxlite-4.5.0 -y | zenity --progress --title="$tb" --text="$dl 4.5.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.6.0" ]]; then
    apt-get install linux-headers-linuxlite-4.6.0 linux-image-linuxlite-4.6.0 -y | zenity --progress --title="$tb" --text="$dl 4.6.0, please standby..." --pulsate --auto-kill --auto-close
            else
                                        zenity --error \
                                        --title="Error" --text="There was an error while\nDownloading and installing the Kernel!"
                        fi

fi
exit 0

Open a terminal:

Code: [Select]
touch kernelinstaller
copy the above code into kernelinstaller (open kernelinstaller with a Text Editor). Now save the file.

Code: [Select]
chmod +x kernelinstaller
gksudo ./kernelinstaller

There is no end dialogue, when the Zenity message has closed, you can reboot.

This is very Beta and as such, should only be installed in a VirtualBox. When you reboot, hold down Shift key to bring up Grub, go to Advanced, and you should see the Kernel in the list, select it and press enter.

To dos:

- Initial window "Install Kernel" and "Remove Kernel" select list
- Confirm kernel is installed dialogue
- Better output in zenity, percentage of install process (similar to updates-gui)
- Move just installed kernel to the top of the list in Grub before rebooting

You can use grub-customizer for now to move the kernel you chose to install, to the top of the Grub list.
Use Lite Tweaks to remove any kernels for now.

Any contributing code from dev's is welcome :)
Title: Re: Select Kernel Installer
Post by: Ottawagrant on May 28, 2016, 11:16:20 AM
Thank you for starting this. I have newer computer & older computers. The older computer really do like older kernels. On an older HP I installed the LL kernel from 2.0 onto 2.8 & the computer just hummed along. Understood that it's Beta, so I'll just make a note of it for now. This really helps for people who want to use LL 3.0 to 3.8.
Title: Re: Select Kernel Installer
Post by: Jerry on May 28, 2016, 07:55:14 PM
You can use this now to install a kernel, but that's all it does.
Title: Re: Select Kernel Installer
Post by: firenice03 on June 03, 2016, 08:48:49 AM
Must say this is pretty slick tool...
I installed to the Mini - Running LL3.0 32bit.. Yes on a non-VM system.... Tried both 3.18 and 3.16..
Have a systemback back up on the in-case and am ok if I would have to start over..


I installed mainly to test for better hardware support for the USB WiFi.. For a rtl8192cu
On a note; I haven't seen any differences between the kernels as far as the hardware but the installer tool works really well.
Title: Re: Select Kernel Installer
Post by: Jerry on June 03, 2016, 09:03:15 AM
@firenice03, thanks for testing.
Title: Re: Select Kernel Installer
Post by: firenice03 on July 25, 2016, 09:23:48 PM
Cause I like the tool :) I added the lines for kernel 4.7...

I just copied any 4.6 line and replaced the 4.6 with 4.7.. Should it work or not  :P but its downloading - something..
I'm again testing on the Mini... Others as Jerry suggests, for virtual box use...

Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Lite Kernel Select
# Description: Select a Linux Kernel to install on Linux Lite.
# Authors:  Jerry Bezencon
# Website: https://www.linuxliteos.com
#--------------------------------------------------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
fi

if [ ! -z "$(pgrep gdebi-gtk)" ]
then
   killall -9 gdebi-gtk
fi

# Set the window icon variable
ic="/usr/share/icons/zenity-llcc.png"

# Set the Title bar variable
tb="Lite Kernel Select"

# Download message variable
dl="Downloading and installing Kernel"

# Update package list
zenity --question --title="$tb" --window-icon="$ic" --text="We will now fetch the Updates list.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

    APTUPDATE=$(grep '^deb' -c /etc/apt/sources.list) # Total of repositories registered, this is approximated
    sudo apt-get update 2>&1 | awk -v total=$APTUPDATE '/^Ign|^ Get/{count++;$1=""} FNR { if (total != 0){percentage=int (100*count/total);print (percentage < 90?percentage:90),"\n#",substr($0, 0, 128) }; fflush(stdout)}' \
      | zenity --progress --text="Updating package lists..." --window-icon=$ic --title="Updating Software Sources - please wait..." --percentage=0 --auto-close --width=600

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then

                                        unset APTUPDATE
                                        zenity --error \
                                        --title="Error" --text="$APPNAME couldn't fetch the package cache information lists."

                                        exit 1
                                fi
unset APTUPDATE

KERNLIST=$(zenity --title="Select a Kernel from the list" \
--height=300 --width="320" \
--list --radiolist --text "Select a Kernel to install:" \
--column "Select" --column "Kernel Version" \
FALSE "Kernel 3.15.0" \
FALSE "Kernel 3.16.0" \
FALSE "Kernel 3.17.0" \
FALSE "Kernel 3.18.0" \
FALSE "Kernel 3.19.0" \
FALSE "Kernel 4.0.0" \
FALSE "Kernel 4.1.0" \
FALSE "Kernel 4.2.0" \
FALSE "Kernel 4.3.0" \
FALSE "Kernel 4.4.0" \
FALSE "Kernel 4.5.0" \
FALSE "Kernel 4.6.0" \
FALSE "Kernel 4.7.0")

if [[ "$KERNLIST" =~ "Kernel 3.15.0" ]]; then
    apt-get install linux-headers-linuxlite-3.15.0 linux-image-linuxlite-3.15.0 -y | zenity --progress --title="$tb" --text="$dl 3.15.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.16.0" ]]; then
    apt-get install linux-headers-linuxlite-3.16.0 linux-image-linuxlite-3.16.0 -y | zenity --progress --title="$tb" --text="$dl 3.16.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.17.0" ]]; then
    apt-get install linux-headers-linuxlite-3.17.0 linux-image-linuxlite-3.17.0 -y | zenity --progress --title="$tb" --text="$dl 3.17.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.18.0" ]]; then
    apt-get install linux-headers-linuxlite-3.18.0 linux-image-linuxlite-3.18.0 -y | zenity --progress --title="$tb" --text="$dl 3.18.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 3.19.0" ]]; then
    apt-get install linux-headers-linuxlite-3.19.0 linux-image-linuxlite-3.19.0 -y | zenity --progress --title="$tb" --text="$dl 3.19.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.0.0" ]]; then
    apt-get install linux-headers-linuxlite-4.0.0 linux-image-linuxlite-4.0.0 -y | zenity --progress --title="$tb" --text="$dl 4.0.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.1.0" ]]; then
    apt-get install linux-headers-linuxlite-4.1.0 linux-image-linuxlite-4.1.0 -y | zenity --progress --title="$tb" --text="$dl 4.1.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.2.0" ]]; then
    apt-get install linux-headers-linuxlite-4.2.0 linux-image-linuxlite-4.2.0 -y | zenity --progress --title="$tb" --text="$dl 4.2.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.3.0" ]]; then
    apt-get install linux-headers-linuxlite-4.3.0 linux-image-linuxlite-4.3.0 -y | zenity --progress --title="$tb" --text="$dl 4.3.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.4.0" ]]; then
    apt-get install linux-headers-linuxlite-4.4.0 linux-image-linuxlite-4.4.0 -y | zenity --progress --title="$tb" --text="$dl 4.4.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.5.0" ]]; then
    apt-get install linux-headers-linuxlite-4.5.0 linux-image-linuxlite-4.5.0 -y | zenity --progress --title="$tb" --text="$dl 4.5.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.6.0" ]]; then
    apt-get install linux-headers-linuxlite-4.6.0 linux-image-linuxlite-4.6.0 -y | zenity --progress --title="$tb" --text="$dl 4.6.0, please standby..." --pulsate --auto-kill --auto-close


elif [[ "$KERNLIST" =~ "Kernel 4.7.0" ]]; then
    apt-get install linux-headers-linuxlite-4.7.0 linux-image-linuxlite-4.7.0 -y | zenity --progress --title="$tb" --text="$dl 4.7.0, please standby..." --pulsate --auto-kill --auto-close
            else
                                        zenity --error \
                                        --title="Error" --text="There was an error while\nDownloading and installing the Kernel!"
                        fi

fi
exit 0


Update
After letting run the better of an hour, the install box didn't close so I did and rebooted... Mini is on 4.7 so far so good after initial tests...
Title: Re: Select Kernel Installer
Post by: tomt on August 22, 2016, 06:25:07 PM
Thought this might be of interest.

http://www.infoworld.com/article/3109184/linux/its-time-to-upgrade-to-linux-471.html

And this.

  http://www.computerworld.com/article/3110504/linux/another-day-another-4600-lines-of-linux-kernel-code.html#tk.rss_all

On topic.
Title: Re: Select Kernel Installer
Post by: firenice03 on April 26, 2017, 09:46:57 PM
So I'm setting up a fresh install of 3.4 on the mini and going for 4.10 kernel = as I'm waiting for install.. I remembered how slick this tool was..

Curious if there was any traction?? Or something for the future??



Title: Re: Select Kernel Installer
Post by: Jerry on April 26, 2017, 10:43:02 PM
Probably not, when there is something like this - http://www.omgubuntu.co.uk/2017/02/ukuu-easy-way-to-install-mainline-kernel-ubuntu
Title: Re: Select Kernel Installer
Post by: ralphy on April 27, 2017, 12:32:14 AM
Hmmm... could it be considered as a Lite Tweak maybe? That application is for Mainline kernels and it will require adding PPAs and what not. A simple Lite Tweak addition could possibly cover this... the code is already there for the most part.
Title: Re: Select Kernel Installer
Post by: firenice03 on April 27, 2017, 12:40:23 AM
Kernel Removal is there, makes sense on to mimic the installer similarly...

Sure the terminal isn't hard to use - although I usually have to find the kernel thread for the exact commands..
The tool eases the process, especially for those apprehensive of running commands in terminal...

Title: Re: Select Kernel Installer
Post by: Jerry on April 27, 2017, 12:43:27 AM
Hmmm... could it be considered as a Lite Tweak maybe? That application is for Mainline kernels and it will require adding PPAs and what not. A simple Lite Tweak addition could possibly cover this... the code is already there for the most part.

Maybe  :P
Title: Re: Select Kernel Installer
Post by: ralphy on April 27, 2017, 01:10:09 AM
Hmmm... could it be considered as a Lite Tweak maybe? That application is for Mainline kernels and it will require adding PPAs and what not. A simple Lite Tweak addition could possibly cover this... the code is already there for the most part.

Maybe  :P

I tried to post the code proposal in the Dev section but it is giving me a 403 and doesn't let me post it. Anyways, we have the code already based off your work and it will only require your review and approval so that we can commit it at some point. I'm gonna attach it in a text file for your consideration.
Title: Re: Select Kernel Installer
Post by: Jerry on April 27, 2017, 03:32:11 AM
mod_security being over zealous :)
Title: Re: Select Kernel Installer
Post by: ralphy on May 03, 2017, 06:21:44 PM
Hi,

A soon to come update for Lite Tweaks will include an easy way to Install Linux Lite kernels as requested; Kernel Installer:

(http://i.imgur.com/9OAL31n.png)

(http://i.imgur.com/iiv1qDx.png)

(http://i.imgur.com/aVCKXEn.png)

(http://i.imgur.com/qptKxh2.png)

(http://i.imgur.com/cYva65a.png)

We have also updated Kernel Removal so that kernels firmware are also listed for removal, plus minor dialogs updates:

(http://i.imgur.com/KffjVpa.png)

(http://i.imgur.com/9VE1r5n.png)

(http://i.imgur.com/yK42THW.png)

Cheers all!
Title: Re: Select Kernel Installer
Post by: firenice03 on May 03, 2017, 07:05:57 PM
Looking good Ralphy!!!

Kudo's to you and the DEV team and Jerry too  ;)
Title: Re: Select Kernel Installer
Post by: Scott on May 03, 2017, 09:51:00 PM
 8) Great job!
Title: Re: Select Kernel Installer
Post by: torreydale on May 03, 2017, 10:45:50 PM
@ralphy,
The "Buy me a coffee" link (https://ko-fi.com/A71411RT) doesn't seem to be working right now.
Title: Re: Select Kernel Installer
Post by: zygmunto on May 04, 2017, 12:10:16 AM
You are the best,guys.
Title: Re: Select Kernel Installer
Post by: TMG1961 on May 04, 2017, 03:45:55 AM
Looks great
Title: Re: Select Kernel Installer
Post by: Ottawagrant on May 04, 2017, 07:51:50 AM
Thank you for this feature. This is an excellent addition to Linux Lite.
Title: Re: Select Kernel Installer
Post by: ralphy on May 05, 2017, 04:20:31 AM
@ralphy,
The "Buy me a coffee" link (https://ko-fi.com/A71411RT) doesn't seem to be working right now.

@torreydale seems their webserver had some downtime or something... I dunno  ???
Title: Re: Select Kernel Installer
Post by: ralphy on May 06, 2017, 05:49:57 PM
Hi,

A soon to come update for Lite Tweaks will include an easy way to Install Linux Lite kernels as requested; Kernel Installer:

(http://i.imgur.com/9OAL31n.png)

(http://i.imgur.com/iiv1qDx.png)

(http://i.imgur.com/aVCKXEn.png)

(http://i.imgur.com/qptKxh2.png)

(http://i.imgur.com/cYva65a.png)

We have also updated Kernel Removal so that kernels firmware are also listed for removal, plus minor dialogs updates:

(http://i.imgur.com/KffjVpa.png)

(http://i.imgur.com/9VE1r5n.png)

(http://i.imgur.com/yK42THW.png)


Kernel Installer has been included and released in the latest 2.0-0260 update. In that same way, we included additional checks and logging for Install Updates as described in this thread (https://www.linuxliteos.com/forums/installing-linux-lite/after-install-update-files-will-not-install/msg31796/#msg31796).

These additional checks and logging are also part of Kernel Installer and Kernel Remover tweaks. In case of errors, logging will be available to users with options to display and save the error log.

Cheers all!
Title: Re: Select Kernel Installer
Post by: TMG1961 on May 07, 2017, 03:42:19 AM
works great, used it to remove old kernels
Title: Re: Select Kernel Installer
Post by: ralphy on May 07, 2017, 07:52:49 AM
works great, used it to remove old kernels

That's good to hear. Thank you for your feedback :)
Title: Re: Select Kernel Installer
Post by: torreydale on May 07, 2017, 09:10:32 AM
So many improvements!  Things that would normally be saved for the next release.  It's good to have @ralphy on the team.  I kind of feel sorry for the people I introduced to Linux Lite who are still on the 2.x series.  But then I remember I rescued many of them from Vista and Windows 8.
Title: Re: Select Kernel Installer
Post by: Jerry on May 07, 2017, 09:12:37 AM
There are sooo many goodies on the way. By the time we hit Series 5.x we should have all the tools people need to completely manage their system via point & click :)
Title: Re: Select Kernel Installer
Post by: torreydale on May 07, 2017, 09:23:20 AM
Awesome!  That's good to hear!
Title: Re: Select Kernel Installer
Post by: ralphy on May 07, 2017, 09:34:02 AM
@torreydale I really appreciate it. It's is a team work though; Jerry deserves as much credit if not more :)

Indeed, there has been quite a lot of work in the backend that we haven't even mentioned.
Title: Re: Select Kernel Installer
Post by: torreydale on May 07, 2017, 09:38:47 AM
You guys are putting out hits like Lennon and McCartney.
Title: Re: Select Kernel Installer
Post by: Jerry on May 07, 2017, 09:53:37 AM
Although the command line is very useful, there should be no need to go into it. If Windows can keep its users out for the most part, so can we!
Title: Re: Select Kernel Installer
Post by: bayoubooger on May 07, 2017, 10:01:56 AM
Although the command line is very useful, there should be no need to go into it. If Windows can keep its users out for the most part, so can we!

You and the team continue to do an excellent job making Lite very user friendly and I  pass the word around to people looking for a change from Windows. Keep it up and live long...
Title: Re: Select Kernel Installer
Post by: firenice03 on May 07, 2017, 10:59:39 AM
Kudos again!!! - I'll be updating shortly :)
Title: Re: Select Kernel Installer
Post by: Jocklad on May 07, 2017, 12:54:19 PM
Great stuff.

Thanks to all the Team for there hard work.  :)