From caf7402a035c8ff5adf308d6721eeef56ea38f66 Mon Sep 17 00:00:00 2001 From: Stas Alekseev Date: Mon, 23 Mar 2015 15:07:26 -0400 Subject: [PATCH 1/2] Adding support for perforce vcs. --- bin/_blackbox_common.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bin/_blackbox_common.sh b/bin/_blackbox_common.sh index 9e60c8a..420af23 100755 --- a/bin/_blackbox_common.sh +++ b/bin/_blackbox_common.sh @@ -349,6 +349,17 @@ function is_in_svn() { echo false fi } +# Perforce +function is_in_p4() { + local filename + filename="$1" + + if p4 list "$filename" ; then + echo true + else + echo false + fi +} # Add a file to the repo (but don't commit it). @@ -367,6 +378,10 @@ function vcs_add_git() { function vcs_add_svn() { svn add --parents """$@""" } +# Perfoce +function vcs_add_p4() { + p4 add """$@""" +} # Commit a file to the repo @@ -385,6 +400,10 @@ function vcs_commit_git() { function vcs_commit_svn() { svn commit -m"""$@""" } +# Perforce +function vcs_commit_p4() { + p4 submit -d """$@""" +} # Remove file from repo, even if it was deleted locally already. @@ -404,3 +423,7 @@ function vcs_remove_git() { function vcs_remove_svn() { svn delete """$@""" } +# Perforce +function vcs_remove_svn() { + p4 delete """$@""" +} From 6185f50942a1a334bfd16a4e392eaca3102b161c Mon Sep 17 00:00:00 2001 From: Stas Alekseev Date: Tue, 24 Mar 2015 10:39:36 -0400 Subject: [PATCH 2/2] Adding Perforce to README --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aea66b4..0576dc3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ BlackBox ======== -Safely store secrets in a VCS repo (i.e. Git, Mercurial, or Subversion). These +Safely store secrets in a VCS repo (i.e. Git, Mercurial, Subversion or Perforce). These commands make it easy for you to Gnu Privacy Guard (GPG) encrypt specific files in a repo so they are "encrypted at rest" in your repository. However, the scripts @@ -42,16 +42,16 @@ files. Simply set up a GPG key for the Puppet master (or the role account that pushes new files to the Puppet master) and have that user run `blackbox_postdeploy` after any files are updated. -Getting started is easy. Just `cd` into a Git, Mercurial or Subversion -repository and run `blackbox_initialize`. After that, if a file is to +Getting started is easy. Just `cd` into a Git, Mercurial, Subversion or +Perforce repository and run `blackbox_initialize`. After that, if a file is to be encrypted, run `blackbox_register_new_file` and you are done. Add and remove keys with `blackbox_addadmin` and `blackbox_removeadmin`. To view and/or edit a file, run `blackbox_edit`; this will decrypt the file and open with whatever is specified by your $EDITOR environment -variable. When you close the editor the file will automatically be +variable. When you close the editor the file will automatically be encrypted again and the temporary plaintext file will be shredded. If you need to leave the file decrypted while you update you can use the -`blackbox_edit_start` to decrypt the file and `blackbox_edit_end` when +`blackbox_edit_start` to decrypt the file and `blackbox_edit_end` when you want to "put it back in the box." @@ -116,6 +116,7 @@ It has been tested to work with many operating systems. * `git` -- The Git * `hg` -- Mercurial * `svn` -- SubVersion (Thanks, Ben Drasin!) + * `p4` -- Perforce * Operating system * CentOS / RedHat * MacOS X @@ -132,7 +133,7 @@ Note: Cywin support requires the following packages: * Normal operation: * gnupg - * git or mercurial or subversion (as appropriate) + * git or mercurial or subversion or perforce (as appropriate) * Development (if you will be adding code and want to run the confidence test) * procps * make