Update comments and add newly added files to packages.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# Library functions for bash scripts at Stack Exchange.
|
||||
|
||||
# NOTE: This file is open sourced. Do not put Stack-proprietary code here.
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# set -e
|
||||
# . _stack_lib.sh
|
||||
|
||||
@@ -46,6 +49,48 @@ function add_on_exit()
|
||||
fi
|
||||
}
|
||||
|
||||
function create_self_deleting_tempfile() {
|
||||
local filename
|
||||
|
||||
case $(uname -s) in
|
||||
Darwin )
|
||||
: ${TMPDIR:=/tmp} ;
|
||||
filename=$(mktemp -t _stacklib_ )
|
||||
;;
|
||||
Linux )
|
||||
filename=$(mktemp)
|
||||
;;
|
||||
* )
|
||||
echo 'ERROR: Unknown OS. Exiting.'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
add_on_exit rm -f "$filename"
|
||||
echo "$filename"
|
||||
}
|
||||
|
||||
function create_self_deleting_tempdir() {
|
||||
local filename
|
||||
|
||||
case $(uname -s) in
|
||||
Darwin )
|
||||
: ${TMPDIR:=/tmp} ;
|
||||
filename=$(mktemp -d -t _stacklib_ )
|
||||
;;
|
||||
Linux )
|
||||
filename=$(mktemp -d)
|
||||
;;
|
||||
* )
|
||||
echo 'ERROR: Unknown OS. Exiting.'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
add_on_exit rm -rf "$filename"
|
||||
echo "$filename"
|
||||
}
|
||||
|
||||
# Securely and portably create a temporary file that will be deleted
|
||||
# on EXIT. $1 is the variable name to store the result.
|
||||
function make_self_deleting_tempfile() {
|
||||
@@ -55,14 +100,11 @@ function make_self_deleting_tempfile() {
|
||||
case $(uname -s) in
|
||||
Darwin )
|
||||
: ${TMPDIR:=/tmp} ;
|
||||
name=$(mktemp -t _stacklib_.XXXXXXX )
|
||||
name=$(mktemp -t _stacklib_ )
|
||||
;;
|
||||
Linux )
|
||||
name=$(mktemp)
|
||||
;;
|
||||
CYGWIN* )
|
||||
name=$(mktemp)
|
||||
;;
|
||||
* )
|
||||
echo 'ERROR: Unknown OS. Exiting.'
|
||||
exit 1
|
||||
@@ -79,15 +121,12 @@ function make_tempdir() {
|
||||
|
||||
case $(uname -s) in
|
||||
Darwin )
|
||||
: "${TMPDIR:=/tmp}" ;
|
||||
: ${TMPDIR:=/tmp} ;
|
||||
name=$(mktemp -d -t _stacklib_ )
|
||||
;;
|
||||
Linux )
|
||||
name=$(mktemp -d)
|
||||
;;
|
||||
CYGWIN* )
|
||||
name=$(mktemp -d)
|
||||
;;
|
||||
* )
|
||||
echo 'ERROR: Unknown OS. Exiting.'
|
||||
exit 1
|
||||
@@ -99,12 +138,12 @@ function make_tempdir() {
|
||||
|
||||
function make_self_deleting_tempdir() {
|
||||
local __resultvar="$1"
|
||||
local dirname
|
||||
local dname
|
||||
|
||||
make_tempdir dirname
|
||||
make_tempdir dname
|
||||
|
||||
add_on_exit rm -rf "$dirname"
|
||||
eval $__resultvar="$dirname"
|
||||
add_on_exit rm -rf "$dname"
|
||||
eval $__resultvar="$dname"
|
||||
}
|
||||
|
||||
function fail_if_not_running_as_root() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blackbox_cat.sh -- Decrypt a file, cat it, shred it
|
||||
# blackbox_cat -- Decrypt a file, cat it, shred it
|
||||
#
|
||||
set -e
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blacbox_decrypt_all_files -- Decrypt all blackbox files.
|
||||
# blacbox_decrypt_all_files -- Decrypt all blackbox files (INTERACTIVE).
|
||||
#
|
||||
|
||||
# Usage:
|
||||
@@ -15,6 +15,8 @@ export PATH=/usr/bin:/bin:"$PATH"
|
||||
|
||||
set -e
|
||||
|
||||
eval $(gpg-agent --daemon)
|
||||
if [[ -z $GPG_AGENT_INFO ]]; then
|
||||
eval $(gpg-agent --daemon)
|
||||
fi
|
||||
|
||||
exec blackbox_postdeploy.sh "$@"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blackbox_edit.sh -- Decrypt a file temporarily for edition, then re-encrypts it again
|
||||
# blackbox_edit -- Decrypt a file temporarily for edition, then re-encrypts it again
|
||||
#
|
||||
set -e
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blackbox_edit_start.sh -- Decrypt a file for editing.
|
||||
# blackbox_edit_start -- Decrypt a file for editing.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blackbox_list_files.sh -- List files that black box is tracking
|
||||
# blackbox_list_files -- List files that black box is tracking
|
||||
#
|
||||
set -e
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# blackbox_register_new_file.sh -- Enroll a new file in the blackbox system.
|
||||
# blackbox_register_new_file -- Enroll a new file in the blackbox system.
|
||||
#
|
||||
# Takes a previously unencrypted file and enrolls it into the blackbox
|
||||
# system. It will be kept in the repo as an encrypted file. On deployment
|
||||
|
||||
Reference in New Issue
Block a user