This commit is contained in:
Marc Beninca 2025-03-30 12:53:39 +02:00
parent c6f6d42af6
commit e0ba419f2a
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -4,6 +4,7 @@ RWX_CRYPT_ROOT="${HOME}/home/crypt"
rwx_crypt() { rwx_crypt() {
local action="${1}" local action="${1}"
shift
local action_close="close" local action_close="close"
local action_open="open" local action_open="open"
local mapper="/dev/mapper" local mapper="/dev/mapper"
@ -11,10 +12,12 @@ rwx_crypt() {
local crypt_arg crypt_file crypt_map crypt_mount pass_phrase local crypt_arg crypt_file crypt_map crypt_mount pass_phrase
case "${action}" in case "${action}" in
"${action_close}" | "${action_open}") "${action_close}" | "${action_open}")
shift local user_id
if [ -z "${1}" ]; then user_id="$(id --user)"
rwx_log_error 1 "No files" [ "${user_id}" -eq 0 ] ||
fi rwx_log_error 1 "Not root"
[ -n "${1}" ] ||
rwx_log_error 2 "No files"
[ "${action}" = "${action_open}" ] && [ "${action}" = "${action_open}" ] &&
pass_phrase="$(rwx_read_passphrase)" pass_phrase="$(rwx_read_passphrase)"
for crypt_arg in "${@}"; do for crypt_arg in "${@}"; do
@ -29,6 +32,7 @@ rwx_crypt() {
# TODO find next available device # TODO find next available device
# TODO connect device # TODO connect device
# TODO open device # TODO open device
echo "${pass_phrase}"
# TODO make mount directory # TODO make mount directory
# TODO mount file system # TODO mount file system
;; ;;
@ -42,7 +46,7 @@ rwx_crypt() {
*) ;; *) ;;
esac esac
else else
rwx_log_error 2 "Not a file" rwx_log_error 3 "Not a file"
fi fi
done done
;; ;;