Comment 11 for bug 982421

Revision history for this message
c4pp4 (c4pp4) wrote :

The answer to my question. I've made an ext2 loopback device (ext2 because it has no journal so there is no need to set the "barrier" option) outside the home and set it to be shared among multiple users.

Create a folder "me-tv" outside the home folder to store a loopback device and a folder "mnt" to mount the loopback device at it:
sudo mkdir -p /usr/local/share/me-tv/mnt

Create the loopback device "me-tv.img" with the size 10MB (size = maximal size of the "me-tv.db" file, you can change the option "count" to raise the size)
sudo dd if=/dev/zero of=/usr/local/share/me-tv/me-tv.img bs=512 count=20000

Find out the name of the first unused loop device:
sudo losetup -f

Setup the loop device "/dev/loop0":
sudo losetup /dev/loop0 /usr/local/share/me-tv/me-tv.img

Format the loop device to ext2:
sudo mkfs -t ext2 /dev/loop0

Mount the loop device:
sudo mount -t ext2 /dev/loop0 /usr/local/share/me-tv/mnt

Create a folder "db" to store the "me-tv.db" file:
sudo mkdir /usr/local/share/me-tv/mnt/db

Change the owner of the "db" folder to the actual user:
sudo chown $USER:$USER /usr/local/share/me-tv/mnt/db

Set the sticky bit flag of the "db" folder to the actual user to prevent removing the "me-tv.db" file by another user:
sudo chmod +t /usr/local/share/me-tv/mnt/db

Remove the old folder from the home (plus every regular user have to do it):
rm -r ~/.local/share/me-tv

Create a symbolic link to the "db" folder outside the home (plus every regular user have to do it):
ln -s /usr/local/share/me-tv/mnt/db ~/.local/share/me-tv

Create the "me-tv.db" file (check if everything is ok and terminate it with ctrl+c):
me-tv-server -v

Set write permissions to the "db" folder and the "me-tv.db" file to all users:
sudo chmod -R go+w /usr/local/share/me-tv/mnt/db

And set the "fstab" file to keep changes after the reboot:
echo "/usr/local/share/me-tv/me-tv.img /usr/local/share/me-tv/mnt ext2 defaults,loop 0 0" | sudo tee -a /etc/fstab