SynologyOpenSource / minimalPkg

Example package for synology toolkit framework - MIT License (MIT)
MIT License
27 stars 5 forks source link

Unable to Sign package with GPG key #5

Open SamuelYun91 opened 5 years ago

SamuelYun91 commented 5 years ago

I'm following the guide to create the minimalPkg. I've verified that the gpg key has been created by running gpg -K. I even ran this command by chroot into the build environment.

However, when I run the command to create the package pkgscripts-ng/PkgCreate.py -p x64 -c minimalPkg, I get the following error:

"SignPackageError: [x64] Gpg key not exist. You can add -S to skip package code sign or import gpg key first."

Any ideas? Thank you!

johnchlorophyll commented 4 years ago

Gpg is not using secring.gpg for storing private keys after version 2.1. I'm not sure how to convert the current file to secring.gpg seems --export-key-file is not working for Synology build. But here's another way which builds an older version gpg and can generate the key you need for building. Use the script in docker container or any Debian(Ubuntu) system.

docker pull debian:latest # if you want to use docker
docker run -it --name debian debian bash #if you use docker.
apt update && apt install -y libpth-dev libksba-dev libgcrypt-dev libgpg-error-dev libassuan-dev zlib1g-dev wget bzip2 gcc make pinentry-tty
wget https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.0.31.tar.bz2
tar -xvf ./gnupg-2.0.31.tar.bz2
cd ./gnupg-2.0.31 && ./configure && make && make install
mkdir -p ~/.gnupg
echo "pinentry-program /usr/bin/pinentry-tty" >> ~/.gnupg/gpg-agent.conf
gpg2 --gen-key

and you can copy gpg files out by docker cp debian:/root/.gnupg/ <someplace in you machine> hope this helps.