sysupdate script: keep track of failures

This commit is contained in:
LordMZTE 2023-11-14 13:29:27 +01:00
parent 6abcccb08a
commit ca4d26eec6
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -8,12 +8,15 @@
#:usage-help "Update the system"
#:once-each [("-n" "--noint") "Don't require user interaction" (noint #t)])
(define failures '())
(define (cmd exe . args)
(match (find-executable-path exe)
[#f (printf "skipping command ~a, command not found\n" (cons exe args))]
[exepath
(printf ">>> ~a\n" (cons exe args))
(apply system* exepath args)]))
(match* ((find-executable-path exe) (cons exe args))
[(#f argv) (printf "skipping command ~a, command not found\n" argv)]
[(exepath argv)
(printf ">>> ~a\n" argv)
(unless (apply system* exepath args)
(set! failures (cons argv failures)))]))
(apply cmd (if (noint)
'("paru" "-Syu" "--noconfirm")
@ -22,3 +25,6 @@
(cmd "rustup" "update")
(cmd "update-nvim-plugins")
(cmd "tldr" "--update")
(unless (empty? failures)
(raise-user-error "The following commands failed:" failures))