twrap tomb open/close; tombtemps - coffin - secure lan file storage on a device (HTM) git clone git://parazyd.org/coffin.git (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules (DIR) README (DIR) LICENSE --- (DIR) commit c8469c1d7100a08baa625ae50d3ea7b83e46c928 (DIR) parent bc1262457bdb09a8736897b14521e83aa920e3cf (HTM) Author: parazyd <parazyd@dyne.org> Date: Tue, 17 May 2016 14:38:35 +0200 wrap tomb open/close; tombtemps Diffstat: M src/extra/gen.sh | 4 ++-- M src/zlibs/hooks | 14 ++++++++++++++ M src/zlibs/ttab | 27 ++++++++++++++++++++------- 3 files changed, 36 insertions(+), 9 deletions(-) --- (DIR) diff --git a/src/extra/gen.sh b/src/extra/gen.sh t@@ -27,6 +27,6 @@ fprint=`openssl x509 -noout -in ./coffin.pem -fingerprint \ echo "#############################" echo "Successfully generated coffin's SSL certificate!" -echo "The fingerprint is: $fprint" -echo "Compare it and/or set it as trusted when you connect to coffin." +echo "The fingerprint is: \033[0;32m${fprint}" +echo "\033[0mCompare it and/or set it as trusted when you connect to coffin." echo "#############################" (DIR) diff --git a/src/zlibs/hooks b/src/zlibs/hooks t@@ -144,3 +144,17 @@ delete-tomb() { delete-sshfs-hook $undertaker $tombid } } + +check-temptomb() { + fn check-temptomb + + act "Checking for tomb temps" + if [[ -d ${GRAVEYARD}/temp/${tombid} ]]; then + mv ${GRAVEYARD}/temp/${tombid}/* /media/${tombid}/ + mv ${GRAVEYARD}/temp/${tombid}/.* /media/${tombid}/ + + act "Moved all tomb temps" + + rmdir ${GRAVEYARD}/temp/${tombid} + fi +} (DIR) diff --git a/src/zlibs/ttab b/src/zlibs/ttab t@@ -56,7 +56,7 @@ ttab-magic() { compare-key [[ $? = 0 ]] && { act "compare-key -> true" - sudo -u $undertaker $TOMB slam $tombid + close-tomb update-tombs del continue t@@ -69,17 +69,30 @@ ttab-magic() { keypass=${keypass[(ws@:@)2]} xxx "Key password: $keypass" - sudo -u $undertaker $TOMB open $GRAVEYARD/$tombid.tomb \ - -k $COFFINDOT/$tombid.key \ - --unsafe \ - --tomb-pwd "$keypass" - - [[ $? = 0 ]] || { die "Tomb didn't open" && return 1 } + open-tomb [[ -d "/media/$tombid" ]] && { chmod g+rw /media/$tombid update-tombs add } + + check-temptomb } done } + +open-tomb() { + sudo -u ${undertaker} ${TOMB} open \ + ${GRAVEYARD}/${tombid}.tomb \ + -k ${COFFINDOT}/${tombid}.key \ + --unsafe \ + --tomb-pwd "${keypass}" + + [[ $? = 0 ]] || { die "Tomb didn't open" && return 1 } +} + +close-tomb() { + sudo -u ${undertaker} ${TOMB} slam ${tombid} + + [[ $? = 0 ]] || { die "Tomb didn't slam" && return 1 } +}