GithubHelp home page GithubHelp logo

threeal / repo Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 93.91 MB

Personal Debian package repository that could be served on GitHub Page

Home Page: https://threeal.github.io/repo/

License: MIT License

Shell 100.00%
debian debian-packaging debian-repositories

repo's Introduction

Repo

This project contains a personal Debian package repository that could be served on GitHub Page. It also contains guides on how to build a Debian package, create repository, and use the repository.

Using This Repository

  • Add the public key of this repository to the local system.
    $ curl -s https://threeal.github.io/repo/threeal.asc | sudo apt-key add -
  • Add this repository to the source list.
    $ sudo sh -c 'echo "deb [arch=amd64] https://threeal.github.io/repo $(lsb_release -sc) main" > /etc/apt/sources.list.d/threeal.list'
  • Update the package list in repositories.
    $ sudo apt update

Creating a Debian Package

Structuring the Package

  • Create a directory using name that follow standard Debian notation for package name. usually it is all lowercase with the following format <PROJECT>_<MAJOR-VER>.<MINOR-VER>-<PKG-REVISION>_<ARCHITECTURE>. (example: libsomething_1.0-1_amd64)
  • Pretend the directory you just created to be the root of the system file.
  • Put files that will be installed correspond to their install path. (example: put file that will be installed on /usr/lib/libsomething.so to libsomething_1.0-1_amd64/usr/lib/libsomething.so)
  • Create a DEBIAN directory inside the project directory. This directory will be used to put metadata and configuration files of the package.
  • The configuration files are optional, but the metadata file is a must.

    For more information about the configuration files, please refer here.

  • Create DEBIAN/control for the metadata file. The metadata file atleast must contains information like the following example:
    Package: libsomething
    Version: 1.0-1
    Section: base
    Priority: optional
    Architecture: i386
    Depends: somepackage (>= 1.0.0), someotherpackage (>= 1.2.5)
    Maintainer: Your Name <[email protected]>
    Description: short description
     very long
     description
    

    For more information about the metadata files, please refer here

  • Watch for the file permission (read, write, and execute permission). Make sure executable files in the package already have an execute permission.
  • After the package already structured, continue to build the package as a Debian package.

Building the Package

  • Build the directory as a Debian package:
    $ dpkg-deb --build <package_directory>

    If the dpkg-deb has not been installed, install it using $ sudo apt install dpkg.

Creating a Debian Package Repository

Structuring the Repository

  • The repository consists of 2 main directory, dists that contains package lists and pool that contains the package files.
    • The dists directory should be structured using the following format dists/<OS-RELEASE>/main/binary-<ARCHITECTURE>/. (example: dists/bionic/main/binary-amd64)
    • The pool directory should be structured using the following format pool/main/<PACKAGE>/<PACKAGE-DEB>. (example: pool/main/libsomething/libsomething_1.0-1_amd64.deb)
  • Create a Distributions metadata file under dists/<OS-RELEASE>. The metadata file atleast must contains information like the following example:
    Origin: threeal.github.io/repo
    Label: threeal bionic
    Suite: bionic
    Codename: bionic
    Architectures: amd64 i386
    Components: main
    Description: Threeal's Bionic Debian repository
    
    

    Note: End the metadata file with an empty line, as it will be appended with the package list to create Release file.

Making the Repository to be Signed

  • Create a new gpg key for this repository.
    $ gpg --gen-key

    Note: Make sure to export the key so it could be used later by other user to update the repository. To export the key, use the following command $ gpg --export-secret-keys <NAME> > <PATH-TO>/<KEYNAME>.key

  • Export the public key for the repository and put it to the project root.
    $ gpg --armor --export <NAME> > <KEYNAME>.asc

Adding a New Package to the Repository

  • Put all new release of Debian packages inside their corresponding package in pool directory. (example: put libsomething_1.0-1_amd64.deb inside pool/main/libsomething)
  • Remove older version of the Debian package release, if there is any. (example: with libsomething_1.0-1_amd64.deb, remove libsomething_0.9-3_amd64.deb)

    Note: for alternative, you can run the update.sh script to apply the new package to the repository after put the Debian package file.

  • Update the package list for each architecture under dists/<OS-RELEASE>/main directory.
    $ apt-ftparchive --arch <ARCHITECTURE> packages pool > <PATH-TO>/binary-<ARCHITECTURE>/Packages

    If the apt-ftparchive has not been installed, install it using $ sudo apt install apt-utils.

  • Also update the gzip version of the package list for every new package list.
    $ gzip -kf <PATH-TO>/Packages
  • Update the release files for each os release under dists/<OS-RELEASE> directory.
    $ cd dists/<OS-RELEASE>
    $ cat Distributions > Release
    $ apt-ftparchive release . >> Release
    $ gpg --clearsign -o InRelease Release
    $ gpg -abs -o Release.gpg Release

Serving the Repository on GitHub Page

  • Clone this project to your GitHub repository as repo.
  • On the repository settings, under the GitHub Page, Set the Source to be the branch that will be served on the GitHub Page.
  • The repository later could be accessed under <USER>.github.io/repo.

Using The Repository

Adding the Public Key

  • Public key is used to sign this repository, so it could be accepted by the Debian packaging system in the client computer.
  • Add the public key of the repository to the local system.
    $ curl -s <ADDRESS-TO>/repo/<KEYNAME>.asc | sudo apt-key add -

Adding the Repository to the Source List

  • Add the repository to the source list.
    $ sudo sh -c 'echo "deb [arch=<ARCHITECTURE>] <ADDRESS-TO>/repo $(lsb_release -sc) main" > /etc/apt/sources.list.d/<REPOSITORY-NAME>.list'
  • Update the package list in repositories.
    $ sudo apt update

repo's People

Contributors

threeal avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

repo's Issues

Packages List

Show information regarding the packages that are served in this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.