Re: [PATCH] scripts: prune-kernel:remove old kernels and modules dir from system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22:27 Wed 30 Oct 2019, Randy Dunlap wrote:
On 10/30/19 9:52 PM, Bhaskar Chowdhury wrote:
That 'rm' doesn't remove any files.  Compare what remove_old_kernel() does.
No,it is not using that function rather take the parameter from the
commandline and get into boot dir match with it and remove it.

But it doesn't do that.  I tested it.  It should be more like what
rmeove_old_kernel() does:

        rm -If vmlinuz-$kernel_ver System.map-$kernel_ver config-$kernel_ver

and if not, please explain why not.
Okay, again some uniformity missing in the code, I would like to your
suggested method,i.e call remove_old_kernel to do the job instead of depending on individual kernel.

The simplest thing to do is set kernel_version=$kernel_ver
and then call remove_old_kernel().
And set modules_version=$modules_dir_name and call remove_old_modules_dir().

But it would be cleaner to pass a parameter (kernel_version) to the
remove_old_kernel() function and to pass a parameter (modules_dir) to the
remove_old_modules_dir() function.



Thank you...I have just modified the code and call both the function
under remove option. BTW I didn't set the extra variable $kernel_ver name it $kernel_version and instead of $modules_dir_name name it $mo
dules_version.

Capturing command line parameter in $kernel_version and $modules_version

Is that fine? Here is a code snippet:

-r | --remove)
  if [[ $# -ne 3 ]]; then
   printf "You need to provide kernel version and modules directory
   name \n"
   exit 1
   else
   remove_old_kernel
   remove_old_modules_dir
   fi


I have just test it and it works.


And about solitary r option without hypen is ignoring and doing nothing.

Means, if I pass ./scripts/prune-kernel r 5.3.3
it simply ignore and does nothing.Only with the hypen it can work.

--
~Randy

Bhaskar

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux