From cd73ea5d744ec225c7732d78e8d14741ab199a99 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 27 Jul 2016 22:02:30 +0100 Subject: [PATCH] Remove previous tox tomb --- src/freedombone-image-mesh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index 9b20dbf2..d9285348 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -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