kaz-vagrant/files/snster-kaz/isp-a/home/clawsmail/addclawsuser.sh

50 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2022-11-30 19:43:06 +01:00
#!/bin/bash
# Configure claws mail
set -e
#if [ -z $KAZGUARD ] ; then exit 1; fi
DIR=`dirname $0`
cd `dirname $0`
# $domain, $mailname, $password
name=$1
domainname=$2
2022-12-23 13:50:27 +01:00
login=$3
password=$4
number=$5
2022-11-30 19:43:06 +01:00
# cp -ar claws-mail ~/.claws-mail
rm /tmp/accountrc /tmp/folderlist.xml -f
2022-11-30 19:43:06 +01:00
mkdir -p ~/.claws-mail
cat claws-mail/accountrc > /tmp/accountrc
sed -i -e "s/\$name/$name/" /tmp/accountrc
sed -i -e "s/\$domainname/$domainname/" /tmp/accountrc
sed -i -e "s/\$number/$number/" /tmp/accountrc
2022-12-23 13:50:27 +01:00
sed -i -e "s/\$login/$login/" /tmp/accountrc
2022-11-30 19:43:06 +01:00
cat /tmp/accountrc >> ~/.claws-mail/accountrc
if [ ! -f ~/.claws-mail/folderlist.xml ]; then
cp claws-mail/folderlist_skel.xml ~/.claws-mail/folderlist.xml
fi
cat claws-mail/folderlist.xml > /tmp/folderlist.xml
sed -i -e "s/\$name/$name/" /tmp/folderlist.xml
sed -i -e "s/\$domainname/$domainname/" /tmp/folderlist.xml
2022-11-30 19:43:06 +01:00
sed -i -e "s/\$number/$number/" /tmp/folderlist.xml
2022-12-23 13:50:27 +01:00
sed -i -e "s/\$login/$login/" /tmp/folderlist.xml
2022-11-30 19:43:06 +01:00
sed -i -e "s/<\/folderlist>//" ~/.claws-mail/folderlist.xml
cat /tmp/folderlist.xml >> ~/.claws-mail/folderlist.xml
echo "</folderlist>" >> ~/.claws-mail/folderlist.xml
cp claws-mail/clawsrc ~/.claws-mail/
# chmod +x genpasswd
pass=`./genpasswd $password`
#gcc genpasswd.c -o genpasswd -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -lglib-2.0 -lgnutls
echo -e "[account:$number]\nrecv $pass" >> ~/.claws-mail/passwordstorerc