check deps removed
This commit is contained in:
parent
9e1a065f6e
commit
78fddc8358
17
backup.sh
17
backup.sh
@ -39,7 +39,7 @@ function find_usb() {
|
||||
for DISK in `ls -l /dev/disk/by-id/usb* | grep -v part | awk -F/ '{print $NF}'`; do
|
||||
DEV="/dev/$DISK"
|
||||
for PARTITION in `ls -1 $DEV* | grep "[0-9]$"`; do
|
||||
cryptsetup isLuks $PARTITION
|
||||
/usr/sbin/cryptsetup isLuks $PARTITION
|
||||
if [ $? = 0 ]; then
|
||||
USB_PARTITION=$PARTITION
|
||||
return 0
|
||||
@ -53,7 +53,7 @@ function find_usb() {
|
||||
}
|
||||
|
||||
function mount_usb() {
|
||||
echo $LUKS_PASS | cryptsetup luksOpen $USB_PARTITION crypted_usb
|
||||
echo $LUKS_PASS | /usr/sbin/cryptsetup luksOpen $USB_PARTITION crypted_usb
|
||||
if [ $? = 0 ]; then
|
||||
log "[ OK ] $USB_PARTITION decrypted"
|
||||
/usr/bin/mount /dev/mapper/crypted_usb /mnt/usb
|
||||
@ -181,17 +181,6 @@ function umount() {
|
||||
exit
|
||||
}
|
||||
|
||||
function check_depentencies() {
|
||||
commands=(rsync cryptsetup curl jq)
|
||||
for command in "${commands[@]}"
|
||||
do
|
||||
if ! command -v ${command} > /dev/null; then
|
||||
log "Command $command not found"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function send_mail() {
|
||||
COPIED=$( cat ${LOG} | grep "Number of created files:" | awk {'print $5'} )
|
||||
DELETED=$( cat ${LOG} | grep "Number of deleted files:" | awk {'print $5'} )
|
||||
@ -207,7 +196,6 @@ function main () {
|
||||
log "DESTINATION : $USB_MOUNT$DST"
|
||||
log "WITH DELETE : ${DELETE:-"No (default)"}"
|
||||
log ""
|
||||
if check_depentencies; then
|
||||
if get_luks_password; then
|
||||
if find_usb; then
|
||||
if mount_usb; then
|
||||
@ -218,7 +206,6 @@ function main () {
|
||||
send_mail
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
for i in "$@"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user