diff options
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/chromium-extension.scm | 18 | ||||
-rw-r--r-- | gnu/build/file-systems.scm | 24 |
2 files changed, 28 insertions, 14 deletions
diff --git a/gnu/build/chromium-extension.scm b/gnu/build/chromium-extension.scm index 8ca5251957..28449a1e1d 100644 --- a/gnu/build/chromium-extension.scm +++ b/gnu/build/chromium-extension.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org> +;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,10 +20,9 @@ (define-module (gnu build chromium-extension) #:use-module (guix gexp) #:use-module (guix packages) - #:use-module (gnu packages chromium) #:use-module (gnu packages gnupg) #:use-module (gnu packages tls) - #:use-module (gnu packages xorg) + #:use-module (gnu packages node-xyz) #:use-module (guix build-system trivial) #:export (make-chromium-extension)) @@ -69,24 +69,14 @@ in PACKAGE-OUTPUT of PACKAGE. The extension will be signed with SIGNING-KEY." (string-append name "-" version ".crx") (with-imported-modules '((guix build utils)) #~(begin - ;; This is not great. We pull Xorg and Chromium just to Zip and - ;; sign an extension. This should be implemented with something - ;; lighter. (TODO: where is the CRXv3 documentation..?) (use-modules (guix build utils)) - (let ((chromium #$(file-append ungoogled-chromium "/bin/chromium")) - (xvfb #$(file-append xorg-server "/bin/Xvfb")) + (let ((crx3 #+(file-append node-crx3 "/bin/crx3")) (packdir (string-append (getcwd) "/extension"))) (mkdir packdir) (copy-recursively (ungexp package package-output) packdir ;; Ensure consistent file modification times. #:keep-mtime? #t) - (system (string-append xvfb " :1 &")) - (setenv "DISPLAY" ":1") - (sleep 2) ;give Xorg some time to initialize... - (invoke chromium - "--user-data-dir=chromium-profile" - (string-append "--pack-extension=" packdir) - (string-append "--pack-extension-key=" #$signing-key)) + (invoke crx3 "--keyPath" #$signing-key packdir) (copy-file (string-append packdir ".crx") #$output)))) #:local-build? #t)) diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index b06a4cc25c..1d3b33e7bd 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -52,6 +52,8 @@ read-partition-uuid read-luks-partition-uuid + cleanly-unmounted-ext2? + bind-mount system*/tty @@ -193,6 +195,23 @@ NUL terminator, return the size of the bytevector." if DEVICE does not contain an ext2 file system." (read-superblock device 1024 264 ext2-superblock?)) +(define (ext2-superblock-cleanly-unmounted? sblock) + "Return true if SBLOCK denotes a file system that was cleanly unmounted, +false otherwise." + (define EXT2_VALID_FS 1) ;cleanly unmounted + (define EXT2_ERROR_FS 2) ;errors detected + + (define EXT3_FEATURE_INCOMPAT_RECOVER #x0004) ;journal needs recovery + + (let ((state (bytevector-u16-ref sblock 58 %ext2-endianness))) + (cond ((= state EXT2_VALID_FS) + (let ((incompatible-features + (bytevector-u32-ref sblock 96 %ext2-endianness))) + (zero? (logand incompatible-features + EXT3_FEATURE_INCOMPAT_RECOVER)))) + ((= state EXT2_ERROR_FS) #f) + (else (error "invalid ext2 superblock state" state))))) + (define (ext2-superblock-uuid sblock) "Return the UUID of ext2 superblock SBLOCK as a 16-byte bytevector." (sub-bytevector sblock 104 16)) @@ -220,6 +239,11 @@ errors. Otherwise, fix only those considered safe to repair automatically." (2 'reboot-required) (_ 'fatal-error))) +(define (cleanly-unmounted-ext2? device) ;convenience procedure + "Return true if DEVICE is an ext2 file system and if it was cleanly +unmounted." + (ext2-superblock-cleanly-unmounted? (read-ext2-superblock device))) + ;;; ;;; Linux swap. |