Make the sync-org script a little more relentless.
This commit is contained in:
15
git_sync/README.md
Normal file
15
git_sync/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
Git sync scripts
|
||||
================
|
||||
|
||||
These are some simple, reasonably-stable scripts for syncing between
|
||||
gitlab and github. They need to be run by an SSH user with permission
|
||||
to use the repository on both services. It can otherwise be run without
|
||||
logging into the Github or Gitlab API's.
|
||||
|
||||
To use it, run:
|
||||
|
||||
./run.sh
|
||||
|
||||
To run it in the background, run:
|
||||
|
||||
./background.sh
|
@ -2,14 +2,41 @@
|
||||
|
||||
. ./config
|
||||
|
||||
URLLIST=`./list-org-cloneurls.sh`
|
||||
HERE=$(pwd)
|
||||
URLLIST=$(./list-org-cloneurls.sh)
|
||||
|
||||
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
|
||||
for URL in $URLLIST; do
|
||||
BASEURL=$(echo $URL | sed "s|github.com:$ORG|i2pgit.org:i2p-hackers|g" | sed 's|i2p\.plugins\.i2psnark-rpc|i2psnark-rpc|g')
|
||||
CLONEDIR=$(echo $URL | sed "s|git@github.com:$ORG/||g" | sed 's|.git||g')
|
||||
if [ -d $CLONEDIR ]; then
|
||||
cd $CLONEDIR && git pull origin --tags && \
|
||||
git pull origin master && git push github --all
|
||||
cd $HERE
|
||||
echo "Syncing: $URL, $BASEURL, $CLONEDIR"
|
||||
if [ -d "$CLONEDIR" ]; then
|
||||
cd "$CLONEDIR" || echo "Could not cd to $CLONEDIR"; exit 1
|
||||
while true; do
|
||||
# pull all the updates
|
||||
echo "Pulling updates for $CLONEDIR..."
|
||||
git pull --all && break
|
||||
done
|
||||
while true; do
|
||||
# pull all the tags
|
||||
echo "Pulling tags for $CLONEDIR..."
|
||||
git pull origin --tags && break
|
||||
done
|
||||
while true; do
|
||||
# push all the updates
|
||||
echo "Merging updates for $CLONEDIR..."
|
||||
git pull origin master && break
|
||||
done
|
||||
while true; do
|
||||
# push all the branches
|
||||
echo "Pushing updates for $CLONEDIR..."
|
||||
git push github --all && break
|
||||
done
|
||||
while true; do
|
||||
# push all the tags
|
||||
echo "Pushing tags for $CLONEDIR..."
|
||||
git push github --tags && break
|
||||
done
|
||||
cd "$HERE" || echo "Could not cd to $HERE"; exit 1
|
||||
fi
|
||||
done
|
153
plugin/makeplugin.idk.sh.bak
Executable file
153
plugin/makeplugin.idk.sh.bak
Executable file
@ -0,0 +1,153 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# basic packaging up of a plugin
|
||||
#
|
||||
# usage: makeplugin.sh plugindir
|
||||
#
|
||||
# zzz 2010-02
|
||||
# zzz 2014-08 added support for su3 files
|
||||
#
|
||||
# idk 2022-01 I changed a single line in this script and noticed it when I went to fix
|
||||
# the sync script. Changed back in original script, keeping this one so I can figure out
|
||||
# what the point of changing that line was.
|
||||
#
|
||||
|
||||
if [ -z "$I2P" -a -d "$PWD/../i2p/pkg-temp" ]; then
|
||||
export I2P=$PWD/../i2p/pkg-temp
|
||||
fi
|
||||
|
||||
if [ ! -d "$I2P" ]; then
|
||||
echo "Can't locate your I2P installation. Please add a environment variable named I2P with the path to the folder as value"
|
||||
echo "On OSX this solved with running: export I2P=/Applications/i2p if default install directory is used."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CPATH=$I2P/lib/i2p.jar:/usr/share/java/gnu-getopt.jar
|
||||
PUBKEYDIR=$HOME/.i2p-plugin-keys
|
||||
PUBKEYFILE=$PUBKEYDIR/plugin-public-signing.key
|
||||
PRIVKEYFILE=$PUBKEYDIR/plugin-private-signing.key
|
||||
B64KEYFILE=$PUBKEYDIR/plugin-public-signing.txt
|
||||
PUBKEYSTORE=$PUBKEYDIR/plugin-su3-public-signing.crt
|
||||
PRIVKEYSTORE=$PUBKEYDIR/plugin-su3-keystore.ks
|
||||
KEYTYPE=RSA_SHA512_4096
|
||||
|
||||
# put your files in here
|
||||
PLUGINDIR=${1:-plugin}
|
||||
|
||||
PC=plugin.config
|
||||
PCT=${PC}.tmp
|
||||
|
||||
if [ ! -d "$PLUGINDIR" ]
|
||||
then
|
||||
echo "You must have a $PLUGINDIR directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$PLUGINDIR/$PC" ]
|
||||
then
|
||||
echo "You must have a $PLUGINDIR/$PC file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SIGNER=`grep '^signer=' "$PLUGINDIR/$PC"`
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
echo "You must have a signer name in $PC"
|
||||
echo 'For example signer=foo'
|
||||
exit 1
|
||||
fi
|
||||
SIGNER=`echo $SIGNER | cut -f 2 -d '='`
|
||||
|
||||
if [ ! -f "$PRIVKEYFILE" ]
|
||||
then
|
||||
echo "Creating new XPI2P DSA keys"
|
||||
mkdir -p "$PUBKEYDIR" || exit 1
|
||||
java -cp "$CPATH" net.i2p.crypto.TrustedUpdate keygen "$PUBKEYFILE" "$PRIVKEYFILE" || exit 1
|
||||
java -cp "$CPATH" net.i2p.data.Base64 encode "$PUBKEYFILE" "$B64KEYFILE" || exit 1
|
||||
rm -rf logs/
|
||||
chmod 444 "$PUBKEYFILE" "$B64KEYFILE"
|
||||
chmod 400 "$PRIVKEYFILE"
|
||||
echo "Created new XPI2P keys: $PUBKEYFILE $PRIVKEYFILE"
|
||||
fi
|
||||
|
||||
if [ ! -f "$PRIVKEYSTORE" ]
|
||||
then
|
||||
echo "Creating new SU3 $KEYTYPE keys for $SIGNER"
|
||||
java -cp "$CPATH" net.i2p.crypto.SU3File sign -t $KEYTYPE "$PUBKEYSTORE" "$PRIVKEYSTORE" $SIGNER || exit 1
|
||||
echo '*** Save your password in a safe place!!! ***'
|
||||
rm -rf logs/
|
||||
# copy to the router dir so verify will work
|
||||
CDIR=$I2P/certificates/plugin
|
||||
mkdir -p "$CDIR" || exit 1
|
||||
CFILE=$CDIR/`echo $SIGNER | sed s/@/_at_/`.crt
|
||||
cp "$PUBKEYSTORE" "$CFILE"
|
||||
chmod 444 "$PUBKEYSTORE"
|
||||
chmod 400 "$PRIVKEYSTORE"
|
||||
chmod 644 "$CFILE"
|
||||
echo "Created new SU3 keys: $PUBKEYSTORE $PRIVKEYSTORE"
|
||||
echo "Copied public key to $CFILE for testing"
|
||||
fi
|
||||
|
||||
rm -f plugin.zip
|
||||
|
||||
OPWD=$PWD
|
||||
cd "$PLUGINDIR"
|
||||
|
||||
grep -q '^name=' $PC
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
echo "You must have a plugin name in $PC"
|
||||
echo 'For example name=foo'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -q '^version=' $PC
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
echo "You must have a version in $PC"
|
||||
echo 'For example version=0.1.2'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# update the date
|
||||
grep -v '^date=' $PC > $PCT
|
||||
DATE=`date '+%s000'`
|
||||
echo "date=$DATE" >> $PCT || exit 1
|
||||
mv $PCT $PC || exit 1
|
||||
|
||||
# add our Base64 key
|
||||
grep -v '^key=' $PC > $PCT
|
||||
B64KEY=`cat "$B64KEYFILE"`
|
||||
echo "key=$B64KEY" >> $PCT || exit 1
|
||||
mv $PCT $PC || exit 1
|
||||
|
||||
# zip it
|
||||
zip -r "$OPWD/plugin.zip" * || exit 1
|
||||
|
||||
# get the version and use it for the sud header
|
||||
VERSION=`grep '^version=' $PC | cut -f 2 -d '='`
|
||||
# get the name and use it for the file name
|
||||
NAME=`grep '^name=' $PC | cut -f 2 -d '='`
|
||||
XPI2P=${NAME}.xpi2p
|
||||
SU3=${NAME}.su3
|
||||
cd "$OPWD"
|
||||
|
||||
# sign it
|
||||
echo 'Signing. ...'
|
||||
java -cp "$CPATH" net.i2p.crypto.TrustedUpdate sign plugin.zip "$XPI2P" "$PRIVKEYFILE" "$VERSION" || exit 1
|
||||
java -cp "$CPATH" net.i2p.crypto.SU3File sign -c PLUGIN -t $KEYTYPE plugin.zip "$SU3" "$PRIVKEYSTORE" "$VERSION" "$SIGNER" || exit 1
|
||||
rm -f plugin.zip
|
||||
|
||||
# verify
|
||||
echo 'Verifying. ...'
|
||||
java -cp "$CPATH" net.i2p.crypto.TrustedUpdate showversion "$XPI2P" || exit 1
|
||||
java -cp "$CPATH" -Drouter.trustedUpdateKeys=$B64KEY net.i2p.crypto.TrustedUpdate verifysig "$XPI2P" || exit 1
|
||||
java -cp "$CPATH" net.i2p.crypto.SU3File showversion "$SU3" || exit 1
|
||||
java -cp "$CPATH" net.i2p.crypto.SU3File verifysig -k "$PUBKEYSTORE" "$SU3" || exit 1
|
||||
rm -rf logs/
|
||||
|
||||
echo 'Plugin files created: '
|
||||
wc -c "$XPI2P"
|
||||
wc -c "$SU3"
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user