Remove previous tox tomb

This commit is contained in:
Bob Mottram 2016-07-27 22:02:30 +01:00
parent 45b8c85fd7
commit cd73ea5d74
1 changed files with 9 additions and 2 deletions

View File

@ -587,21 +587,28 @@ function setup_amnesic_tox_data {
return
fi
# close any existing open tomb
if [ -f /tmp/tox.tomb ]; then
tomb slam /tmp/tox.tomb
fi
# make a temporary password
TOMB_TOX_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
tomb dig -s $TOMB_TOX_SIZE_MB /tmp/tox.tomb
tomb forge /mnt/ramdisk/tox.tomb.key --tomb-pwd "${TOMB_TOX_PASSWORD}" --unsafe
tomb lock /tmp/tox.tomb -k /mnt/ramdisk/tox.tomb.key --tomb-pwd "${TOMB_TOX_PASSWORD}" --unsafe
tomb open /tmp/tox.tomb -k /mnt/ramdisk/tox.tomb.key --tomb-pwd "${TOMB_TOX_PASSWORD}" --unsafe
# clear the password
TOMB_TOX_PASSWORD=
if [ -d /media/tox ]; then
if [ ! -d /home/$MY_USERNAME/.config ]; then
mkdir -p /home/$MY_USERNAME/.config
fi
if [ -d /home/$MY_USERNAME/.config/tox ]; then
cp -r /home/$MY_USERNAME/.config/tox/* /media/tox
rm -rf /home/$MY_USERNAME/.config/tox
ln -s /media/tox /home/$MY_USERNAME/.config/tox
fi
ln -s /media/tox /home/$MY_USERNAME/.config/tox
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
chown -R $MY_USERNAME:$MY_USERNAME /media/tox
echo "Tox Tomb created" >> /var/log/${PROJECT_NAME}.log