mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-29 08:14:08 +00:00
parent
f7057b7d03
commit
7918161803
26
tomb
26
tomb
@ -174,18 +174,18 @@ tmp_new() {
|
|||||||
check_swap() {
|
check_swap() {
|
||||||
# Return 0 if NO swap is used, 1 if swap is used
|
# Return 0 if NO swap is used, 1 if swap is used
|
||||||
# Return 2 if swap(s) is(are) used, but ALL encrypted
|
# Return 2 if swap(s) is(are) used, but ALL encrypted
|
||||||
local swaps="$(awk '/^\// { print $1 }' /proc/swaps 2>-)"
|
local swaps="$(awk '/^\// { print $1 }' /proc/swaps 2>/dev/null)"
|
||||||
[[ -z "$swaps" ]] && return 0 # No swap partition is active
|
[[ -z "$swaps" ]] && return 0 # No swap partition is active
|
||||||
# Check whether all swaps are encrypted, and return 2
|
# Check whether all swaps are encrypted, and return 2
|
||||||
# If any of the swaps is not encrypted, we bail out and return 1.
|
# If any of the swaps is not encrypted, we bail out and return 1.
|
||||||
ret=1
|
ret=1
|
||||||
for s in $=swaps; do
|
for s in $=swaps; do
|
||||||
bone=`sudo file $s`
|
bone=`sudo file $s`
|
||||||
if `echo "$bone" | grep 'swap file' &>-`; then
|
if [[ "$bone" =~ "swap file" ]]; then
|
||||||
# It's a regular (unencrypted) swap file
|
# It's a regular (unencrypted) swap file
|
||||||
ret=1
|
ret=1
|
||||||
break
|
break
|
||||||
elif `echo "$bone" | grep 'symbolic link' &>-`; then
|
elif [[ "$bone" =~ "symbolic link" ]]; then
|
||||||
# Might link to a block
|
# Might link to a block
|
||||||
ret=1
|
ret=1
|
||||||
if [ "/dev/mapper" = "${s%/*}" ]; then
|
if [ "/dev/mapper" = "${s%/*}" ]; then
|
||||||
@ -196,7 +196,7 @@ check_swap() {
|
|||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
elif `echo "$bone" | grep 'block special' &>-`; then
|
elif [[ "$bone" =~ "block special" ]]; then
|
||||||
# Is a block
|
# Is a block
|
||||||
ret=1
|
ret=1
|
||||||
is_crypt=`sudo dmsetup status "$s" | awk '/crypt/ {print $3}'`
|
is_crypt=`sudo dmsetup status "$s" | awk '/crypt/ {print $3}'`
|
||||||
@ -252,7 +252,7 @@ ask_password() {
|
|||||||
title="Insert tomb password."
|
title="Insert tomb password."
|
||||||
if [ $2 ]; then title="$2"; fi
|
if [ $2 ]; then title="$2"; fi
|
||||||
|
|
||||||
output=`cat <<EOF | GTK2_RC_FILES=${GTK2_RC} pinentry 2>- | tail -n +7
|
output=`cat <<EOF | GTK2_RC_FILES=${GTK2_RC} pinentry 2>/dev/null | tail -n +7
|
||||||
OPTION ttyname=$TTY
|
OPTION ttyname=$TTY
|
||||||
OPTION lc-ctype=$LANG
|
OPTION lc-ctype=$LANG
|
||||||
SETTITLE $title
|
SETTITLE $title
|
||||||
@ -289,7 +289,7 @@ check_priv() {
|
|||||||
|
|
||||||
if ! option_is_set --sudo-pwd; then
|
if ! option_is_set --sudo-pwd; then
|
||||||
if [ $? != 0 ]; then # if not then ask a password
|
if [ $? != 0 ]; then # if not then ask a password
|
||||||
cat <<EOF | pinentry 2>- | awk '/^D / { sub(/^D /, ""); print }' | sudo -S -v
|
cat <<EOF | pinentry 2>/dev/null | awk '/^D / { sub(/^D /, ""); print }' | sudo -S -v
|
||||||
OPTION ttyname=$TTY
|
OPTION ttyname=$TTY
|
||||||
OPTION lc-ctype=$LANG
|
OPTION lc-ctype=$LANG
|
||||||
SETTITLE Super user privileges required
|
SETTITLE Super user privileges required
|
||||||
@ -748,7 +748,7 @@ get_lukskey() {
|
|||||||
case `cut -d_ -f 3 <<<$firstline` in
|
case `cut -d_ -f 3 <<<$firstline` in
|
||||||
pbkdf2sha1)
|
pbkdf2sha1)
|
||||||
pbkdf2_param=`cut -d_ -f 4- <<<$firstline | tr '_' ' '`
|
pbkdf2_param=`cut -d_ -f 4- <<<$firstline | tr '_' ' '`
|
||||||
_password=$(tomb-kdb-pbkdf2 ${=pbkdf2_param} 2>- <<<$_password)
|
_password=$(tomb-kdb-pbkdf2 ${=pbkdf2_param} 2>/dev/null <<<$_password)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_failure "No suitable program for KDF `cut -f 3 <<<$firstline`."
|
_failure "No suitable program for KDF `cut -f 3 <<<$firstline`."
|
||||||
@ -1682,7 +1682,7 @@ exec_safe_bind_hooks() {
|
|||||||
fi
|
fi
|
||||||
local MOUNTPOINT="${1}"
|
local MOUNTPOINT="${1}"
|
||||||
local ME=${SUDO_USER:-$(whoami)}
|
local ME=${SUDO_USER:-$(whoami)}
|
||||||
local HOME=$(awk -v a="$ME" -F ':' '{if ($1 == a) print $6}' /etc/passwd 2>-)
|
local HOME=$(awk -v a="$ME" -F ':' '{if ($1 == a) print $6}' /etc/passwd 2>/dev/null)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_warning "How pitiful! A tomb, and no HOME."
|
_warning "How pitiful! A tomb, and no HOME."
|
||||||
return 1
|
return 1
|
||||||
@ -1931,7 +1931,7 @@ index_tombs() {
|
|||||||
|
|
||||||
# start the LibreOffice document converter if installed
|
# start the LibreOffice document converter if installed
|
||||||
{ command -v unoconv >& - } && {
|
{ command -v unoconv >& - } && {
|
||||||
unoconv -l 2>- &
|
unoconv -l 2>/dev/null &
|
||||||
_verbose "unoconv listener launched."
|
_verbose "unoconv listener launched."
|
||||||
sleep 1 }
|
sleep 1 }
|
||||||
|
|
||||||
@ -2095,7 +2095,7 @@ resize_tomb() {
|
|||||||
load_key
|
load_key
|
||||||
########
|
########
|
||||||
|
|
||||||
local oldtombsize=$(( `stat -c %s "$1" 2>-` / 1048576 ))
|
local oldtombsize=$(( `stat -c %s "$1" 2>/dev/null` / 1048576 ))
|
||||||
local mounted_tomb=`mount -l |
|
local mounted_tomb=`mount -l |
|
||||||
awk -vtomb="[$tombname]" '/^\/dev\/mapper\/tomb/ { if($7==tomb) print $1 }'`
|
awk -vtomb="[$tombname]" '/^\/dev\/mapper\/tomb/ { if($7==tomb) print $1 }'`
|
||||||
|
|
||||||
@ -2274,20 +2274,20 @@ umount_tomb() {
|
|||||||
# Kill all processes using the tomb
|
# Kill all processes using the tomb
|
||||||
slam_tomb() {
|
slam_tomb() {
|
||||||
# $1 = tomb mount point
|
# $1 = tomb mount point
|
||||||
if [[ -z `fuser -m "$1" 2>-` ]]; then
|
if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
#Note: shells are NOT killed by INT or TERM, but they are killed by HUP
|
#Note: shells are NOT killed by INT or TERM, but they are killed by HUP
|
||||||
for s in TERM HUP KILL; do
|
for s in TERM HUP KILL; do
|
||||||
_verbose "Sending $s to processes inside the tomb:"
|
_verbose "Sending $s to processes inside the tomb:"
|
||||||
if option_is_set -D; then
|
if option_is_set -D; then
|
||||||
ps -fp `fuser -m /media/a.tomb 2>-`|
|
ps -fp `fuser -m /media/a.tomb 2>/dev/null`|
|
||||||
while read line; do
|
while read line; do
|
||||||
_verbose $line
|
_verbose $line
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fuser -s -m "$1" -k -M -$s
|
fuser -s -m "$1" -k -M -$s
|
||||||
if [[ -z `fuser -m "$1" 2>-` ]]; then
|
if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if ! option_is_set -f; then
|
if ! option_is_set -f; then
|
||||||
|
Loading…
Reference in New Issue
Block a user