diff --git a/README.md b/README.md index 21d2dbe..8831e99 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,8 +42,8 @@ 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 @@ -117,6 +117,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 @@ -133,7 +134,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 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 """$@""" +}