diff options
-rwxr-xr-x | bin/ak-articles | 2 | ||||
-rwxr-xr-x | bin/ak-categories | 2 | ||||
-rwxr-xr-x | bin/ak-comments | 2 | ||||
-rwxr-xr-x | bin/ak-config | 2 | ||||
-rwxr-xr-x | bin/ak-data-expand | 4 | ||||
-rwxr-xr-x | bin/ak-enter | 4 | ||||
-rwxr-xr-x | bin/ak-files | 2 | ||||
-rwxr-xr-x | bin/ak-mixtapes | 2 | ||||
-rwxr-xr-x | bin/ak-news | 4 | ||||
-rwxr-xr-x | bin/ak-pack_z_block | 8 | ||||
-rwxr-xr-x | bin/ak-profile | 2 | ||||
-rwxr-xr-x | bin/ak-reference | 2 | ||||
-rwxr-xr-x | bin/ak-sm-files | 2 | ||||
-rwxr-xr-x | bin/ak-todos | 2 | ||||
-rwxr-xr-x | bin/ak-transactions | 2 | ||||
-rwxr-xr-x | bin/ak-zblock-manipulator | 8 | ||||
-rwxr-xr-x | config.sh | 1 | ||||
-rwxr-xr-x | install.sh | 1 |
18 files changed, 27 insertions, 25 deletions
diff --git a/bin/ak-articles b/bin/ak-articles index 9256d2a..2e94205 100755 --- a/bin/ak-articles +++ b/bin/ak-articles @@ -82,7 +82,7 @@ add(){ TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-categories b/bin/ak-categories index f5a6671..ea0965c 100755 --- a/bin/ak-categories +++ b/bin/ak-categories @@ -72,7 +72,7 @@ add(){ TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-comments b/bin/ak-comments index 3a35efa..a8016bf 100755 --- a/bin/ak-comments +++ b/bin/ak-comments @@ -58,7 +58,7 @@ add(){ DATETIME="$1" FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) printf '{"datetime":"%s","ipfs":"%s","detach":"%s"}' $DATETIME $FILE_IPFS_HASH $FILE_SIGNATURE > data else diff --git a/bin/ak-config b/bin/ak-config index 513c8dc..bc55b8e 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -44,7 +44,7 @@ published(){ # We will be using our public key also to put it in the block later KEY="tmp-gpg.pub" -gpg2 --armour --output $KEY --export $AK_FINGERPRINT +gpg2 --homedir $AK_GPGHOME --armour --output $KEY --export $AK_FINGERPRINT GPG_PUB_KEY=$(ak-ipfs-add $KEY) rm $KEY diff --git a/bin/ak-data-expand b/bin/ak-data-expand index fc089c3..862fa75 100755 --- a/bin/ak-data-expand +++ b/bin/ak-data-expand @@ -64,7 +64,7 @@ then logit "[ERROR]" "Could not get GPG key: $gpg" exit 1 fi - gpg2 --import $gpg > /dev/null 2>&1 + gpg2 --homedir $AK_GPGHOME --import $gpg > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not import GPG key: $gpg" @@ -85,7 +85,7 @@ then exit 1 fi logit "[INFO]" "Data downloaded: $DATA" - gpg2 --verify $DATA.asc $DATA > /dev/null 2>&1 + gpg2 --homedir $AK_GPGHOME --verify $DATA.asc $DATA > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while verifying signature for $DATA" diff --git a/bin/ak-enter b/bin/ak-enter index 7d04693..64ef5a0 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -232,7 +232,7 @@ do logit "[ERROR]" "Could not get GPG key: $gpg ." exit 1 fi - gpg2 --import $gpg > /dev/null 2>&1 + gpg2 --homedir $AK_GPGHOME --import $gpg > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not import GPG key: $gpg ." @@ -255,7 +255,7 @@ do fi logit "[INFO]" "Downloaded block $block." - gpg2 --verify $block.asc > /dev/null 2>&1 + gpg2 --homedir $AK_GPGHOME --verify $block.asc > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "Could not verify $block with GPG key $gpg." diff --git a/bin/ak-files b/bin/ak-files index d663d59..6e36b51 100755 --- a/bin/ak-files +++ b/bin/ak-files @@ -63,7 +63,7 @@ main(){ fi logit "[INFO]" "Signing..." SIGN_FILE=$FILENAME".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILE if [ $? == 0 ]; then logit "[INFO]" "Signed" else diff --git a/bin/ak-mixtapes b/bin/ak-mixtapes index 8c6089d..adbe52c 100755 --- a/bin/ak-mixtapes +++ b/bin/ak-mixtapes @@ -13,7 +13,7 @@ main(){ MIXTAPE_IPFS_HASH=$(ak-ipfs-add $MIXTAPE_FILE) MIXTAPE_SIGN_FILE=$MIXTAPE_FILE".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MIXTAPE_SIGN_FILE $MIXTAPE_FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MIXTAPE_SIGN_FILE $MIXTAPE_FILE MIXTAPE_SIGNATURE=$(ak-ipfs-add $MIXTAPE_SIGN_FILE) diff --git a/bin/ak-news b/bin/ak-news index 2c0e9de..5103371 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -90,7 +90,7 @@ add2(){ TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { @@ -124,7 +124,7 @@ add(){ TITLE=$(head -n 1 $ZNEWSDIR/$FILE) FILE_IPFS_HASH=$(ak-ipfs-add $ZNEWSDIR/$FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $ZNEWSDIR/$FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $ZNEWSDIR/$FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-pack_z_block b/bin/ak-pack_z_block index 63f4a4e..4c3ae16 100755 --- a/bin/ak-pack_z_block +++ b/bin/ak-pack_z_block @@ -12,7 +12,7 @@ #AK_FINGERPRINT="CHANGE THIS TO YOUR DEFAULT AK_FINGERPRINT" # We acquire the GPG fingerprint by email address # The following example finds kaos@kaos.kaos' GPG fingerprint like this -# AK_FINGERPRINT="$(gpg2 --list-keys | grep kaos@kaos.kaos -1 | head -n1 | awk '{print $1}')" +# AK_FINGERPRINT="$(gpg2 --homedir $AK_GPGHOME --list-keys | grep kaos@kaos.kaos -1 | head -n1 | awk '{print $1}')" PROGRAM="$(basename $0)" set -xe @@ -60,14 +60,14 @@ main(){ # We create a detached and armor signature of it MESSAGE_SIGN_FILE=$MESSAGE".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MESSAGE_SIGN_FILE $MESSAGE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MESSAGE_SIGN_FILE $MESSAGE # We add the signature to IPFS MESSAGE_SIGNATURE=$(ak-ipfs-add $MESSAGE_SIGN_FILE) # We will be using our public key also to put it in the block later KEY="gpg.pub" - gpg2 --armour --output $KEY --export $AK_FINGERPRINT + gpg2 --homedir $AK_GPGHOME --armour --output $KEY --export $AK_FINGERPRINT GPG_PUB_KEY=$(ak-ipfs-add $KEY) # Acquire last block of information, to chain this one with previous posted @@ -78,7 +78,7 @@ main(){ BLOCK="block" BLOCK_SIG=$BLOCK".asc" # We have a block now, so we sign it - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $BLOCK_SIG $BLOCK + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $BLOCK_SIG $BLOCK # We now add the signature to IPFS BLOCK_SIGNATURE=$(ak-ipfs-add $BLOCK_SIG) diff --git a/bin/ak-profile b/bin/ak-profile index b17decb..42509ee 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -156,7 +156,7 @@ add(){ echo "Adding from " $FILE FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$(pwd)/$1".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-reference b/bin/ak-reference index 174b48c..f86983e 100755 --- a/bin/ak-reference +++ b/bin/ak-reference @@ -85,7 +85,7 @@ add(){ DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-sm-files b/bin/ak-sm-files index 5868a61..5d278de 100755 --- a/bin/ak-sm-files +++ b/bin/ak-sm-files @@ -77,7 +77,7 @@ main(){ logit "[INFO]" "Signing..." SIGN_FILE=$FILENAME".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILENAME + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $FILENAME if [ $? == 0 ]; then logit "[INFO]" "Signed" else diff --git a/bin/ak-todos b/bin/ak-todos index 5be7745..35cfeda 100755 --- a/bin/ak-todos +++ b/bin/ak-todos @@ -80,7 +80,7 @@ add(){ TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(ak-ipfs-add $FILE) FILE_SIGN_FILE=$FILE".asc" - gpg --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE FILE_SIGNATURE=$(ak-ipfs-add $FILE_SIGN_FILE) cat > data <<EOF { diff --git a/bin/ak-transactions b/bin/ak-transactions index cc7dddd..4dd659c 100755 --- a/bin/ak-transactions +++ b/bin/ak-transactions @@ -20,7 +20,7 @@ EOF FILE_IPFS_HASH=$(ak-ipfs-add $TRANSACTION_FILE) SIGN_FILE=$TRANSACTION_FILE".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $TRANSACTION_FILE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $SIGN_FILE $TRANSACTION_FILE FILE_SIGNATURE=$(ak-ipfs-add $SIGN_FILE) diff --git a/bin/ak-zblock-manipulator b/bin/ak-zblock-manipulator index 2f75fbf..89c8454 100755 --- a/bin/ak-zblock-manipulator +++ b/bin/ak-zblock-manipulator @@ -12,7 +12,7 @@ #FINGERPRINT="CHANGE THIS TO YOUR DEFAULT FINGERPRINT" # We acquire the GPG fingerprint by email address # The following example finds kaos@kaos.kaos' GPG fingerprint like this -# FINGERPRINT="$(gpg2 --list-keys | grep kaos@kaos.kaos -1 | head -n1 | awk '{print $1}')" +# FINGERPRINT="$(gpg2 --homedir $AK_GPGHOME --list-keys | grep kaos@kaos.kaos -1 | head -n1 | awk '{print $1}')" # Below, the usage information PROGRAM="zblock_manipulator" @@ -49,14 +49,14 @@ main(){ # We create a detached and armor signature of it MESSAGE_SIGN_FILE=$MESSAGE".asc" - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MESSAGE_SIGN_FILE $MESSAGE + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $MESSAGE_SIGN_FILE $MESSAGE # We add the signature to IPFS MESSAGE_SIGNATURE=$(ak-ipfs-add $MESSAGE_SIGN_FILE) # We will be using our public key also to put it in the block later KEY="gpg.pub" - gpg2 --armour --output $KEY --export $AK_FINGERPRINT + gpg2 --homedir $AK_GPGHOME --armour --output $KEY --export $AK_FINGERPRINT GPG_PUB_KEY=$(ak-ipfs-add $KEY) # Acquire last block of information, to chain this one with previous posted @@ -78,7 +78,7 @@ makeZBlock(){ BLOCK="block" BLOCK_SIG=$BLOCK".asc" # We have a block now, so we sign it - gpg2 --detach-sign --sign-with $AK_FINGERPRINT --armor --output $BLOCK_SIG $BLOCK + gpg2 --homedir $AK_GPGHOME --detach-sign --sign-with $AK_FINGERPRINT --armor --output $BLOCK_SIG $BLOCK # We now add the signature to IPFS BLOCK_SIGNATURE=$(ak-ipfs-add $BLOCK_SIG) @@ -21,4 +21,5 @@ export AK_FINGERPRINT="$(gpg --list-keys | grep test@test.test -1 | head -n1 | a export AK_MINEDBLOCKS="$AK_WORKDIR/mined_blocks/" export AK_ZBLOCKSFILE="$AK_WORKDIR/zBlocksFile" export AK_ZPAIRSFILE="$AK_WORKDIR/pairsFile" +export AK_GPGHOME="$AK_WORKDIR/keyring/" @@ -14,6 +14,7 @@ if [[ ! -f $AK_GENESIS ]]; then touch $AK_GENESIS;fi if [[ ! -f $AK_MINEDBLOCKS ]]; then mkdir $AK_MINEDBLOCKS; fi if [[ ! -f $AK_ZBLOCKSFILE ]]; then mkdir $AK_ZBLOCKSFILE; fi if [[ ! -f $AK_ZPAIRSFILE ]]; then mkdir $AK_ZPAIRSFILE; fi +if [[ ! -d $AK_GPGHOME ]]; then mkdir $AK_GPGHOME && chmod 700 -R $AK_GPGHOME; fi touch $AK_WORKDIR/logs logthis(){ |