Create Signed APT repository: Unterschied zwischen den Versionen

Aus Gemini-Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „{|width="40%" |Bild:deutsch.png - in Deutsch |Bild:english.png - in English …“)
 
 
(5 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 3: Zeile 3:
 
  |[[Bild:english.png]] - [[Create Signed APT repository|in English]]
 
  |[[Bild:english.png]] - [[Create Signed APT repository|in English]]
 
  |}
 
  |}
{{Achtung| Dieser Artikel erfordert mehr Erfahrung im Umgang mit der Dreambox / Linux und ist daher nur für fortgeschrittene Benutzer gedacht.}}
+
{{Baustelle|This article is currently under construction. Caution: Article is incomplete and may be incorrect!}}
  
Wenn jemand erfolgreich ein [[Images erstellen und Programme kompilieren unter OE 2.2|Dreambox SDK]] eingerichtet hat, z.B. für [[OE 2.2]], dann ist dieser Artikel sicherlich interessant. Er beschreibt das einrichten eines signierten [[APT]] Repositories. So könnt ihr eure gebauten Pakete via Paketverwaltung (APT) der Dreambox installieren.
+
{{Achtung| This article requires some in-depth experience with Dreambox / Linux and is for advanced users.}}
  
Basis des hier beschriebenen Artikels ist eine DEB basierende Distribution (z.B. Ubuntu, Mint, Debian, usw.) die auf eurem Rechner mit dem Dreambox SDK läuft. Eine Webserver brauchen wir auch, welcher die Daten für die Dreambox bereitstellen wird.
+
After you succeeded in setting up a [[Build images and compile programs with OE 2.2|Dreambox SDK]], e.g. for [[OE 2.2 (en)| OE 2.2]], this article is very interesting. It describes the setup of a signed [[APT (en)|APT]] repository. This will allow you to install your own packages via the package manager (APT) of the Dreambox.
  
== Repository erstellen ==
+
Prerequisite for this description is a DEB based ditro (e.g. Ubuntu, Mint, Debian, etc.) which is installed on your computer with your Dreambox SDK. A web server is also needed, to offer the packages for the Dreambox.
=== Abhängigkeiten installieren ===
+
 
 +
== Create Repository ==
 +
=== Install dependencies ===
 
<syntaxhighlight>
 
<syntaxhighlight>
 
sudo apt-get install dpkg-dev apache2 dpkg-sig
 
sudo apt-get install dpkg-dev apache2 dpkg-sig
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== GPG Schlüssel erstellen ===
+
=== Create GPG key ===
Jetzt erstellen wir einen [http://de.wikipedia.org/wiki/GNU_Privacy_Guard GPG] Schlüssel für das signieren der Pakete und des Repositories.
+
Now we create a [http://en.wikipedia.org/wiki/GNU_Privacy_Guard GPG] key, which will be used to sign the packages and the repository.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
  gpg --gen-key
 
  gpg --gen-key
 
</syntaxhighlight>
 
</syntaxhighlight>
Die einzelnen Abfragen werde ich hier nicht genauer beschreiben. Funktioniert mit den Standard Abfragen. Gebt am Schluss eine Passphrase ein und wartet bis das erzeugen erfolgreich abgeschlossen ist. Einfach geduldig sein und mit der Maus / Keyboard ein bisschen herumfuchteln.
+
The following questions are not described in detail. The standard questions will appear. At the end, enter a passphrase and wait untill the key is generated. Be patient, and meanwhile play a little with the mouse and keyboard ;-).
  
==== Abfragen des Schlüssels ====
+
==== Display the key ====
Informationen über den erstellen Schlüssel könnt ihr mit folgendem Befehl abfragen.
+
Info about the created key can be displayed with the following command.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
gpg --list-keys
 
gpg --list-keys
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== Public Key exportieren/speichern ====
+
==== Export/save the public key ====
Erstellt nun den Öffentlichen Schlüssel mit dem folgenden Befehl und speicher die Ausgabe in eine Datei (z.B. <code>mein_public.key</code>). Der Schlüssel muss im root Verzeichnis des Webservers platziert werden und wird später von den Client-Dreamboxen geladen, damit Pakete installiert werden können.
+
Now you can create the public key with following commands, the output is stored in a file (e.g. <code>my_public.key</code>). The key must be copied in the root directory of the web server, and will be loaded by the client Dreamboxes to permit the installation of the packages.
 
<syntaxhighlight>
 
<syntaxhighlight>
gpg --output keyFile --armor --export eureid_oder_name
+
gpg --output keyFile --armor --export your_id_or_name
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Webserver einrichten ===
+
=== Setup web server ===
Die Dateistruktur des Webservers habe ich wie folgt eingerichtet für eine DM 8000 HD PVR. Beim Erstellen der Pakete via Dreambox SDK erhält man z.B folgende Verzeichnisse <code>all</code>, <code>dm8000</code>, <code>mips32el</code>. So habe ich hier unter dem vorkonfiguriertem Webroot Verzeichnis des Webservers die Pakete abgelegt. Z.B. unter:
+
This example shows the file structure of the web server for a DM 800 HD PVR. While creating the Dreambox SDK the following directories are created: <code>all</code>, <code>dm8000</code>, <code>mips32el</code>. This structure needs to be mirrored in the preconfigured web root of the web server to store the packages:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
/var/www/html/repository/dm8000/all
 
/var/www/html/repository/dm8000/all
Zeile 41: Zeile 43:
 
/var/www/html/repository/dm8000/mip32el
 
/var/www/html/repository/dm8000/mip32el
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
The packages are copied into the corresponding directory.
  
=== Pakete signieren ===
+
=== Sign packages ===
Die Pakete in den Verzeichnissen könnt ihr mit dem folgenden Befehl signieren.
+
The packages in the directories can be signed as follows.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
dpkg-sig --sign *.deb
 
dpkg-sig --sign *.deb
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Repository Index-Dateien erzeugen ===
+
=== Create repository index files ===
Erstellt mit den folgenden Befehlen die benötigte '''Packages''' Index-Datei und komprimiert sie. Eine unkomprimierte Datei muss auch enthalten sein.
+
With the following command the required compressed '''Packages''' index file can be created. An uncompressed file is also needed.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
apt-ftparchive packages . &gt; Packages
 
apt-ftparchive packages . &gt; Packages
Zeile 55: Zeile 58:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Release, InRelease, and Release.gpg Datei erstellen ===
+
=== Create Release, InRelease, and Release.gpg files ===
Release Dateien erstellen.
+
Create Release files.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
apt-ftparchive release . &gt; Release
 
apt-ftparchive release . &gt; Release
Zeile 63: Zeile 66:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Dreambox einrichten ==
+
== Setup Dreambox ==
=== Public Key imporieren ===
+
=== Import public key ===
Auf der Dreambox muss der Öffentliche Schlüssel importiert werden mit dem folgenden Befehl. Server Ip-Adresse und Verzeichniss muss sicherlich angepasst werden.
+
The public key needs to be imported on the dreambox with the following command. The server IP address and directory must be addapted to your setup.
 
<syntaxhighlight>
 
<syntaxhighlight>
wget -O - http://server_ip/mein_public.key | apt-key add -
+
wget -O - http://server_ip/my_public.key | apt-key add -
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Paketlisten anpassen ===
+
=== Modify package lists ===
Nun müsst ihr auf der Dreambox im Verzeichnis <code>/etc/apt/sources.list</code> drei Dateien erstellen für die verfügbaren Feeds (z.B. all, dm8000, mips32el). Die folgenden Befehlen zeigen den Inhalt der Dateien.
+
Now you need to create three files for the available feeds (e.g. all, dm8000, mips32el) in the directory <code>/etc/apt/sources.list</code>. With the following command you can see the content of the files.
 
<syntaxhighlight>
 
<syntaxhighlight>
 
root@dm8000:~# cat /etc/apt/sources.list.d/all-feed.list  
 
root@dm8000:~# cat /etc/apt/sources.list.d/all-feed.list  
Zeile 82: Zeile 85:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Paketliste aktualisieren / Pakete installieren ===
+
=== Update package list / install package ===
Ist alles eingerichtet könnt ihr von der Dreambox die Paketlisten aktualisieren mit dem Befehl:
+
Once everything is configured, it's possible to update the package list on the dreambox:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
apt-get update
 
apt-get update
 
</syntaxhighlight>
 
</syntaxhighlight>
Anschliessend könnt ihr die verfügbaren Pakete vom Feed installieren, usw.
+
Now you can install the available packages from the feed.
 
 
== Tipps & Tricks ==
 
=== Script zum Erstellen eines signierten Repositories ===
 
{{Achtung| Dieser Abschnitt ist ein Beispiel, wie ein signiertes Repsitory erstellt werden kann.}}
 
Am einfachstes ist es sicherlich ein Script zu erstellen, welches die Daten für ein Repository der Dreambox bereitstellt. Z.B kann ein solches Script wie folgt ausschauen, um die einzelnen Schritte zeigen. Ist aber nicht zum Copy & Pasten empfohlen, und dient nur als grobe Vorlage für das erstellen eines Repos für die Dreambox.
 
<syntaxhighlight>
 
#!/bin/bash
 
#Webserver dirs erstellen
 
mkdir -p /var/www/html/repository/dm8000/{all,dm8000,mips32el}
 
 
 
#Pakete nach webserver dir kopieren
 
cp -u /media/oe/oe2.2/opendreambox/build/dm8000/tmp-eglibc/deploy/deb/all/* /var/www/html/repository/dm8000/all
 
cp -u /media/oe/oe2.2/opendreambox/build/dm8000/tmp-eglibc/deploy/deb/dm8000/* /var/www/html/repository/dm8000/dm8000
 
cp -u /media/oe/oe2.2/opendreambox/build/dm8000/tmp-eglibc/deploy/deb/mips32el/* /var/www/html/repository/dm8000/mips32el
 
 
 
#Pakete signieren
 
dpkg-sig -s -p builder /var/www/html/repository/dm8000/all/*.deb
 
dpkg-sig -s -p builder /var/www/html/repository/dm8000/dm8000/*.deb --batch
 
dpkg-sig -s -p builder /var/www/html/repository/dm8000/mips32el/*.deb --batch
 
 
 
#Alte Sachen entfernen
 
rm -f /var/www/html/repository/dm8000/all/Packages Packages.gz Packages.xz Release.gpg
 
rm -f /var/www/html/repository/dm8000/dm8000/Packages Packages.gz Packages.xz Release.gpg
 
rm -f /var/www/html/repository/dm8000/mips32el/Packages Packages.gz Packages.xz Release.gpg
 
 
 
#Indexen
 
dpkg-scanpackages -t deb /var/www/html/repository/dm8000/all/ ./ | tee Packages | gzip -9c > Packages.gz
 
dpkg-scanpackages -t deb /var/www/html/repository/dm8000/dm8000/ ./ | tee Packages | gzip -9c > Packages.gz
 
dpkg-scanpackages -t deb /var/www/html/repository/dm8000/mips32el/ ./ | tee Packages | gzip -9c > Packages.gz
 
 
 
#Indexen
 
cd /var/www/html/repository/dm8000/all && apt-ftparchive packages . &gt; Packages && gzip -c Packages &gt; Packages.gz
 
cd /var/www/html/repository/dm8000/dm8000 && apt-ftparchive packages . &gt; Packages && gzip -c Packages &gt; Packages.gz
 
cd /var/www/html/repository/dm8000/mips32el && apt-ftparchive packages . &gt; Packages && gzip -c Packages &gt; Packages.gz
 
 
 
#Repo signieren
 
cd /var/www/html/repository/dm8000/all && apt-ftparchive release . &gt; Release && gpg --clearsign -o InRelease Release && gpg -abs -o Release.gpg Release
 
cd /var/www/html/repository/dm8000/dm8000 && apt-ftparchive release . &gt; Release && gpg --clearsign -o InRelease Release && gpg -abs -o Release.gpg Release
 
cd /var/www/html/repository/dm8000/mips32el && apt-ftparchive release . &gt; Release && gpg --clearsign -o InRelease Release && gpg -abs -o Release.gpg Release
 
</syntaxhighlight>
 
  
 
== Weblinks==
 
== Weblinks==

Aktuelle Version vom 7. Oktober 2014, 21:06 Uhr

Deutsch.png - in Deutsch English.png - in English
Baustelle.png This article is currently under construction. Caution: Article is incomplete and may be incorrect!
Ambox attention.png This article requires some in-depth experience with Dreambox / Linux and is for advanced users.

After you succeeded in setting up a Dreambox SDK, e.g. for OE 2.2, this article is very interesting. It describes the setup of a signed APT repository. This will allow you to install your own packages via the package manager (APT) of the Dreambox.

Prerequisite for this description is a DEB based ditro (e.g. Ubuntu, Mint, Debian, etc.) which is installed on your computer with your Dreambox SDK. A web server is also needed, to offer the packages for the Dreambox.

Create Repository

Install dependencies

sudo apt-get install dpkg-dev apache2 dpkg-sig

Create GPG key

Now we create a GPG key, which will be used to sign the packages and the repository.

 gpg --gen-key

The following questions are not described in detail. The standard questions will appear. At the end, enter a passphrase and wait untill the key is generated. Be patient, and meanwhile play a little with the mouse and keyboard ;-).

Display the key

Info about the created key can be displayed with the following command.

gpg --list-keys

Export/save the public key

Now you can create the public key with following commands, the output is stored in a file (e.g. my_public.key). The key must be copied in the root directory of the web server, and will be loaded by the client Dreamboxes to permit the installation of the packages.

gpg --output keyFile --armor --export your_id_or_name

Setup web server

This example shows the file structure of the web server for a DM 800 HD PVR. While creating the Dreambox SDK the following directories are created: all, dm8000, mips32el. This structure needs to be mirrored in the preconfigured web root of the web server to store the packages:

/var/www/html/repository/dm8000/all
/var/www/html/repository/dm8000/dm8000
/var/www/html/repository/dm8000/mip32el

The packages are copied into the corresponding directory.

Sign packages

The packages in the directories can be signed as follows.

dpkg-sig --sign *.deb

Create repository index files

With the following command the required compressed Packages index file can be created. An uncompressed file is also needed.

apt-ftparchive packages . &gt; Packages
gzip -c Packages &gt; Packages.gz

Create Release, InRelease, and Release.gpg files

Create Release files.

apt-ftparchive release . &gt; Release
gpg --clearsign -o InRelease Release
gpg -abs -o Release.gpg Release

Setup Dreambox

Import public key

The public key needs to be imported on the dreambox with the following command. The server IP address and directory must be addapted to your setup.

wget -O - http://server_ip/my_public.key | apt-key add -

Modify package lists

Now you need to create three files for the available feeds (e.g. all, dm8000, mips32el) in the directory /etc/apt/sources.list. With the following command you can see the content of the files.

root@dm8000:~# cat /etc/apt/sources.list.d/all-feed.list 
deb http://server_ip/repository/dm8000/all ./
root@dm8000:~# cat /etc/apt/sources.list.d/dm8000-feed.list 
deb http://server_ip/repository/dm8000/dm8000 ./
root@dm8000:~# cat /etc/apt/sources.list.d/mips32el-feed.list 
deb http://server_ip/repository/dm8000/mips32el ./
root@dm8000:~#

Update package list / install package

Once everything is configured, it's possible to update the package list on the dreambox:

apt-get update

Now you can install the available packages from the feed.

Weblinks