178 Commits

Author SHA1 Message Date
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
13c7b3e673 update-kernel: Install kernel-headers-modules together with the kernel
Also, if there's dkms -- force install of kernel-headers-modules
because dkms may just need it in the filetrigger.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
8e7e6ca193 Remove dependence on libshell
Trying to minimize dependence. No need whole library for three simple logging
functions (which used as basic `echo' wrappers).

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-07 08:21:47 +03:00
19895d28ac Add .editorconfig 2022-04-06 01:54:45 +03:00
e460bb4727 0.9.21-alt1
- Tools cannot be used under user anymore because sudo sub-invocation is
  removed (call them under root instead).
- Require explicit yes or enter to start installation (previously any key work
  work except no).
- Improve package version comparison (ALT#42149).
- Do not show epoch and disttag in package names.
- Warn user if installed package (1 month) or APT database (1 day) are stalled.
- Do not require install of 'apt-scripts' for package availability mark in
  list mode.
- Show package age in list mode.
2022-04-04 11:01:03 +03:00
5b3f4303f7 update-kernel: Remove package is not installed warning
Example message on stderr:

  package kernel-image-un-def-1:5.16.18-alt1:sisyphus+297403.100.1.1@1648473578 is not installed

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 11:01:03 +03:00
59072f6e9e update-kernel: Show packages age in list mode
Example:

  + update-kernel -l
  List of available kernels:
    *  (16 d) kernel-image-rt-5.10.106-alt1.rt64
    *   (4 d) kernel-image-std-def-5.15.32-alt2
      (380 d) kernel-image-un-def-5.11.7-alt1 [installed] | drm
    *   (6 d) kernel-image-un-def-5.16.18-alt1
  [*] Latest available in repo. (d) Package age in days.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
e7301f6828 update-kernel: Use policy to detect available packages (list)
It's much slower but works even if `apt-scripts' is not installed.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
476bdba5b6 update-kernel: Check freshness of the selected kernel
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
447e886710 update-kernel: Check freshness of non-upgradable kernel
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
5fc8e0cac2 update-kernel: Check staleness of APT database
Perhaps, APT database should be updated every day.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
06a286d46f update-kernel: Show user-friendly version instead of EVRDT
Do not scare user with EVRDT. She basically needs to know just a flavour
and version-release.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
4729d23fcc update-kernel: Do not output EPOCH in the running kernel package name
Also, previous commit made current_kernel_pkgname unused later..

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
60f749af9b update-kernel: Remove Latest kernel is already running check
It's redundant (by the following check) and is not worked since disttag anyway.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
8980c36f9d update-kernel: Improve rpmevrcmp usage with buildtime comparison
Use buildtime when rpmevrcmp match. This will allow to install newer kernel of
the same EVR.

Link: https://bugzilla.altlinux.org/show_bug.cgi?id=42149
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
0da831a46b update-kernel: Do not use grep to fix EVR and improve Running kernel message
Just a cleanup of this particular code block.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
418d724515 update-kernel: Call uname -r just once
This is just cleanup.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
5fa514c1a3 Add Dockerfile for local testing
Run: docker build .

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
b2d4a3d06c Fix typos reported by codespell 2022-04-04 10:29:45 +03:00
b4d73d9150 update-kernel: Update header and copyright lines 2022-04-04 10:29:45 +03:00
af7b7e9d0b update-kernel: Force sane yes/no logic for install choice
Do not treat non-'yes'/'no' answers as 'yes', except for a enter (which is
default choice - 'yes'). User's cat may accidentally press garbage and this
should not be treated as 'yes'. Also, treat `^D' as 'no'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
930c38e5e5 Fix multiple shellcheck warnings
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-04-04 10:29:45 +03:00
725f623e1c Add shellcheck to %check 2022-04-04 10:29:45 +03:00
e679bb04e1 Do not use sudo
No need such hacks. User should call `update-kernel` under root.
This usage is also suggested in ALT wiki.
2022-04-03 03:30:17 +03:00
3658e98500 Rename update_kernel_modules_cetus.sh to update-kernel 2022-04-03 02:34:01 +03:00
de817103b8 Remove unused apt-upgrade-kernel script 2022-04-03 02:34:01 +03:00
c447c1c21f 0.9.20-alt1
- update-kernel: Fix and improve -r option (closes: #39041).
- update-kernel: Add --list option.
2020-11-21 04:32:50 +03:00
e2306bed4f update-kernel: Add experimental '--list' option to show available kernels 2020-11-19 06:03:10 +03:00
aef906ee19 update-kernel: Fix and improve -r logic
- Allow setting release in old (backward compatibility) format (release or
  version-release). This was broken since `@buildtime' is added (few
  years ago) to the `apt-cache pkgnames' output. Then it did not become
  better when `:disttag' is added to the output recently.

- Allow setting release in `uname -r' compatible format:
    version-flavour-release.

- Allow setting release in package name format, RPM style:
    [kernel-image-]flavour-[epoch:]version-release or APT style:
    [kernel-image-]flavour=[epoch:]version-release,
    [kernel-image-]flavour#[epoch:]version-release.
  This is for future `--list' option.

Fixes: Bug#39041.
2020-10-15 16:49:42 +03:00
0f3ea5fc33 Fix invalid install attempt on partial type/release match
# update-kernel -r alt
  Running kernel version: kernel-image-std-def-1:5.4.57-alt1
  Checking for available kernel packages...
  package kernel-image-std-def- is not installed
  Try to install new kernel kernel-image-std-def- and update its modules [y]/n?

  # update-kernel -t alt
  Running kernel version: kernel-image-std-def-1:5.4.57-alt1
  Checking for available kernel packages...
  package kernel-image-alt- is not installed
  Try to install new kernel kernel-image-alt- and update its modules [y]/n?
2020-10-12 15:53:26 +03:00
9dcb8e5e63 0.9.19-alt1
- update-kernel: fix incorrect comparison of versions of duplicate modules
  (closes: #38772)
2020-08-03 16:31:22 +03:00
6fe1408598 update-kernel: fix incorrect comparison of versions of duplicate modules 2020-08-03 16:25:02 +03:00
aaf7e8cdab 0.9.18-alt1
- Support for single word kernel flavours
- Update license tag to be more specific
2020-02-23 21:42:49 +03:00
eb6ddc1e4c Support for single word kernel flavours 2020-02-12 16:30:43 +03:00
a659aa4fb4 0.9.17-alt1
- update-kernel: remove duplicates modules entries (Closes: #37690)
2019-12-30 12:07:28 +03:00
4d442fd10f update-kernel: remove duplicates modules entries 2019-12-30 11:41:11 +03:00
Oleg Solovyov
d83933ecdf 0.9.16-alt1
- NMU: do not call apt when there are no kernels to remove
2019-12-20 14:49:20 +03:00
Oleg Solovyov
b5ca07e13f do not waste time invoking apt when there is nothing to remove 2019-12-20 14:48:28 +03:00
Oleg Solovyov
baa9ff7a1a 0.9.15-alt1
- NMU: protect latest kernel from removing (Closes: #34314)
- NMU: add "-a|--all" option to remove kernels with all flavours
  (Closes: #34141)
2019-12-19 16:32:40 +03:00
Oleg Solovyov
a55e5bb48e scan flavours and remove all old kernels 2019-12-19 16:30:51 +03:00
Oleg Solovyov
5e37d67ac1 remove-old-kernels: check for latest kernel
ALTBUG: #34314
When flavor specified, find out which kernel is latest and protect it
from removing.
2019-12-19 11:38:46 +03:00
Ivan Zakharyaschev
215df3e309 0.9.14-alt1
- update-kernel: fixed in the presence of disttags in package IDs
  printed by APT (apt-cache pkgnames).
2019-06-05 12:27:34 +03:00
Ivan Zakharyaschev
ca0d460ec3 update-kernel: simplify the conversion of apt pkgnames for rpm -q (preparation for disttags)
rpm-4.13 doesn't need the deleteion of Epoch in the argument for rpm -q.

The old pattern won't work well in the presence of disttags.

(rpm-4.0.4 in p8 is about to be patched to accept such arguments, too.)
2019-06-05 12:27:34 +03:00
Ivan Zakharyaschev
158349bacc (.spec) drop Packager: Vladimir V Kamarzin vvk@ (inactive for more than 7 years) 2019-06-05 11:29:25 +03:00
Ivan Zakharyaschev
20f793eb23 0.9.13-alt1
- remove-old-kernels: APT invocation (to remove installed pkgs) rewritten in
  a more portable way. (A preparation for APT with support for disttags.)
2019-05-28 14:28:08 +03:00