blob: 4b47c7e1cad043114ffb47b4fc78f5451f61e78c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# vim: ft=sh
# Ask if given section should be installed
# First argument is name (take care not to use special characters for regulard
# expression) and second argument is a question
ask() {
local ignore_file
ignore_file=".ignore-$(hostname)"
[ -f "$ignore_file" ] && grep -q "^$1$" "$ignore_file" && return 1
if $FORCE; then
echo "\e[1;34m$2\e[0m"
# Fall trough with 0 exit (always yes)
else
echo -e -n "\e[1;34m$2? (Y/n) \e[0m"
local reply
read -r reply
echo "$reply" | grep -qE '^[Yy]?$'
fi
}
# Check if command is available
hascmd() {
command -v "$1" >/dev/null 2>&1
}
|