This solves some TODOs by moving shared code out into `_blackbox_common.sh`. New VCS commands were added, `vcs_ignore` and `vcs_notice` (the opposite of ignore). Made some utility functions * `remove_filename_from_cryptlist` - The opposite of `add_file_to_cryptlist` * `remove_line` - Removes a single line from a text file
41 lines
1014 B
Bash
Executable File
41 lines
1014 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#
|
|
# blackbox_initialize -- Enable blackbox for a GIT or HG repo.
|
|
#
|
|
#
|
|
# Example:
|
|
# blackbox_initialize
|
|
#
|
|
|
|
set -e
|
|
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
source "${blackbox_home}/_blackbox_common.sh"
|
|
|
|
_determine_vcs_base_and_type # Sets VCS_TYPE
|
|
|
|
if [[ $1 != 'yes' ]]; then
|
|
read -r -p "Enable blackbox for this $VCS_TYPE repo? (yes/no) " ans
|
|
if [[ $ans = 'no' || $ans = 'n' || $ans = '' ]]; then
|
|
echo 'Exiting...'
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
change_to_vcs_root
|
|
|
|
echo VCS_TYPE: $VCS_TYPE
|
|
vcs_ignore keyrings/live/pubring.gpg~ keyrings/live/pubring.kbx~ keyrings/live/secring.gpg
|
|
|
|
# Make directories
|
|
mkdir -p "${KEYRINGDIR}"
|
|
vcs_add "${KEYRINGDIR}"
|
|
touch "$BLACKBOXDATA/$BB_ADMINS_FILE" "$BLACKBOXDATA/$BB_FILES_FILE"
|
|
vcs_add "$IGNOREFILE" "$BLACKBOXDATA/$BB_ADMINS_FILE" "$BLACKBOXDATA/$BB_FILES_FILE"
|
|
|
|
# Make a suggestion:
|
|
echo
|
|
echo
|
|
echo 'NEXT STEP: You need to manually check these in:'
|
|
echo ' ' $VCS_TYPE commit -m\'INITIALIZE BLACKBOX\' keyrings "$IGNOREFILE"
|