added post-hooks

This commit is contained in:
Jaromil 2011-02-07 11:56:11 +01:00
parent 09d63eac25
commit 6078356b64
2 changed files with 16 additions and 1 deletions

View File

@ -586,6 +586,7 @@ mount_tomb() {
notice "encrypted storage $tombfile succesfully mounted on $tombmount" notice "encrypted storage $tombfile succesfully mounted on $tombmount"
exec_bind_hooks ${tombmount} exec_bind_hooks ${tombmount}
exec_post_hooks ${tombmount}
exec_as_user tomb-status ${mapper} ${tombfile} ${tombmount} &! exec_as_user tomb-status ${mapper} ${tombfile} ${tombmount} &!
return 0 return 0
} }
@ -610,6 +611,21 @@ exec_bind_hooks() {
eval $hook eval $hook
} }
exec_post_hooks() {
mnt=$1 # first argument is where the tomb is mounted
if ! [ -x ${mnt}/post-hooks ]; then return; fi
# if 'post-hooks' is found inside the tomb, check it: if it is an
# executable, launch it as a user this might need a dialog for
# security on what is being run, however we expect you know well
# what is inside your tomb. this feature opens the possibility to
# make encrypted executables.
cat ${mnt}/post-hooks | head -n1 | grep '^#!/'
if [ $? = 0 ]; then
act "post hooks found, executing as user $SUDO_USER"
exec_as_user ${mnt}/post-hooks
fi
}
umount_tomb() { umount_tomb() {
if ! [ $1 ]; then if ! [ $1 ]; then

View File

@ -198,7 +198,6 @@ gboolean cb_close(GtkWidget *w, GdkEvent *e) {
close(pipefd[1]); // reader will see EOF close(pipefd[1]); // reader will see EOF
waitpid(cpid, &res, 0); waitpid(cpid, &res, 0);
fprintf(stderr,"forked child returns %i",res);
if(res==0) { if(res==0) {
gtk_main_quit(); gtk_main_quit();
notify_uninit(); notify_uninit();