Commit Graph

222 Commits

Author SHA1 Message Date
a3524e8207 remove-old-kernels: Change confirmation logic
Handle confirmation dialog in remove-old-kernels deterministically and always
pass `-y' to apt-get. By this we can be sure that confirmation is always asked.
(Because apt-get could skip its confirmation dialog.) Also, `--force' is not
(and never was) contradictory with `--dry-run'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 09:12:04 +03:00
894ef55a81 remove-old-kernels: Add some colors to the formula
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 08:00:50 +03:00
e5d9bc74ba remove-old-kernels: Keep previously booted kernel with reasonable uptime
Link: https://bugzilla.altlinux.org/43062
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
7d47e9beb8 remove-old-kernels: Better show to user what is happing
Also show what is not deleted and why. So user see decision about all the
kernels in the system.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
27e4f75969 remove-old-kernels: Simplify removal version selection logic
'rpmevrcmp' is not needed since we don't output epoch there, thus simple version
sort with `sort -V` is enough.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
8d62291d77 remove-old-kernels: Simplify current_kernel_pkgname more
'current_kernel_pkgname' is used only to briefly inform user, thus epoch is not needed.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
f4f0c8a764 Showing '--help' should exit 0
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
872cf5c2bb remove-old-kernels: Add test run to Dockerfile
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
c060309cd9 remove-old-kernels: Add '--verbose' option
To show 'apt-get' commands.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 07:50:41 +03:00
76991851aa remove-old-kernels: Simplify getting flavour list
Remove superfluous calls to 'grep' and 'tr'. Also, exclude "new" 'debuginfo'
packages along 'domU'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 01:46:22 +03:00
bfbe1212cf remove-old-kernels: Fix excluding current kernel from deletion
It could have excluded 'alt11' if current kernel is 'alt1'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 01:31:58 +03:00
4a00d27a2b remove-old-kernels: Fix conversion of kernelrelease (V-F-R) to package's F-V-R format
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 01:29:18 +03:00
55432dea39 remove-old-kernels: Call uname -r just once
Based-on: 418d724 ("update-kernel: Call uname -r just once")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 01:15:45 +03:00
b0c8b44d5e remove-old-kernels: Do not use grep to fix EVR
Based-on: 0da831a ("update-kernel: Do not use grep to fix EVR and improve Running kernel message")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-26 01:12:49 +03:00
795da00a2f 1.2.2-alt1
- update-kernel: Add --add (-A) option(s) to install external module.
2022-06-19 21:33:26 +03:00
d4d8e0b854 update-kernel: Add CLI option to add a module
This can be used, for example, as:

  # update-kernel -H -A virtualbox

instead of post-installing:

  # apt-get install kernel-headers-std-def kernel-headers-modules-std-def kernel-modules-virtualbox-std-def

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-19 21:30:56 +03:00
06e77c8d23 Dockerfile: Update dates to make tests work again
Date earlier than 2022/05/19 produce an error:

  + update-kernel -v -f --headers
  Running kernel: 5.17.15-un-def-alt1 is not from package
  Checking for available std-def kernel packages...
  Latest kernel is kernel-image-std-def-5.15.40-alt1
  ATTENTION: Selected kernel is 1 months old.
  Kernel std-def version 5.15.40-alt1 has 43 external modules. Use -i to select what to install.
  Try to install new kernel kernel-image-std-def-5.15.40-alt1 and update its modules [Y/n]? yes
  + apt-get install -o APT::Install::Virtual=true -y kernel-image-std-def#2:5.15.40-alt1:sisyphus+300020.100.1.1@1652646109 kernel-headers-std-def kernel-headers-modules-std-def
  Reading Package Lists...
  Building Dependency Tree...
  Some packages could not be installed. This may mean that you have
  requested an impossible situation or if you are using the unstable
  distribution that some required packages have not yet been created
  or been moved out of Incoming.
  The following information may help to resolve the situation:

  The following packages have unmet dependencies:
    kernel-headers-modules-std-def: Depends: gcc11
  E: Broken packages
  update-kernel: failed to install kernel-image-std-def-2:5.15.40-alt1:sisyphus+300020.100.1.1@1652646109 with modules
  The command '/bin/bash -xec toilet -w 150 First install &&     update-kernel -v -f --headers &&     ls -l /boot/vmlinuz /boot/vmlinuz-std-def /boot/initrd.img /boot/initrd-std-def.img &&     ls -l /boot/$(readlink /boot/vmlinuz)' returned a non-zero code: 1
  make: *** [Makefile:8: docker-build] Error 1

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-19 21:22:35 +03:00
b0cfbb4183 1.2.1-alt2
- update-kernel: Minor spelling fixes.
2022-05-23 18:21:21 +03:00
9fcf16ce9e update-kernel: Spelling fixes
Reported-by: Andrew A. Vasilyev <andy@altlinux.org>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-05-23 18:19:31 +03:00
353d374a44 1.2.1-alt1
- update-kernel: Do not suggest fresher flavour. (ALT#42400)
2022-04-12 15:31:20 +03:00
51483087c5 update-kernel: Do not suggest fresher flavour
This confuses users. (ALT#42400)

Link: https://bugzilla.altlinux.org/42400
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-12 15:29:40 +03:00
81c14918c3 1.2-alt1
- Improve wording of some messages.
- Add experimental analyze-kmodules tool.
2022-04-11 04:06:07 +03:00
a71ce45218 analyze-kmodules: Add tool to compare modules between kernels
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-10 09:11:13 +03:00
c4157d4f5a update-kernel: Improve working about latest kernel
It's referred later as 'selected kernel' but user should know it's 'latest'

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-10 09:09:45 +03:00
1a4c7b206f update-kernel: Suggest user to not install if there aren't some external modules
Example of such module is zfs.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-10 08:37:24 +03:00
4bde3fdaa1 1.1.1-alt1
- Minor improvements.
2022-04-10 01:05:53 +03:00
2390600984 update-kernel: Actually pass --dry-run to apt-get install
Use `--dry-run' instead of `--download-only'.
We just about to use `--download-only' for something else.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-09 13:25:08 +03:00
3c97a575dd update-kernel: Allow to define system flavour for testing purposes
For Docker CI test.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-09 10:57:03 +03:00
240e64218c update-kernel: Sanitize some variables
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-09 10:50:38 +03:00
Andrew A. Vasilyev
92192ef950 update-kernel: Unify yes/no prompt with apt-get one 2022-04-08 17:37:23 +03:00
7a4048c909 1.1-alt1
- Add '--headers' option to update-kernel to install kernel-headers.
- Check presence of external modules in the selected kernel.
2022-04-08 09:02:07 +03:00
9c7ef6e0c5 update-kernel: Check presence of external modules in the selected kernel
Only same and booted flavours are checked (not the other flavours as this
would not be useful).

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 09:02:07 +03:00
00285b327a update-kernel: Reformat warning messages and modules list
- Remove indentation from 'ATTENTION' warning, because it breaks presentation
  of modules lists (as in ugly).
- Show installing external modules list in apt'ish manner to which user is
  already familiar.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 09:00:48 +03:00
c07a270da4 update-kernel: Do not suggest to use '-i' if there's no modules
Try to not confuse a user.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 08:48:17 +03:00
0dfff0192f update-kernel: Cleanup ALLMODULES list from spaces
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 08:48:17 +03:00
bf62807e8d update-kernel: Fix calculation of number of modules
This happens because `a=$(...)` assignment eats last newline, then if we `echo
"$a" | wc -l` we miss `0` lines (because there's always 1 empty line) and if we
`echo -n "$a" | wc -l` we get `n-1` lines.

So just count words instead of lines.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 08:47:23 +03:00
c8da9f830f update-kernel: '--headers' to install kernel-headers
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 04:31:17 +03:00
bfb7292201 1.0.1-alt1
- Rework interactive mode UI (ALT#42321).
- '-i' can be used at any time to add new modules to the system.
- Interactive module selection happen before kernel install.
- Install kernel-headers and external modules together with the kernel in one
  transaction.
- Colorize & brighten some important messages.
- Call sync after install.
2022-04-08 01:33:11 +03:00
4fab0940fa update-kernel: Add undocumented '--reinstall' option
This will pass `--reinstall' to `apt-get install'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 01:28:09 +03:00
390e0d427a update-kernel: Change module selection interactive mode UI
Use (bash) select by a number instead of asking about every module. Should be
easier to select a few modules and does not require extreme attentiveness.

Allow to use standalone `-i' option to add modules to the system.

`-a' is not required to be used tith `-i' anymore.

Install confirmation prompt is moved after modules selection and just before
apt-get install itself.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 01:28:09 +03:00
336960b843 Makefile: Update Docker targets
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 01:28:09 +03:00
a6b8d3ef66 update-kernel: Do interactive things before install
First ask user about kernel and modules, then install everything in one
transaction.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-08 01:28:09 +03:00
94d908771a update-kernel: Interactive mode implies (try to install) all modules
This should make interactive mode more useful and intuitive.

Link: https://bugzilla.altlinux.org/42321
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
973b740da2 update-kernel: Show if user aborted install at the confirmation prompt
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
f8f27a7078 update-kernel: Call sync after kernel install and before exiting
Proper reboot will sync, but there are other reboot possibilities.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
b6691942b3 update-kernel: Brighten kernel version/package name
Bright attention of user to the right thing.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
5add649948 update-kernel: Colorize stalled kernel/pkglist warnings
Also, suggest how to find a better flavour.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
749f7abc57 update-kernel: No not rephrase '[y]/n' choice if it's retried
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
131b59edad update-kernel: Remove obsolete APT::Install::VirtualVersion=true
APT::Install::VirtualVersion seems removed in 2004 in apt commit 0501f88ac
("0.5.15cnc5-alt1").

Fixes: b1409ed ("force select newest kernel module package (ALT bug #22572)")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
2029c44606 update-kernel: Add undocumented --verbose option
Show executed apt-get commands.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00