Changeset - bc975515fcbd
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-06-29 04:17:40
branko@majic.rs
Added some git integration for the init command. The script will now add the .gnupg to the changeset, and also include a .gitignore file.
1 file changed with 31 insertions and 0 deletions:
0 comments (0 inline, 0 general)
openpgp/gitprotect.sh
Show inline comments
 
@@ -201,6 +201,37 @@ if [[ $command == "init" ]]; then
 

	
 
    # Initialise the GnuPG files in local directory.
 
    gpg2 --batch --homedir "$gnupgHome" --list-keys 2>/dev/null
 

	
 
    # Set-up a .gitignore file that will exclude some temporary files from being
 
    # tracked, as well as decrypted files.
 
    cat <<EOF >> .gitignore
 
# BEGIN gitprotect.sh
 
.gnupg/pubring.gpg~
 
.gnupg/random_seed
 
.gnupg/secring.gpg
 
decrypted/
 
# END gitprotect.sh
 
EOF
 
    # Add the empty keyring and gitignore file to the index so they can be
 
    # committed by the user.
 
    git add .gnupg/
 
    git add .gitignore
 
    cat <<EOF
 
$program has set-up the repository directory for encryption. Before proceeding,
 
please commit the changes. The commit includes empty public and trust keryings for
 
GnuPG, and gitignore file that prevents inclusion of decrypted files and
 
temporary GnuPG files.
 

	
 
Before proceeding with the commit, verify the changes with:
 

	
 
git status --staged .
 

	
 
After you have verfied the changes, commit the changes with (you may specify
 
alternative message):
 

	
 
git commit .gnupg .gitignore -m "Configured directory for use with gitprotect.sh"
 

	
 
EOF
 
elif [[ $command == "addkey" ]]; then
 
    gitprotectConfigured || exit "$ERR_NOCONFIG"
 

	
0 comments (0 inline, 0 general)