Guide of creating SDK repository for LiCO on ubuntu 22.04 LTS

Prerequisites

Configure APT repository

Update Repository Cache

Note: Only one of the following 2 options should be chosen due to the network bandwidth.

Option 1: Update the cache with the official repository

apt update

Option 2: Change the repository address for the faster downloading speed. (Example as https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ )

# Disable exist soource
for i in `apt-add-repository --list`
do
apt-add-repository -r -y "${i}"
done

# Add the source of tsinghua university
apt-add-repository -y "deb <ubuntu online repository address> jammy main universe"
apt-add-repository -y "deb <ubuntu online repository address> jammy-updates main universe"
apt update

Installing docker-ce

apt install ca-certificates curl gnupg

install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
gpg --dearmor -o /etc/apt/keyrings/docker.gpg

chmod a+r /etc/apt/keyrings/docker.gpg

echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

apt update

Installing APTLY

In the guide, we generate the ubuntu repository by the tool of aptly.

Note: Make sure to the version of aptly is great than or equal to 1.5.0

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A0546A43624A8331
apt-add-repository -y "deb http://repo.aptly.info/ squeeze main"
apt update
apt install -y aptly

Create a workspace

Create a workspace and all the files would be saved under it.

Step 1. Create the workspace

mkdir -p /opt/workspace

Step 2. Set the workspace as a variable.

WORKSPACE=/opt/workspace

Downloading the expected deb packages

The chapter provides the scope of packages which is required by LiCO 7.X.

Step 1. Obtain the download scripts pkgdownload.py .

Step 2. Obtain the required version for lico_depends.json 7.0_lico_depends.json or 7.1_lico_depends.json or 7.2_lico_depends.json or 7.2.1_lico_depends.json.

Step 3. Upload the scripts to ${WORKSPACE} and run the script to download the deb packages.

cd ${WORKSPACE}
python3 pkgdownload.py

Step 4. Specified the version number of LiCO.

lico_NO=<LiCO Version Number>

Creating a local repository by APTLY

# Create local repository
aptly repo create -distribution=jammy-thin -component=main jammy-thin

# Add the packages to the repository
aptly repo add jammy-thin ${WORKSPACE}/download_pkgs/

# Create a snapshot for the repo
aptly snapshot create jammy-thin-${lico_NO} from repo jammy-thin

Publish the snapshot of the repository

Generate key pairs

Before publishing the repository, a key pair need to be generated for signature.

Step 1. Run the command and according the interact tips to generate the key pair.

Note: Please record the real name you input.

gpg --full-gen-key

Step 2. Export the binary signature with the real name.

gpg -o ${WORKSPACE}/jammy-thin.gpg --export <real name>

Configure the APTLY configure file

Aptly support to publish repository to multi platform, the chapter only provides the filesystem publishing.

Firstly, need to edit the aptly configure file (default locations are /etc/aptly.conf, ~/.aptly.conf), we need to add a publish point in the FileSystemPublishEndpoints of the configure file, the example as belows:

...
"FileSystemPublishEndpoints": {
  "dev": {
    "rootDir": "/opt/jammy-thin",
    "linkMethod": "copy",
    "verifyMethod": "md5"
  }
},
...

Publish the repository

aptly publish snapshot jammy-thin-${lico_NO} filesystem:dev:/jammy-thin-${lico_NO}

Compressing the published repository

Compress the repository as a tar and then the tar could be moved to another ubuntu server as a local repository

cd /opt/jammy-thin/jammy-thin-${lico_NO}
cp ${WORKSPACE}/jammy-thin.gpg /opt/jammy-thin/jammy-thin-${lico_NO}/dists/jammy-thin/jammy-thin.gpg
tar zcvf jammy-thin-${lico_NO}.tar.gz *

*Note: * For the detail about building the Debian repository, please refer to https://www.aptly.info/doc/overview/