cs/root
This commit is contained in:
parent
c6f6d42af6
commit
e0ba419f2a
1 changed files with 9 additions and 5 deletions
|
@ -4,6 +4,7 @@ RWX_CRYPT_ROOT="${HOME}/home/crypt"
|
|||
|
||||
rwx_crypt() {
|
||||
local action="${1}"
|
||||
shift
|
||||
local action_close="close"
|
||||
local action_open="open"
|
||||
local mapper="/dev/mapper"
|
||||
|
@ -11,10 +12,12 @@ rwx_crypt() {
|
|||
local crypt_arg crypt_file crypt_map crypt_mount pass_phrase
|
||||
case "${action}" in
|
||||
"${action_close}" | "${action_open}")
|
||||
shift
|
||||
if [ -z "${1}" ]; then
|
||||
rwx_log_error 1 "No files"
|
||||
fi
|
||||
local user_id
|
||||
user_id="$(id --user)"
|
||||
[ "${user_id}" -eq 0 ] ||
|
||||
rwx_log_error 1 "Not root"
|
||||
[ -n "${1}" ] ||
|
||||
rwx_log_error 2 "No files"
|
||||
[ "${action}" = "${action_open}" ] &&
|
||||
pass_phrase="$(rwx_read_passphrase)"
|
||||
for crypt_arg in "${@}"; do
|
||||
|
@ -29,6 +32,7 @@ rwx_crypt() {
|
|||
# TODO find next available device
|
||||
# TODO connect device
|
||||
# TODO open device
|
||||
echo "${pass_phrase}"
|
||||
# TODO make mount directory
|
||||
# TODO mount file system
|
||||
;;
|
||||
|
@ -42,7 +46,7 @@ rwx_crypt() {
|
|||
*) ;;
|
||||
esac
|
||||
else
|
||||
rwx_log_error 2 "Not a file"
|
||||
rwx_log_error 3 "Not a file"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue