Tidying
This commit is contained in:
parent
fcf6800422
commit
da3c0f5eed
|
@ -53,11 +53,13 @@ function add_user {
|
||||||
new_user_username=$(cat $data | sed -n 1p)
|
new_user_username=$(cat $data | sed -n 1p)
|
||||||
new_user_ssh_public_key=$(cat $data | sed -n 2p)
|
new_user_ssh_public_key=$(cat $data | sed -n 2p)
|
||||||
if [ ${#new_user_username} -lt 2 ]; then
|
if [ ${#new_user_username} -lt 2 ]; then
|
||||||
dialog --title "New username" --msgbox "No username was given" 6 40
|
dialog --title "New username" \
|
||||||
|
--msgbox "No username was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "$new_user_username" == *" "* ]]; then
|
if [[ "$new_user_username" == *" "* ]]; then
|
||||||
dialog --title "Invalid username" --msgbox "The username should not contain any spaces" 6 40
|
dialog --title "Invalid username" \
|
||||||
|
--msgbox "The username should not contain any spaces" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ${#new_user_ssh_public_key} -lt 20 ]; then
|
if [ ${#new_user_ssh_public_key} -lt 20 ]; then
|
||||||
|
@ -70,7 +72,8 @@ function add_user {
|
||||||
freedombone-adduser "$new_user_username" "$new_user_ssh_public_key"
|
freedombone-adduser "$new_user_username" "$new_user_ssh_public_key"
|
||||||
any_key
|
any_key
|
||||||
else
|
else
|
||||||
dialog --title "ssh public key" --msgbox "This does not look like an ssh public key" 6 40
|
dialog --title "ssh public key" \
|
||||||
|
--msgbox "This does not look like an ssh public key" 6 40
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -92,7 +95,8 @@ function select_user {
|
||||||
SELECTED_USERNAME=
|
SELECTED_USERNAME=
|
||||||
fi
|
fi
|
||||||
if [ ! -d /home/$SELECTED_USERNAME/Maildir ]; then
|
if [ ! -d /home/$SELECTED_USERNAME/Maildir ]; then
|
||||||
dialog --title "User directory check" --msgbox "This does not look like a user directory" 6 40
|
dialog --title "User directory check" \
|
||||||
|
--msgbox "This does not look like a user directory" 6 40
|
||||||
SELECTED_USERNAME=
|
SELECTED_USERNAME=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -103,7 +107,8 @@ function delete_user {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if grep -Fxq "Admin user: $SELECTED_USERNAME" $COMPLETION_FILE; then
|
if grep -Fxq "Admin user: $SELECTED_USERNAME" $COMPLETION_FILE; then
|
||||||
dialog --title "Administrator user" --msgbox "You can't delete the administrator user" 6 40
|
dialog --title "Administrator user" \
|
||||||
|
--msgbox "You can't delete the administrator user" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
|
@ -147,24 +152,30 @@ function add_to_mailing_list {
|
||||||
LIST_EMAIL=$(cat $data | sed -n 3p)
|
LIST_EMAIL=$(cat $data | sed -n 3p)
|
||||||
|
|
||||||
if [ ${#LIST_NAME} -lt 2 ]; then
|
if [ ${#LIST_NAME} -lt 2 ]; then
|
||||||
dialog --title "Add mailing list" --msgbox "No mailing list name was given" 6 40
|
dialog --title "Add mailing list" \
|
||||||
|
--msgbox "No mailing list name was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ${#LIST_SUBJECT} -lt 2 ]; then
|
if [ ${#LIST_SUBJECT} -lt 2 ]; then
|
||||||
dialog --title "Add mailing list" --msgbox "No mailing list subject was given" 6 40
|
dialog --title "Add mailing list" \
|
||||||
|
--msgbox "No mailing list subject was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ${#LIST_EMAIL} -lt 2 ]; then
|
if [ ${#LIST_EMAIL} -lt 2 ]; then
|
||||||
dialog --title "Add mailing list" --msgbox "No mailing list email address was given" 6 40
|
dialog --title "Add mailing list" \
|
||||||
|
--msgbox "No mailing list email address was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then
|
if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then
|
||||||
dialog --title "Add mailing list" --msgbox "Unrecognised email address" 6 40
|
dialog --title "Add mailing list" \
|
||||||
|
--msgbox "Unrecognised email address" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
freedombone-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" -s "$LIST_SUBJECT" -e "$LIST_EMAIL"
|
freedombone-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
|
||||||
dialog --title "Add mailing list" --msgbox "$LIST_NAME list was added" 6 40
|
-s "$LIST_SUBJECT" -e "$LIST_EMAIL"
|
||||||
|
dialog --title "Add mailing list" \
|
||||||
|
--msgbox "$LIST_NAME list was added" 6 40
|
||||||
}
|
}
|
||||||
|
|
||||||
function email_rule {
|
function email_rule {
|
||||||
|
@ -189,20 +200,25 @@ function email_rule {
|
||||||
RULE_FOLDER=$(cat $data | sed -n 2p)
|
RULE_FOLDER=$(cat $data | sed -n 2p)
|
||||||
|
|
||||||
if [ ${#RULE_EMAIL} -lt 2 ]; then
|
if [ ${#RULE_EMAIL} -lt 2 ]; then
|
||||||
dialog --title "Add email rule" --msgbox "No email address was given" 6 40
|
dialog --title "Add email rule" \
|
||||||
|
--msgbox "No email address was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ${#RULE_FOLDER} -lt 2 ]; then
|
if [ ${#RULE_FOLDER} -lt 2 ]; then
|
||||||
dialog --title "Add email rule" --msgbox "No folder name was given" 6 40
|
dialog --title "Add email rule" \
|
||||||
|
--msgbox "No folder name was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "$RULE_EMAIL" != *"@"* || "$RULE_EMAIL" != *"."* ]]; then
|
if [[ "$RULE_EMAIL" != *"@"* || "$RULE_EMAIL" != *"."* ]]; then
|
||||||
dialog --title "Add email rule" --msgbox "Unrecognised email address" 6 40
|
dialog --title "Add email rule" \
|
||||||
|
--msgbox "Unrecognised email address" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
freedombone-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" -g "$RULE_FOLDER"
|
freedombone-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" \
|
||||||
dialog --title "Add email rule" --msgbox "Email rule for $RULE_EMAIL was added" 6 40
|
-g "$RULE_FOLDER"
|
||||||
|
dialog --title "Add email rule" \
|
||||||
|
--msgbox "Email rule for $RULE_EMAIL was added" 6 40
|
||||||
}
|
}
|
||||||
|
|
||||||
function block_unblock_email {
|
function block_unblock_email {
|
||||||
|
@ -226,19 +242,23 @@ function block_unblock_email {
|
||||||
BLOCK_EMAIL=$(cat $data | sed -n 1p)
|
BLOCK_EMAIL=$(cat $data | sed -n 1p)
|
||||||
BLOCK=$(cat $data | sed -n 2p)
|
BLOCK=$(cat $data | sed -n 2p)
|
||||||
if [ ${#BLOCK_EMAIL} -lt 2 ]; then
|
if [ ${#BLOCK_EMAIL} -lt 2 ]; then
|
||||||
dialog --title "Block/Unblock an email" --msgbox "No email address was given" 6 40
|
dialog --title "Block/Unblock an email" \
|
||||||
|
--msgbox "No email address was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "$BLOCK_EMAIL" != *"@"* || "$BLOCK_EMAIL" != *"."* ]]; then
|
if [[ "$BLOCK_EMAIL" != *"@"* || "$BLOCK_EMAIL" != *"."* ]]; then
|
||||||
dialog --title "Block/Unblock an email" --msgbox "Unrecognised email address" 6 40
|
dialog --title "Block/Unblock an email" \
|
||||||
|
--msgbox "Unrecognised email address" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
|
if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
|
||||||
freedombone-ignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
|
freedombone-ignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
|
||||||
dialog --title "Block an email" --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME blocked" 6 40
|
dialog --title "Block an email" \
|
||||||
|
--msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME blocked" 6 40
|
||||||
else
|
else
|
||||||
freedombone-unignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
|
freedombone-unignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
|
||||||
dialog --title "Unblock an email" --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME unblocked" 6 40
|
dialog --title "Unblock an email" \
|
||||||
|
--msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME unblocked" 6 40
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,15 +283,18 @@ function block_unblock_subject {
|
||||||
BLOCK_SUBJECT=$(cat $data | sed -n 1p)
|
BLOCK_SUBJECT=$(cat $data | sed -n 1p)
|
||||||
BLOCK=$(cat $data | sed -n 2p)
|
BLOCK=$(cat $data | sed -n 2p)
|
||||||
if [ ${#BLOCK_SUBJECT} -lt 2 ]; then
|
if [ ${#BLOCK_SUBJECT} -lt 2 ]; then
|
||||||
dialog --title "Block/Unblock an email" --msgbox "No subject was given" 6 40
|
dialog --title "Block/Unblock an email" \
|
||||||
|
--msgbox "No subject was given" 6 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
|
if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
|
||||||
freedombone-ignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
|
freedombone-ignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
|
||||||
dialog --title "Block an email" --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME blocked" 6 40
|
dialog --title "Block an email" \
|
||||||
|
--msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME blocked" 6 40
|
||||||
else
|
else
|
||||||
freedombone-unignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
|
freedombone-unignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
|
||||||
dialog --title "Unblock an email" --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME unblocked" 6 40
|
dialog --title "Unblock an email" \
|
||||||
|
--msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME unblocked" 6 40
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +303,8 @@ function create_keydrive_master {
|
||||||
if [ ! $SELECTED_USERNAME ]; then
|
if [ ! $SELECTED_USERNAME ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
dialog --title "USB Master Keydrive" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
dialog --title "USB Master Keydrive" \
|
||||||
|
--msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
||||||
clear
|
clear
|
||||||
freedombone-keydrive -u $SELECTED_USERNAME --master 'yes'
|
freedombone-keydrive -u $SELECTED_USERNAME --master 'yes'
|
||||||
any_key
|
any_key
|
||||||
|
@ -291,21 +315,24 @@ function create_keydrive_fragment {
|
||||||
if [ ! $SELECTED_USERNAME ]; then
|
if [ ! $SELECTED_USERNAME ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
dialog --title "USB Fragment Keydrive" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
dialog --title "USB Fragment Keydrive" \
|
||||||
|
--msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
||||||
clear
|
clear
|
||||||
freedombone-keydrive -u $SELECTED_USERNAME
|
freedombone-keydrive -u $SELECTED_USERNAME
|
||||||
any_key
|
any_key
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_data {
|
function backup_data {
|
||||||
dialog --title "Backup data to USB" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
dialog --title "Backup data to USB" \
|
||||||
|
--msgbox "Plug in a LUKS encrypted USB drive" 6 40
|
||||||
clear
|
clear
|
||||||
backup
|
backup
|
||||||
any_key
|
any_key
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_data {
|
function restore_data {
|
||||||
dialog --title "Restore data from USB" --msgbox "Plug in your backup USB drive" 6 40
|
dialog --title "Restore data from USB" \
|
||||||
|
--msgbox "Plug in your backup USB drive" 6 40
|
||||||
clear
|
clear
|
||||||
restore
|
restore
|
||||||
any_key
|
any_key
|
||||||
|
@ -332,7 +359,8 @@ function restore_gpg_key {
|
||||||
if [ ! $SELECTED_USERNAME ]; then
|
if [ ! $SELECTED_USERNAME ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
dialog --title "Restore GPG key for user $SELECTED_USERNAME" --msgbox "Plug in your USB keydrive" 6 40
|
dialog --title "Restore GPG key for user $SELECTED_USERNAME" \
|
||||||
|
--msgbox "Plug in your USB keydrive" 6 40
|
||||||
clear
|
clear
|
||||||
freedombone-recoverkey -u $SELECTED_USERNAME
|
freedombone-recoverkey -u $SELECTED_USERNAME
|
||||||
any_key
|
any_key
|
||||||
|
|
Loading…
Reference in New Issue