Add users to i2p group when bdsmail is installed

This commit is contained in:
Bob Mottram 2018-02-12 13:16:15 +00:00
parent 55e690a84a
commit 799a31ce8f
1 changed files with 16 additions and 9 deletions

View File

@ -42,6 +42,10 @@ function bdsmail_configure_users {
for d in /home/*/ ; do for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}') USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
# Add the user to the i2p group
usermod -a -G i2psvc $USERNAME
if [ -f /home/$USERNAME/.muttrc ]; then if [ -f /home/$USERNAME/.muttrc ]; then
# Create a mutt i2p folder # Create a mutt i2p folder
if ! grep -q ' =i2p' /home/$USERNAME/.muttrc; then if ! grep -q ' =i2p' /home/$USERNAME/.muttrc; then
@ -199,18 +203,12 @@ function remove_bdsmail {
rm /etc/systemd/system/bdsmail.service rm /etc/systemd/system/bdsmail.service
fi fi
remove_i2p
remove_app bdsmail
remove_completion_param install_bdsmail
sed -i '/bdsmail/d' $COMPLETION_FILE
rm -rf /etc/skel/.mutt
if [ -d /etc/bdsmail ]; then
rm -rf /etc/bdsmail
fi
for d in /home/*/ ; do for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}') USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
# remove the user from the i2p group
deluser $USERNAME i2psvc
# Remove mutt folder hook to the i2p config # Remove mutt folder hook to the i2p config
if [ -f /home/$USERNAME/.muttrc ]; then if [ -f /home/$USERNAME/.muttrc ]; then
if grep -q 'folder-hook !i2p' /home/$USERNAME/.muttrc; then if grep -q 'folder-hook !i2p' /home/$USERNAME/.muttrc; then
@ -230,6 +228,15 @@ function remove_bdsmail {
# or just be reinstalling the system without losing mail # or just be reinstalling the system without losing mail
fi fi
done done
remove_i2p
remove_app bdsmail
remove_completion_param install_bdsmail
sed -i '/bdsmail/d' $COMPLETION_FILE
rm -rf /etc/skel/.mutt
if [ -d /etc/bdsmail ]; then
rm -rf /etc/bdsmail
fi
} }
function install_bdsmail { function install_bdsmail {