git-sig/test/test_helper.bash

26 lines
658 B
Bash
Raw Normal View History

2020-11-18 23:23:15 +00:00
#!/bin/bash
setup(){
2020-11-19 21:40:38 +00:00
test -f /usr/bin/git || sudo apt install --reinstall -y git
test -f /usr/bin/getopt || sudo apt install --reinstall -y util-linux
test -f /usr/bin/gpg || sudo apt install --reinstall -y gpg
test -f /usr/bin/openssl || sudo apt install --reinstall -y openssl
bin_dir=/tmp/bin
temp_dir=$(mktemp -d -t test-XXXXXXXXXX)
mkdir -p /tmp/bin
cp /home/test/sig/sig /tmp/bin/sig
export PATH=${bin_dir}:${PATH}
cd "$temp_dir" || return 1
2020-11-18 23:23:15 +00:00
}
teardown(){
rm -rf "$temp_dir"
2020-11-18 23:23:15 +00:00
}
set_identity(){
local -r name="${1?}"
echo "set key to $name"
git config --global user.email "${name}@example.com"
git config --global user.name "${name}"
}