diff mbox series

[bug#49577] Add python-pmbootstrap

Message ID WUfW-YNF6KwD8sb_18og6t9o-GBvFQTqOqnxuKFHFlPqM1BK0MvOFQoL3roKbItbu4Xk3jZUaWqtRkKHBhN7nhdfmgbbMk6Gw7VzKQBjVTI=@protonmail.com
State New
Headers show
Series [bug#49577] Add python-pmbootstrap | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

phodina June 6, 2022, 9:07 p.m. UTC
Hi,

here's an updated version of the patch + 2 more tools around PMOS.

However, there is some issue with the sanity-check phase in pmbootstrap which I disabled as I didn't know how to fix it.

----
Petr
diff mbox series

Patch

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.

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 04dc4b6499..aa9b0e0fe6 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -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