blob: ebe0bc97c28acb5a12ee09e3f390eb85be7057b9 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/bash
# Set needed environment variables and do basic checks.
function hydra_set_env {
export CONFIG="$HOME/.hydra/config"
export ACTION="$1"
if [ ! -z "$HYDRA" ]; then
export PREFERENCES="$HOME/.hydra/$HYDRA"
fi
}
# Read a parameter from user
function hydra_user_input {
local input
param="$1"
default="$2"
shift 2
read -rep "$* (defaults to $default): " input
if [ -z "$input" ]; then
export $param=$default
else
export $param=$input
fi
}
# Install a package.
function hydra_install_package {
if [ -z "$1" ]; then
return
fi
dpkg -s $1 &> /dev/null
if [ "$?" == "1" ]; then
apt-get install $1 -y
fi
}
|