mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
guix system: Add 'delete-generations'.
* guix/scripts/package.scm (delete-matching-generations): Export. * guix/scripts/system.scm (show-help): Add 'delete-generations'. (process-command): Honor it. (guix-system): Support it. * doc/guix.texi (Invoking guix system): Document it.
This commit is contained in:
parent
7b9b203a52
commit
499b166d1c
3 changed files with 42 additions and 2 deletions
|
@ -23038,6 +23038,32 @@ Currently, as with @command{switch-generation}, you must reboot after
|
||||||
running this action to actually start using the preceding system
|
running this action to actually start using the preceding system
|
||||||
generation.
|
generation.
|
||||||
|
|
||||||
|
@item delete-generations
|
||||||
|
@cindex deleting system generations
|
||||||
|
@cindex saving space
|
||||||
|
Delete system generations, making them candidates for garbage collection
|
||||||
|
(@pxref{Invoking guix gc}, for information on how to run the ``garbage
|
||||||
|
collector'').
|
||||||
|
|
||||||
|
This works in the same way as @command{guix package --delete-generations}
|
||||||
|
(@pxref{Invoking guix package, @code{--delete-generations}}). With no
|
||||||
|
arguments, all system generations but the current one are deleted:
|
||||||
|
|
||||||
|
@example
|
||||||
|
guix system delete-generations
|
||||||
|
@end example
|
||||||
|
|
||||||
|
You can also select the generations you want to delete. The example below
|
||||||
|
deletes all the system generations that are more than two month old:
|
||||||
|
|
||||||
|
@example
|
||||||
|
guix system delete-generations 2m
|
||||||
|
@end example
|
||||||
|
|
||||||
|
Running this command automatically reinstalls the bootloader with an updated
|
||||||
|
list of menu entries---e.g., the ``old generations'' sub-menu in GRUB no
|
||||||
|
longer lists the generations that have been deleted.
|
||||||
|
|
||||||
@item build
|
@item build
|
||||||
Build the derivation of the operating system, which includes all the
|
Build the derivation of the operating system, which includes all the
|
||||||
configuration files and programs needed to boot and run the system.
|
configuration files and programs needed to boot and run the system.
|
||||||
|
|
|
@ -55,6 +55,7 @@ (define-module (guix scripts package)
|
||||||
#:autoload (gnu packages bootstrap) (%bootstrap-guile)
|
#:autoload (gnu packages bootstrap) (%bootstrap-guile)
|
||||||
#:export (build-and-use-profile
|
#:export (build-and-use-profile
|
||||||
delete-generations
|
delete-generations
|
||||||
|
delete-matching-generations
|
||||||
display-search-paths
|
display-search-paths
|
||||||
guix-package))
|
guix-package))
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ (define-module (guix scripts system)
|
||||||
#:use-module (guix profiles)
|
#:use-module (guix profiles)
|
||||||
#:use-module (guix scripts)
|
#:use-module (guix scripts)
|
||||||
#:use-module (guix scripts build)
|
#:use-module (guix scripts build)
|
||||||
|
#:autoload (guix scripts package) (delete-generations
|
||||||
|
delete-matching-generations)
|
||||||
#:use-module (guix graph)
|
#:use-module (guix graph)
|
||||||
#:use-module (guix scripts graph)
|
#:use-module (guix scripts graph)
|
||||||
#:use-module (guix build utils)
|
#:use-module (guix build utils)
|
||||||
|
@ -962,10 +964,12 @@ (define (show-help)
|
||||||
reconfigure switch to a new operating system configuration\n"))
|
reconfigure switch to a new operating system configuration\n"))
|
||||||
(display (G_ "\
|
(display (G_ "\
|
||||||
roll-back switch to the previous operating system configuration\n"))
|
roll-back switch to the previous operating system configuration\n"))
|
||||||
|
(display (G_ "\
|
||||||
|
list-generations list the system generations\n"))
|
||||||
(display (G_ "\
|
(display (G_ "\
|
||||||
switch-generation switch to an existing operating system configuration\n"))
|
switch-generation switch to an existing operating system configuration\n"))
|
||||||
(display (G_ "\
|
(display (G_ "\
|
||||||
list-generations list the system generations\n"))
|
delete-generations delete old system generations\n"))
|
||||||
(display (G_ "\
|
(display (G_ "\
|
||||||
build build the operating system without installing anything\n"))
|
build build the operating system without installing anything\n"))
|
||||||
(display (G_ "\
|
(display (G_ "\
|
||||||
|
@ -1202,6 +1206,14 @@ (define (process-command command args opts)
|
||||||
(apply (resolve-subcommand "search") args))
|
(apply (resolve-subcommand "search") args))
|
||||||
;; The following commands need to use the store, but they do not need an
|
;; The following commands need to use the store, but they do not need an
|
||||||
;; operating system configuration file.
|
;; operating system configuration file.
|
||||||
|
((delete-generations)
|
||||||
|
(let ((pattern (match args
|
||||||
|
(() "")
|
||||||
|
((pattern) pattern)
|
||||||
|
(x (leave (G_ "wrong number of arguments~%"))))))
|
||||||
|
(with-store store
|
||||||
|
(delete-matching-generations store %system-profile pattern)
|
||||||
|
(reinstall-bootloader store (generation-number %system-profile)))))
|
||||||
((switch-generation)
|
((switch-generation)
|
||||||
(let ((pattern (match args
|
(let ((pattern (match args
|
||||||
((pattern) pattern)
|
((pattern) pattern)
|
||||||
|
@ -1228,7 +1240,8 @@ (define (parse-sub-command arg result)
|
||||||
(let ((action (string->symbol arg)))
|
(let ((action (string->symbol arg)))
|
||||||
(case action
|
(case action
|
||||||
((build container vm vm-image disk-image reconfigure init
|
((build container vm vm-image disk-image reconfigure init
|
||||||
extension-graph shepherd-graph list-generations roll-back
|
extension-graph shepherd-graph
|
||||||
|
list-generations delete-generations roll-back
|
||||||
switch-generation search docker-image)
|
switch-generation search docker-image)
|
||||||
(alist-cons 'action action result))
|
(alist-cons 'action action result))
|
||||||
(else (leave (G_ "~a: unknown action~%") action))))))
|
(else (leave (G_ "~a: unknown action~%") action))))))
|
||||||
|
|
Loading…
Reference in a new issue