Browse Source

Add signing to the repo. Automated key generation

Eeems 10 years ago
parent
commit
c20a71aa01
3 changed files with 48 additions and 1 deletions
  1. 1 1
      bin/repo-build
  2. 46 0
      bin/repo-gen-key
  3. 1 0
      etc/repo.conf

+ 1 - 1
bin/repo-build

@@ -100,7 +100,7 @@ ls -l $root/repo/latest/ | egrep '^d' | awk '{print $9}' | while read arch; do
 		cd $root/repo/latest/$arch;
 		rm -f $reponame.db.tar.gz;
 		touch $reponame.db.tar.gz;
-		repo-add $reponame.db.tar.gz *.pkg.tar.xz;
+		repo-add -s -v -f -k $repokey $reponame.db.tar.gz *.pkg.tar.xz;
 		rm -f $reponame.db.tar.gz.old;
 	fi;
 done;

+ 46 - 0
bin/repo-gen-key

@@ -0,0 +1,46 @@
+#!/bin/bash
+root="$(readlink -f $(dirname $BASH_SOURCE)/..)";
+. $root/etc/repo.conf
+echo "Initializing...";
+expect -c "
+	set timeout 1
+	log_user 0
+	spawn gpg --gen-key
+	expect \"Your selection?\" {
+		send \"4\r\";
+		exp_continue;
+	}
+	expect \"What keysize do you want? (2048)\" {
+		send \"\r\";
+		exp_continue;
+	}
+	expect \"Key is valid for? (0)\" {
+		send \"\r\";
+		exp_continue;
+	}
+	expect \"Is this correct? (y/N)\" {
+		send \"y\r\";
+		exp_continue;
+	}
+	expect \"Real name:\" {
+		send \"$reponame Key\r\";
+		exp_continue;
+	}
+	expect \"Email address:\" {
+		send \"$repokey\r\";
+		exp_continue;
+	}
+	expect \"Comment:\" {
+		send \"Repository Signing Key\r\";
+		exp_continue;
+	}
+	expect \"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?\" {
+		send \"o\r\";
+		set timeout -1;
+		log_user 1;
+		exp_continue;
+	}
+	expect eof {
+		exit
+	}";
+gpg --export-secret-key -a $repokey > $root/etc/repo.key;

+ 1 - 0
etc/repo.conf

@@ -2,3 +2,4 @@
 #                       Basic Config                       #
 ############################################################
 reponame=omni
[email protected]