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 return
fi 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_TOX_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
tomb dig -s $TOMB_TOX_SIZE_MB /tmp/tox.tomb tomb dig -s $TOMB_TOX_SIZE_MB /tmp/tox.tomb
tomb forge /mnt/ramdisk/tox.tomb.key --tomb-pwd "${TOMB_TOX_PASSWORD}" --unsafe 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 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 tomb open /tmp/tox.tomb -k /mnt/ramdisk/tox.tomb.key --tomb-pwd "${TOMB_TOX_PASSWORD}" --unsafe
# clear the password
TOMB_TOX_PASSWORD= TOMB_TOX_PASSWORD=
if [ -d /media/tox ]; then if [ -d /media/tox ]; then
if [ ! -d /home/$MY_USERNAME/.config ]; then if [ ! -d /home/$MY_USERNAME/.config ]; then
mkdir -p /home/$MY_USERNAME/.config mkdir -p /home/$MY_USERNAME/.config
fi fi
if [ -d /home/$MY_USERNAME/.config/tox ]; then if [ -d /home/$MY_USERNAME/.config/tox ]; then
cp -r /home/$MY_USERNAME/.config/tox/* /media/tox
rm -rf /home/$MY_USERNAME/.config/tox rm -rf /home/$MY_USERNAME/.config/tox
ln -s /media/tox /home/$MY_USERNAME/.config/tox
fi 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 /home/$MY_USERNAME/.config
chown -R $MY_USERNAME:$MY_USERNAME /media/tox chown -R $MY_USERNAME:$MY_USERNAME /media/tox
echo "Tox Tomb created" >> /var/log/${PROJECT_NAME}.log echo "Tox Tomb created" >> /var/log/${PROJECT_NAME}.log