Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Claws-mail: use with livecd and usb stick
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Sat May 12, 2018 9:56 am    Post subject: Claws-mail: use with livecd and usb stick Reply with quote

Since claws-mail doesn't have a forum, I thought to just ask it here at the gentoo forum:
is there a way on how claws-mail can be used with a gentoo livecd and a usb stick.
Settings (-> emailaccounts) can't be saved with a gentoo livecd, so a usb stick can be used instead.
I was mainly thinking of the following setup:

* a file containing all (pop3) emailaccount-settings is loaded into gentoo (read from the usb stick), so claws-mail can connect to the account and retrieve any emails that arrived in the online mailbox.

* any mails that were retrieved earlier (previous boot) are on an "inbox" (or a different) folder on the usb stick, so claws-mail needs to find these mails and show them in the claws-mail program

* any new mails that are fetched from the online mailbox are automatically send to the inbox folder on the usb stick

How do I do this ?
I read that there is an "mbox" import/export function in claws-mail, but I doubt this actually contains the pop3 emailaccount settings (I think it's just for moving over a compressed file containg old emails).
I also found a set of folders under /home/ that seem to be the inbox, outbox, queue, draft, ... folders of my emailaccount, and it also contains some special files I can't read with any program. I don't know whether these contain the emailaccount info, and if so, I also don't know whether these allow manual (direct) editing, so directly from geany, ...
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3104

PostPosted: Sat May 12, 2018 10:07 am    Post subject: Reply with quote

Why won't you just partition that USB drive and use the second partition as a writeable /home?
Back to top
View user's profile Send private message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Sat May 12, 2018 10:47 am    Post subject: Reply with quote

szatox wrote:
Why won't you just partition that USB drive and use the second partition as a writeable /home?

I'm using the usb stick for many other (scripted) tasks as well, so I can't just partition it.
Making a folder with the inbox, outbox, drafts, ... folder + a file containing the email account details would be fine though, and I can add a script on the usb stick to be executed upon boot to copy the email account details unto the live gentoo (tmpfs). I just don't know how (I have no experience with claws-mail).
Back to top
View user's profile Send private message
ticho
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2003
Posts: 138
Location: yes

PostPosted: Sat May 12, 2018 11:55 am    Post subject: Reply with quote

You can have a local mailbox (MH format) with any path you want. From File menu, select Add mailbox->MH..., and enter full path to your mailbox (e.g. /mnt/usbstick/e-mails). The mailbox will be added to Claws Mail as "e-mails", and if there is a pre-existing MH mailbox on that path, its contents will be read into the program. (You can also move your existing MH mailboxes like this - remove it in Claws Mail, move the folder to another location on disk, re-add it in Claws Mail.)

The only thing to be careful with is to always mount this USB stick to same mount point, so Claws Mail can find the mailbox.

We do not have a forum, but we do have a mailing list and an IRC channel (that is usually somewhat quiet over the weekends, admittedly :) ).
_________________
The more you depend on forces outside yourself, the more you are dominated by them.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat May 12, 2018 4:04 pm    Post subject: Reply with quote

Maildir is a much nicer format, ime. mutt handles it nicely.
Back to top
View user's profile Send private message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Sat May 12, 2018 5:06 pm    Post subject: Reply with quote

ticho wrote:
You can have a local mailbox (MH format) with any path you want. From File menu, select Add mailbox->MH..., and enter full path to your mailbox (e.g. /mnt/usbstick/e-mails). The mailbox will be added to Claws Mail as "e-mails", and if there is a pre-existing MH mailbox on that path, its contents will be read into the program. (You can also move your existing MH mailboxes like this - remove it in Claws Mail, move the folder to another location on disk, re-add it in Claws Mail.) The only thing to be careful with is to always mount this USB stick to same mount point, so Claws Mail can find the mailbox.


Ok, but this is the same as the mbox-archive isn't it, in that it just bundles emails together ?
Or do you mean that if there is an inbox, outbox, and sent folder, it automatically shows the emails located in those folders ?

Even if the latter is the case, it's too much work to do "add mailbox - mh " with every boot, so if I do it once, does it make a file somewhere which I can place on the usb stick and copy to a location on the tmpfs (and if so, where is this file located ) ?

Also, does the mh contain the email account settings (so mail url, smtp, username, password, ...) ?

Lastly, are any mails that have come in automatically placed on the folder specified with the MH path ?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3104

PostPosted: Sat May 12, 2018 8:38 pm    Post subject: Reply with quote

bperegrine wrote:
szatox wrote:
Why won't you just partition that USB drive and use the second partition as a writeable /home?

I'm using the usb stick for many other (scripted) tasks as well, so I can't just partition it.
Making a folder with the inbox, outbox, drafts, ... folder + a file containing the email account details would be fine though, and I can add a script on the usb stick to be executed upon boot to copy the email account details unto the live gentoo (tmpfs). I just don't know how (I have no experience with claws-mail).

KISS.
Also: generic solutions beat specific ones.

Live CD typically contains a squashed (read-only) system. Squashed image is a file in CD (or USB) filesystem.
Use another directory in that filesystem as your /home, and mount it either with --bind or with overlayfs. Note: you _can_ access writeable space of your usb drive from within booted livecd. In case if incompatible FS on the usb drive (non-linux FS - no permissions), you may consider creating a container file there, which you can format with something saner and loop mount into /home. Most filesystems will let you grow that file later as you need more space, so you can start with something very small.
Going after those particular files mail client uses is a bad idea. It is at least as hard as making /home writeable, and provides less value (because it is excessively limiting).
Back to top
View user's profile Send private message
ticho
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2003
Posts: 138
Location: yes

PostPosted: Sun May 13, 2018 8:52 am    Post subject: Reply with quote

bperegrine wrote:

Ok, but this is the same as the mbox-archive isn't it, in that it just bundles emails together ?
Or do you mean that if there is an inbox, outbox, and sent folder, it automatically shows the emails located in those folders ?

No, it is a full local mailbox tree with all four special folders (inbox, outbox, queue, trash), the same kind you get by default when you configure Claws Mail with a POP3 account. You can have several of these in Claws Mail, although in most cases it is unnecessary, and it's easier to just use one mailbox with subfolders for different accounts.

bperegrine wrote:

Even if the latter is the case, it's too much work to do "add mailbox - mh " with every boot, so if I do it once, does it make a file somewhere which I can place on the usb stick and copy to a location on the tmpfs (and if so, where is this file located ) ?

I see I omitted this part from my first reply, sorry. Yes, Claws Mail stores this in its configuration - directory ~/.claws-mail by default. You can override this location with a commandline parameter to claws-mail, e.g. "claws-mail --alternate-config-dir /mnt/usbdisk/.claws-mail" (you can use any other name, not just ".claws-mail"). So your setup basically consists of two parts - the config dir, which has your preferences, accounts, passwords, etc., and the mailbox dir, which keeps your e-mails, and which is referenced by the mentioned configuration.

Now I realize that you could probably also just set $HOME environment variable to point to your USB stick, and Claws Mail will use $HOME/.claws-mail and $HOME/Mail by default. I haven't tested this myself, but a quick glance at the source code seems to confirm this.

The idea with copying this config dir to a tmpfs will of course work as well, but just so you know, it could get a bit slow if you start using IMAP, since its cache is stored in this config dir also, and it will grow over time.

bperegrine wrote:

Also, does the mh contain the email account settings (so mail url, smtp, username, password, ...) ?

No, these are in the abovementioned config dir. You have to distinguish between an account (set of preferences and login details for reading and sending e-mail) and a mailbox (place to store received and sent e-mail).

It is not always a one-to-one mapping between mailboxes and accounts. You can have a dozen POP3 accounts, but have them all put incoming mail to just single mailbox - either all to INBOX folder of that mailbox, or you can configure each account to put its incoming mail to a separate subfolder.

IMAP accounts are handled a bit differently, they each get their own mailbox of sorts, which is basically a mirror image of the server-side IMAP mailbox. Imperfect mirror image, since it usually only stores cached messages from the server that you viewed through Claws Mail. It is also possible to configure an IMAP account to always download and cache all new messages, but this is usually quite slow, depending on how fast your connection to the IMAP server is.

bperegrine wrote:

Lastly, are any mails that have come in automatically placed on the folder specified with the MH path ?

Following on the account vs. mailbox distinction, this does not depend on the MH mailbox, but on how the relevant POP3 account is configured. You can configure this in account preferences, on Advanced page.
_________________
The more you depend on forces outside yourself, the more you are dominated by them.
Back to top
View user's profile Send private message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Sun May 13, 2018 8:57 am    Post subject: Reply with quote

szatox wrote:

KISS.
Also: generic solutions beat specific ones.

Live CD typically contains a squashed (read-only) system. Squashed image is a file in CD (or USB) filesystem.
Use another directory in that filesystem as your /home, and mount it either with --bind or with overlayfs. Note: you _can_ access writeable space of your usb drive from within booted livecd. In case if incompatible FS on the usb drive (non-linux FS - no permissions), you may consider creating a container file there, which you can format with something saner and loop mount into /home. Most filesystems will let you grow that file later as you need more space, so you can start with something very small.
Going after those particular files mail client uses is a bad idea. It is at least as hard as making /home writeable, and provides less value (because it is excessively limiting).


Yes keeping it simple is preferable, and I have thought of that solution.
However, any configuration files that are placed on the livecd would make the livecd personalised, so only of use to me.
I don't want that, I want it to be of use for everyone, so the configuration files need to be on a writable location (= usb stick)

I'll go with ticho's advice and cook up something and put it on my github repo.
Update: done , see https://github.com/Sharrisii/TAZ_optional_usb_stick/blob/master/bootscripts/other.sh
Please check.
Note that I didn't use any MH path; rather I just have the script copy everything to folders on the usb stick. Main reason for this is that there isn't a command to do this, and I'm not going to bother inputting it via the menu every time.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3104

PostPosted: Sun May 13, 2018 4:44 pm    Post subject: Reply with quote

Quote:
However, any configuration files that are placed on the livecd would make the livecd personalised, so only of use to me.
I don't want that, I want it to be of use for everyone, so the configuration files need to be on a writable location (= usb stick)
I don't see your point.

1) Writeable /home is exactly where you put user-specific configs. ( so many people can use it anyway, as soon as you allow it )
2) There are already pretty good generic liveCDs, like Ubuntu Desktop and Slax (Slax supports persistent /home on usb drives), so building a generic livecd means you will compete with them. ( Building a personalized system makes more sense, because it is better for you and being better for you gives it a purpose/value )

Anyway, I'm not here to deter you. Go with whatever you think would do the trick, in the worst case you will just learn something new, in the best you will learn something new and actually complete your quest.

Bonus: With aufs (or overlayfs, since it's in mainline kernel), you can make the whole liveCD small and writeable at the same time, which would even allow the user to install additional software (into the writeable area) on top of squashed, read-only image.
Back to top
View user's profile Send private message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Mon May 14, 2018 10:36 am    Post subject: Reply with quote

szatox wrote:
I don't see your point.
1) Writeable /home is exactly where you put user-specific configs. ( so many people can use it anyway, as soon as you allow it )

Oh right, you mean just changing the path to home in gentoo to a writable folder (usb stick, hard disk, ...).
I thought you meant adding in config files with all configs for the programs to be copied to the tmpfs folder upon boot.

I guess what you propose is an option, but I still don't like needing to adhere to a specific folder structure (/home/username/...) for my usb stick.

Take a look at the github page to see my code.

One thing is definitely wrong: since I don't have any non-privileged user accounts, and so only have the root account, I doubt I'll have a /home/username/ folder ? So how do I update everything ? Just frop the /home/username and change the paths to / ? But do the programs (claws-mail, gajim and linphone) change their default path to / too in case they find no non-privileged user accounts ? Or do they just assume there will be a non-privileged user anyway, and just write it to /home/username/ anyway ? But if the latter, what username would they use ? Root --> /home/root/ ?

Also perhaps wrong (don't know) is that there is no /home/username/Mail/ folder on my (slitaz) system at all (I found the path online so perhaps gentoo users indeed have them). I can't check for the time being as I still don't have gentoo.

Same goes for the gajim profile: I found a config.txt, but no .profile -and no differentiation between users, ie profiles specific for a particular user-, but then again perhaps that's correct.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3104

PostPosted: Mon May 14, 2018 5:47 pm    Post subject: Reply with quote

Quote:
I thought you meant adding in config files with all configs for the programs to be copied to the tmpfs folder upon boot.
Hell, no, tracking dozens of files would be nothing like simple.
Quote:

One thing is definitely wrong: since I don't have any non-privileged user accounts, and so only have the root account, I doubt I'll have a /home/username/ folder
Good you know it's wrong. It's easy to fix though, just create a regular user with su/sudo privileges.
Quote:

But do the programs (claws-mail, gajim and linphone) change their default path to / too in case they find no non-privileged user accounts ? Or do they just assume there will be a non-privileged user anyway, and just write it to /home/username/ anyway
they usually expand $HOME and use whatever path you provide in there. If its empty or unset, they default to root. Like in system root, not user root.

Quote:
But if the latter, what username would they use ? Root --> /home/root/ ?
Init operates as root. Everything else inherits user from the calling process. Deamons often change user in their start-up routine, and so does login. User's programs don't.

Quote:
Also perhaps wrong (don't know) is that there is no /home/username/Mail/ folder on my (slitaz) system at all
User's programs tend to behave in a sane way when their cache does not exist. E.g. they simply create it. Obviously, the parent directory must be rw for this to work, which actually is a pretty sane requirement ;)
Back to top
View user's profile Send private message
bperegrine
n00b
n00b


Joined: 23 Dec 2017
Posts: 37

PostPosted: Tue May 15, 2018 8:23 am    Post subject: Reply with quote

szatox wrote:
Good you know it's wrong. It's easy to fix though, just create a regular user with su/sudo privileges

I'm not going to do that. The live cd is purposely designed not to have a non-privileged user account.
I just need a way around the /home/username/ issue with programs.

szatox wrote:

they usually expand $HOME and use whatever path you provide in there. If its empty or unset, they default to root. Like in system root, not user root.

$HOME will be unset, so I can't use that. You say they default to root, so it's what I thought right, that /home/username/ becomes / in the path (and the rest of the path remains unchanged) ?

szatox wrote:
User's programs tend to behave in a sane way when their cache does not exist. E.g. they simply create it. Obviously, the parent directory must be rw for this to work, which actually is a pretty sane requirement ;)

Ok, so I understand /Mail/ will be created (as /home/username/ falls away).

I'll change this in the script:

# Next, rename your profile text to default.txt and copy it from /home/username/.config/gajim/ to /mnt/*/profiles/gajim
-> # Next, rename your profile text to default.txt and copy it from /.config/gajim/ to /mnt/*/profiles/gajim

# Next, copy your profile file from /home/username/.linphonerc to /mnt/*/profiles/linphone
-> # Next, copy your profile file from /.linphonerc to /mnt/*/profiles/linphone

cp /mnt/*/profiles/linphone/* /home/*/.linphonerc/
-> cp /mnt/*/profiles/linphone/* /.linphonerc/

# Next, copy your configuration files from /home/username/.claws-mail to /mnt/*/emails/.clawsconfig/
-> # Next, copy your configuration files from /.claws-mail to /mnt/*/emails/.clawsconfig/

cp -f /home/*/Mail/inbox/*.eml /mnt/*/emails/inbox/
cp -f /home/*/Mail/draft/*.eml /mnt/*/emails/draft/
cp -f /home/*/Mail/sent/*.eml /mnt/*/emails/sent/
-> cp -f /Mail/inbox/*.eml /mnt/*/emails/inbox/
-> cp -f /Mail/draft/*.eml /mnt/*/emails/draft/
-> cp -f /Mail/sent/*.eml /mnt/*/emails/sent/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum