From 8b1c26dfddf10200dbd72be13322fdd835d257aa Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Sun, 9 Jan 2022 19:22:51 +0100
Subject: [PATCH 2/3] gnu: Add pmos-installer.
* gnu/packages/android.scm (pmos-installer): New variable.
@@ -11,7 +11,7 @@
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
-;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021, 2022 Petr Hodina <phodina@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,16 +32,25 @@ (define-module (gnu packages android)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (guix git-download)
#:use-module (guix build-system android-ndk)
#:use-module (guix build-system gnu)
#:use-module (guix build-system go)
#:use-module (guix build-system python)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system trivial)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
+ #:use-module (gnu packages admin)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpio)
#:use-module (gnu packages docker)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gnupg)
@@ -1268,3 +1277,64 @@ (define-public enjarify
applications. Enjarify can translate the Dalvik bytecode back to equivalent
Java bytecode, which simplifies the analysis of Android applications.")
(license license:asl2.0)))
+
+(define-public pmos-installer
+ (package
+ (name "pmos-installer")
+ (version "1.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.com/sdm845-mainline/pmos-installer")
+ (recursive? #t)
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0lbdk2453bywdibys35zyf1j27a1m11a7q8jvmgjf99v77l9rrbx"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("makeinstaller.sh" "bin/makeinstaller.sh") ("initrd"
+ "initrd"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'wrap-shellscript
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (substitute* (string-append out "/bin/makeinstaller.sh")
+ ;; Typo in name
+ ;; https://gitlab.com/sdm845-mainline/pmos-installer/-/issues/5
+ (("vmlinuz-") "vmlinuz")
+ ;; Path to initrd
+ (("\"\\$\\(dirname \"\\$0\"\\)\"") (string-append out)))
+ (wrap-program (string-append out "/bin/makeinstaller.sh")
+ `("PATH" ":" prefix
+ ,(append (map (lambda (dir)
+ (string-append (assoc-ref
+ inputs dir)
+ "/bin"))
+ '("coreutils" "cpio"
+ "grep"
+ "zip"
+ "mkbootimg"
+ "pmbootstrap"
+ "sudo"
+ "sed"
+ "util-linux"
+ "which")))))))))))
+ (inputs (list bash-minimal
+ coreutils
+ pmbootstrap
+ grep
+ util-linux
+ mkbootimg
+ cpio
+ zip
+ sed
+ which
+ sudo))
+ (home-page "https://gitlab.com/sdm845-mainline/pmos-installer")
+ (synopsis "Flashable installer for postmarketOS")
+ (description "This package provides a flashable installer for
+ postmarketOS.")
+ (license license:gpl3+)))
--
2.35.1