73 | 73 |
}
|
74 | 74 |
|
75 | 75 |
email() {
|
76 | |
debug "* email $@"
|
|
76 |
debug "* email $@ to $EMAIL_ADDRESS"
|
77 | 77 |
local subject="`current_system` - $_MAIL_SUBJECT : $1"
|
78 | 78 |
if [ $ENCRYPT_EMAIL = "yes" ]; then
|
79 | 79 |
LC_ALL="$LOCALE" gpg --batch --armor --encrypt \
|
|
187 | 187 |
_CHANGELOG_DIR="$CHANGELOG_DIR"
|
188 | 188 |
_CHANGELOG_FILE="$CHANGELOG_FILE"
|
189 | 189 |
_DO_PACKAGES="$DO_PACKAGES"
|
|
190 |
_EMAIL_ADDRESS="$EMAIL_ADDRESS"
|
190 | 191 |
|
191 | 192 |
if [ -n "$VSNAMES" ]; then
|
192 | 193 |
# check VSERVERINFO and VSERVER availability
|
|
217 | 218 |
if [ "$ENCRYPT_EMAIL" = "yes" ]; then
|
218 | 219 |
which gpg > /dev/null ||
|
219 | 220 |
executable_not_found "gpg" "GnuPG" "ENCRYPT_EMAIL"
|
220 | |
gpg --batch --list-public-keys $EMAIL_ADDRESS >/dev/null 2>&1 ||
|
221 | |
fatal "GnuPG public key for $EMAIL_ADDRESS not found."
|
222 | 221 |
fi
|
223 | 222 |
|
224 | 223 |
DATE=`date "+%Y%m%d%H%M"`
|
|
260 | 259 |
# - 2 if $1 is not an existing VServer
|
261 | 260 |
# - 3 if $1 is not a VServer listed in VSNAMES
|
262 | 261 |
# - 4 if $1 is not a running VServer
|
|
262 |
# Anyway, return with exit-code:
|
|
263 |
# - 5 if the GnuPG public key can not be found
|
263 | 264 |
context_config() {
|
264 | 265 |
local vsname="$1"
|
|
266 |
local res
|
265 | 267 |
debug "-------- Operating on" \
|
266 | 268 |
"`if [ -z $vsname ]; then echo 'the host system'; else echo VServer $vsname; fi`"
|
267 | 269 |
debug "* context_config"
|
|
274 | 276 |
WATCHED_DIR="$_WATCHED_DIR"
|
275 | 277 |
BACKUP_DIR="$_BACKUP_DIR"
|
276 | 278 |
VSERVER_EXEC_PREFIX=""
|
|
279 |
EMAIL_ADDRESS="$_EMAIL_ADDRESS"
|
277 | 280 |
else
|
278 | 281 |
WATCHED_DIR="$VROOTDIR/$vsname/$_WATCHED_DIR"
|
279 | 282 |
BACKUP_DIR="$_BACKUP_DIR/$vsname"
|
280 | 283 |
VSERVER_EXEC_PREFIX="$VSERVER $vsname exec"
|
|
284 |
EMAIL_ADDRESS="root@`current_system`"
|
281 | 285 |
# does the current VServer exist ?
|
282 | 286 |
if [ ! -d "$VROOTDIR/$vsname" ]; then
|
283 | 287 |
warning " VServer $vsname does not exist (error 2)."
|
|
301 | 305 |
if [ "$res" = failed ]; then
|
302 | 306 |
warning " VServer $vsname is not running (error 4)."
|
303 | 307 |
return 4
|
|
308 |
fi
|
|
309 |
fi
|
|
310 |
|
|
311 |
# E-mail encryption
|
|
312 |
if [ $ENCRYPT_EMAIL = "yes" ]; then
|
|
313 |
gpg --batch --list-public-keys $EMAIL_ADDRESS >/dev/null 2>&1
|
|
314 |
res=$?
|
|
315 |
if [ $res -ne 0 ]; then
|
|
316 |
warning " GnuPG public key for $EMAIL_ADDRESS not found."
|
|
317 |
return 5
|
304 | 318 |
fi
|
305 | 319 |
fi
|
306 | 320 |
|