#!/usr/bin/env bash

mkdir -p /tmp/temp-ttl/
chattr +AT /tmp/temp-ttl/
chmod 1777 /tmp/temp-ttl/

mkdir -p /tmp/temp-ttl/ttl_1d
chattr +AT /tmp/temp-ttl/ttl_1d
chmod 1777 /tmp/temp-ttl/ttl_1d

mkdir -p /tmp/temp-ttl/ttl_2d
chattr +AT /tmp/temp-ttl/ttl_2d
chmod 1777 /tmp/temp-ttl/ttl_2d

mkdir -p /tmp/temp-ttl/ttl_7d
chattr +AT /tmp/temp-ttl/ttl_7d
chmod 1777 /tmp/temp-ttl/ttl_7d

mkdir -p /tmp/temp-ttl/ttl_31d
chattr +AT /tmp/temp-ttl/ttl_31d
chmod 1777 /tmp/temp-ttl/ttl_31d

if [[ ! -f /tmp/temp-ttl/README ]]
then
    echo "Этот каталог создан автоматически пакетом yandex-du-temporary-directories. В его подкаталогах можно хранить файлы с ограниченным временем жизни" > /tmp/temp-ttl/README
    chmod 1444 /tmp/temp-ttl/README
fi
