#!/bin/bash

## Copyright (C) 2012 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

set -e

umask ug=rw,o=r || exit 2

DONE_FILE="/run/msgcollector/init_done"
SIZE="10M"

mkdir --parents /run/msgcollector || exit 3

if [ ! -f "$DONE_FILE" ]; then
    mount -t tmpfs -o size="$SIZE",nosuid,nodev,noexec none /run/msgcollector || exit 4
else
    mount -t tmpfs -o size="$SIZE",nosuid,nodev,noexec,remount none /run/msgcollector || exit 5
fi

touch "$DONE_FILE" || exit 6
