BlocNotes

Notepad of a tinker, maker, hacker or whatever you call it :)

How to setup an OpenWrt repository

I recently wanted to setup a repository for some custom OpenWrt packages for Respeaker. It seems that it is not so well documented, or at least, I did not found it and I have been helped on OpenWrt forum.
Also, it is better to sign packages so...here we go !

Prepare the repository

  1. Compile and install usign from here.
  2. Generate key thanks to: usign -G -p openWrtUsign.pub -s openWrtUsign.key.
  3. Put the following script in the IPK directory.
  4. Make it executable: chmod +x repoUpdate.sh
  5. Execute it: ./repoUpdate.sh
  6. Copy the whole directory and openWrtUsign.pub to a webserver.
  7. Done !

Add key and install packages on the target

# Add the public key
wget http://youserver.ext/path/to/openWrtUsign.pub  
opkg-key add openWrtUsign.pub  
opkg update

# Install package
opkg install  newPackage  

Manifest generation script

#!/bin/bash

SCRIPT="../../../../scripts/ipkg-make-index.sh"  
KEY="../openWrtUsign.key"

# Generates package manifest
$SCRIPT . 2>/dev/null > Packages.manifest
grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages  
gzip -9nc Packages > Packages.gz  
usign -S -m Packages -s $KEY