Commit ef94ab87 authored by anonym's avatar anonym
Browse files

Merge remote-tracking branch 'origin/bugfix/12685-clean-shell-library' into devel

Fix-committed: #12685
parents 4dbfdf05 676115d5
......@@ -3,20 +3,6 @@
# Import is_package_installed
. /usr/local/lib/tails-shell-library/common.sh
faketime_wrapper() {
apt-get --yes install faketime
faketime "${@}"
apt-get --yes purge faketime '^libfaketime*'
}
faketime_sde_wrapper() {
if [ -z "${SOURCE_DATE_EPOCH}" ]; then
echo "SOURCE_DATE_EPOCH was not set!" >&2
exit 1
fi
faketime_wrapper "$(date -d '@${SOURCE_DATE_EPOCH}')" "${@}"
}
strip_nondeterminism_wrapper() {
apt-get --yes install strip-nondeterminism
strip-nondeterminism "${@}"
......
......@@ -36,30 +36,6 @@ try_for() {
wait_until "${@}"
}
# Sets the `value` of a `key` in a simple configuration `file`. With
# "simple" you should think something like a the shell environment as
# output by the `env` command. Hence this is only useful for
# configuration files that have no structure (e.g. sections with
# semantic meaning, like the namespace secions in .gitconfig), allow
# only one assignment per line, and a fixed/static assignment operator
# (`op`, which defaults to '=', but other examples would be " = " or
# torrc's " "). If the key already exists its value is updated in
# place, otherwise it's added at the end.
set_simple_config_key() {
local file="${1}"
local key="${2}"
local value="${3}"
local op="${4:-=}"
if grep -q "^${key}${op}" "${file}"; then
# Escape / in input so it can be used as the sed separator
key="$(echo "${key}" | sed 's,/,\\/,g')"
value="$(echo "${value}" | sed 's,/,\\/,g')"
sed -i "s/^${key}${op}.*$/${key}${op}${value}/" "${file}"
else
echo "${key}${op}${value}" >> "${file}"
fi
}
# Runs the wrapped command while temporarily disabling `set -e`, if
# enabled. It will always return 0 to not make scripts with `set -e`
# enabled abort but will instead store the wrapped command's return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment