Posts: 735
Threads: 94
Joined: Mar 2016
12-24-2016, 10:58 PM
(This post was last modified: 12-26-2016, 11:27 AM by Vector.
Edit Reason: Typos
)
Feel free to use it if you think it's useful.
Code: #!/bin/bash
if [[ "$EUID" -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
function logo()
{ echo " _____ _____ "
echo "| | |___ ___ ___| |___ ___ "
echo "| -| -_| _| | | | | .'| |"
echo "|__|__|___|_| |_|_|_|_|_|__,|_|_|"
printf "\nKernMan - Kernel Management Assistant.\n"
}
logo
function usage()
{ printf "\nKernMan is a script written for the purpose of simplifying Kernel Management.
Select the option 'List' to display all installed kernels select the option 'Purge' to display
all kernels that can be removed and subsequently do so\n\n"
}
PS3='Please enter your choice: '
options=("Usage" "List" "Purge" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Usage")
usage
;;
"List")
dpkg -l linux-image-\* | grep ^ii
;;
"Purge")
kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver
printf "\nThese items will be deleted.\n"
read -p 'Continue? Y/n ' choice
if [[ $choice == "y" ]]; then
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
else
echo "Aborted"
break
exit 1
fi
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
Posts: 219
Threads: 32
Joined: Jun 2015
Was this something you wrote? Looks really clean, good job!
Posts: 735
Threads: 94
Joined: Mar 2016
12-26-2016, 11:02 AM
(This post was last modified: 12-26-2016, 11:23 AM by Vector.)
(12-25-2016, 07:54 PM)NO-OP Wrote: Was this something you wrote? Looks really clean, good job!
Yes it was, although i had to look up some commands it's my script.
I put it up on github as well you can find it by clicking here.
Posts: 18
Threads: 0
Joined: Dec 2016
This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Posts: 417
Threads: 19
Joined: Jun 2015
(12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Well, he said you are free to use it if you want so I suppose you can use it for your company too 
"Feel free to use it if you think it's useful."
Posts: 219
Threads: 32
Joined: Jun 2015
(12-30-2016, 08:58 PM)enmafia2 Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Well, he said you are free to use it if you want so I suppose you can use it for your company too 
"Feel free to use it if you think it's useful."
Yeah if you want to use something professionally you're going to want a license. It would be super easy to sue someone over something like that and he would lose his job over using a script that didn't have a proper license.
Posts: 735
Threads: 94
Joined: Mar 2016
12-30-2016, 10:52 PM
(This post was last modified: 12-30-2016, 11:18 PM by Vector.)
(12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Thank you for asking, you can freely distribute, modify and use this code for any purpose you should desire. If someone asks where you got it from though i would appreciate a shoutout to my github  That's all i really would like in return.
(12-30-2016, 09:07 PM)NO-OP Wrote: (12-30-2016, 08:58 PM)enmafia2 Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Well, he said you are free to use it if you want so I suppose you can use it for your company too 
"Feel free to use it if you think it's useful."
Yeah if you want to use something professionally you're going to want a license. It would be super easy to sue someone over something like that and he would lose his job over using a script that didn't have a proper license.
It is now published under the GNU General Public License. See my github for details. But i am sure everyone here is familiar with it
Posts: 18
Threads: 0
Joined: Dec 2016
(12-30-2016, 10:52 PM)Vector Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Thank you for asking, you can freely distribute, modify and use this code for any purpose you should desire. If someone asks where you got it from though i would appreciate a shoutout to my github That's all i really would like in return.
(12-30-2016, 09:07 PM)NO-OP Wrote: (12-30-2016, 08:58 PM)enmafia2 Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Well, he said you are free to use it if you want so I suppose you can use it for your company too 
"Feel free to use it if you think it's useful."
Yeah if you want to use something professionally you're going to want a license. It would be super easy to sue someone over something like that and he would lose his job over using a script that didn't have a proper license.
It is now published under the GNU General Public License. See my github for details. But i am sure everyone here is familiar with it 
I put the quotes into the spoiler.
Thank you very much Vector, this is compatible with the usage at work. Of course, I will attribute it if anyone asks.
And NO-OP is correct. I would indeed need a license to use it.
Code is copyrighted material. Without a proper license, I cannot use it at work, as I would be violating copyright law.
This would indeed be very, very, very bad for my job if someone notices.
If they sue us, there's a chance I could also be sued -- it was me who committed the violation, and if I had committed the violation, there was no real agreement signed, so I could be opening myself up for some personal liability there. IANAL, but an abundance of caution is a good idea generally anyways.
Posts: 735
Threads: 94
Joined: Mar 2016
(12-31-2016, 12:01 PM)VenAAX Wrote:
(12-30-2016, 10:52 PM)Vector Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Thank you for asking, you can freely distribute, modify and use this code for any purpose you should desire. If someone asks where you got it from though i would appreciate a shoutout to my github That's all i really would like in return.
(12-30-2016, 09:07 PM)NO-OP Wrote: (12-30-2016, 08:58 PM)enmafia2 Wrote: (12-30-2016, 05:50 PM)VenAAX Wrote: This might actually be useful for me (at work).
Do you mind if I use this for business reasons? It will not be distributed with any products, only as a use within the company, limited to the VMs that I deploy and have a personal purview over.
I will only use it with permission, ofc.
I have to ask permission as it does not have a license attached to it.
Well, he said you are free to use it if you want so I suppose you can use it for your company too 
"Feel free to use it if you think it's useful."
Yeah if you want to use something professionally you're going to want a license. It would be super easy to sue someone over something like that and he would lose his job over using a script that didn't have a proper license.
It is now published under the GNU General Public License. See my github for details. But i am sure everyone here is familiar with it 
I put the quotes into the spoiler.
Thank you very much Vector, this is compatible with the usage at work. Of course, I will attribute it if anyone asks.
And NO-OP is correct. I would indeed need a license to use it.
Code is copyrighted material. Without a proper license, I cannot use it at work, as I would be violating copyright law.
This would indeed be very, very, very bad for my job if someone notices.
If they sue us, there's a chance I could also be sued -- it was me who committed the violation, and if I had committed the violation, there was no real agreement signed, so I could be opening myself up for some personal liability there. IANAL, but an abundance of caution is a good idea generally anyways.
Happy to help out, may it save you lots of valuable time at work!
|