Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup .deb package and package repo #387

Closed
jdknives opened this issue Jun 2, 2020 · 2 comments
Closed

Setup .deb package and package repo #387

jdknives opened this issue Jun 2, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jdknives
Copy link
Member

jdknives commented Jun 2, 2020

Feature description

We will need to setup scripts for creating Skywire .deb packages and setup a package repo afterwards where we maintain official .deb packages.

@0pcom
Copy link
Collaborator

0pcom commented Jun 7, 2020

The task of creating an apt repo is more or less just the creation of the conf/distributions configuration file. The rest is handled by reprepro.

here's an example; what I was using in skyfleet-

#!/bin/bash
#sign the package repository in order to update the github repo
if [[ "$2" == "sign" ]]; then
signwith=DE08F924EEE93832DABC642CA8DC761B1C0C0CFC
fi

default_debian_codename=(sid) #e.g. jessie, stretch, buster, sid
#determine system architecture
#mycarch=$(dpkg --print-architecture)
packagearchitecture=$(dpkg --print-architecture)
#uncomment to create the repo for github
if [ ! -z $signwith ]; then
packagearchitecture="amd64 arm64 armhf armel i386 mips mipsel mips64el ppc64el riscv64 s390x"
fi

#get debian version codename
which_distribution=$(cat /etc/os-release | grep Debian)


if [ -f  /etc/os-release ]; then
checkremove="VERSION_CODENAME="
if [[ "$(cat /etc/os-release | grep $checkremove)" == $checkremove ]]; then
debian_codename=$(cat /etc/os-release | grep $checkremove)
debian_codename=${debian_codename#"$checkremove"}
else
debian_codename=$default_debian_codename
fi
fi
#need to error if this is empty
if [ -z $debian_codename ]; then
  echo -e "error, can't find debian distribution codename"
  exit
fi

echo -e "making repo for debian $debian_codename $mycarch"
repodirectory=$1
if [[ -f *'.deb' ]]; then
repodirectory=$(pwd)
else
if [ -z $repodirectory ]; then
repodirectory="built"
fi
fi
if [ ! -d $repodirectory ]; then
echo "Error: can't find built packages dir in which to create a repo"
exit
else
cd $repodirectory
fi
if [ ! -d "conf" ]; then
mkdir conf
fi

#https://serverfault.com/questions/279153/why-does-reprepro-complain-about-the-all-architecture
#If you specify your .deb (control file) as Architecture: all, then don't put anything into the reprepro distributions file
#other than the arch's that you want it to get put into.
#Architectures: amd64 arm64 armhf armel i386 mips mipsel mips64el ppc64el riscv64 s390x
#The all packages are then available in all the architectures defined in conf/distributions

echo "creating repo configuration file"
echo "Origin: localhost" > conf/distributions
echo "Label: localhost" >> conf/distributions
echo "Codename: $debian_codename" >> conf/distributions
echo "Architectures: $packagearchitecture" >> conf/distributions
#echo -e "Architectures: $mycarch" >> conf/distributions
#echo -e "Architectures: all" >> conf/distributions
echo "Components: main" >> conf/distributions
echo "Description: lorem ipsum dolor sit amet!" >> conf/distributions
if [ ! -z $signwith ]; then
echo "SignWith: $signwith" >> conf/distributions
fi
echo "Creating debian package repo"
set -e pipefail
reprepro --basedir $(pwd) includedeb $debian_codename *.deb
#reprepro --basedir $(pwd) includedeb sid *.deb

this sccript will overwrite the configuration file every time, so for subsequent runs I just use the last command which is commented out.

@jdknives
Copy link
Member Author

Fixed. Just waiting for first package creation with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants