Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/setup_flatpak_remote/README.md

raw
1 <!--
2 Copyright (c) Ansible Project
3 GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 SPDX-License-Identifier: GPL-3.0-or-later
5 -->
6
7 # Create a dummy flatpak repository remote
8
9 This document describes how to create a local flatpak dummy repo. Just like the one contained in the `files/repo.tar.gxz` archive.
10
11
12 ## Create a hello world app
13
14 Prerequisites:
15
16 - flathub
17
18 Prepare the environment:
19
20 ```
21 flatpak install --system flathub org.freedesktop.Platform//1.6 org.freedesktop.Sdk//1.6
22 ```
23
24 Create a hello world executable:
25
26 ```
27 echo $'#!/bin/sh\necho hello world' > hello.sh
28 ```
29
30 To create dummy flatpaks, run this (defining a unique NUM for every flatpak to add):
31
32 ```
33 export NUM=1
34 flatpak build-init appdir$NUM com.dummy.App$NUM org.freedesktop.Sdk org.freedesktop.Platform 1.6;
35 flatpak build appdir$NUM mkdir /app/bin;
36 flatpak build appdir$NUM install --mode=750 hello.sh /app/bin;
37 flatpak build-finish --command=hello.sh appdir$NUM
38 ```
39
40 ## Create a repo and/or add the app to it
41
42 Create a repo and add the file to it in one command:
43
44 ```
45 flatpak build-export repo appdir$NUM stable
46 ```
47
48 ## Create flatpak*-files
49
50 Put a flatpakref file under the repo folder (`repo/com.dummy.App1.flatpakref`):
51
52 ```
53 [Flatpak Ref]
54 Title=Dummy App$NUM
55 Name=com.dummy.App$NUM
56 Branch=stable
57 Url=file:///tmp/flatpak/repo
58 GPGKey={{ base64-encoded public KEY }}
59 IsRuntime=false
60 RuntimeRepo=https://flathub.org/repo/flathub.flatpakrepo
61 ```
62
63 Add a `.flatpakrepo` file to the `repo` folder (`repo/dummy-repo.flatpakrepo`):
64
65 ```
66 [Flatpak Repo]
67 Title=Dummy Repo
68 Url=file:///tmp/flatpak/repo
69 Comment=Dummy repo for ansible module integration testing
70 Description=Dummy repo for ansible module integration testing
71 GPGKey={{ base64-encoded public KEY }}
72 ```
73
74 ## Sign the repo
75
76 Create a new key in a new gpg home folder (On RedHat systems, the executable needs to addressed as gpg2):
77
78 ```
79 mkdir gpg
80 gpg --homedir gpg --quick-gen-key [email protected]
81 ```
82
83 Sign the repo and summary file, you need to redo this when you update the repository:
84
85 ```
86 flatpak build-sign repo --gpg-sign=KEY_ID --gpg-homedir=gpg
87 flatpak build-update-repo repo --gpg-sign=KEY_ID --gpg-homedir=gpg
88 ```
89
90 Export the public key as a file:
91
92 ```
93 gpg --homedir=gpg --export KEY_ID > dummy-repo.gpg
94 ```
95
96 Create base64-encoded string from gpg-file for `GPGKey=` property in flatpak*-files:
97
98 ```
99 base64 dummy-repo.gpg | tr -d '\n'
100 ```
101
102 ## How to use the repo
103
104 Now you can add the `repo` folder as a local repo:
105
106 ```
107 flatpak --system remote-add --gpg-import=/tmp/flatpak/repo/dummy-repo.gpg dummy-repo /tmp/flatpak/repo
108 ```
109
110 Or, via `.flatpakrepo` file:
111
112 ```
113 flatpak --system remote-add dummy-repo /tmp/flatpak/repo/dummy-repo.flatpakrepo
114 ```
115
116 And install the hello world flatpaks like this:
117
118 ```
119 flatpak --system install dummy-repo com.dummy.App$NUM
120 ```
121
122 Or from flatpakref:
123
124 ```
125 flatpak --system install --from /tmp/flatpak/repo/com.dummy.App$NUM.flatpakref
126 ```
127
128 Run the app:
129
130 ```
131 flatpak run com.dummy.App$NUM
132 ```
133
134 To install an app without any runtime dependencies (the app will be broken, but it is enough to test flatpak installation):
135
136 ```
137 flatpak --system install --no-deps dummy-repo com.dummy.App$NUM
138 ```
139
140 ## Sources:
141
142 * https://blogs.gnome.org/alexl/2017/02/10/maintaining-a-flatpak-repository/
143
144 * http://docs.flatpak.org/en/latest/first-build.html