--- a/.hgignore Thu Apr 26 11:45:09 2018 +0200
+++ b/.hgignore Thu Apr 26 11:46:36 2018 +0200
@@ -3,3 +3,4 @@
init.d
tele-watch
tele-watch.8.gz
+*.deb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TODO Thu Apr 26 11:46:36 2018 +0200
@@ -0,0 +1,4 @@
+* detect (u)mounts over watchpoints because tele-watch will probably still
+ watch the 'old' filesystem (in case something is mounted over the filesystem
+ containing the watchpoint) or none at all (in case the filesystem is
+ umounted)
--- a/tele-watch.pl Thu Apr 26 11:45:09 2018 +0200
+++ b/tele-watch.pl Thu Apr 26 11:46:36 2018 +0200
@@ -57,6 +57,8 @@
my ($uid, $gid, $mode) = (stat $dir)[4, 5, 2];
defined(my $pid = fork()) or die "Can't fork: $!\n";
if ($pid == 0) {
+ # avoid execution of END{ } blocks
+ $clean_pids{$$} = 1;
chdir $dir or die "Can't chdir to $dir: $!\n";
for ('public') {
mkdir $_;
@@ -68,7 +70,6 @@
chown($uid, $gid, $_);
chmod($mode & 07777, $_);
}, ".bzr");
- exec "true"; # avoid execution of END{ } blocks
}
wait;
},
@@ -90,7 +91,13 @@
},
);
+my %clean_pids;
+
MAIN: {
+
+ # avoid execution of END{ } blocks
+ $clean_pids{$$} = 1;
+
my @_ARGV = @ARGV;
my %TARGET;
@@ -150,6 +157,9 @@
# cleanup code
END {
+
+ return if delete $clean_pids{$$};
+
foreach (keys %TARGET) {
if (readf("$_/.watched") || 0 == $$) {
unlink "$_/.watched";
@@ -185,9 +195,8 @@
open(STDOUT, ">/dev/null") or die "Can't redir STDOUT: $!\n";
defined(my $pid = fork()) or die "Can't fork: $!\n";
if ($pid) {
- %TARGET = ();
notice "child is $pid";
- $opt_pidfile = "";
+ # detect (u)mounts over watchpoints/targets
exit 0;
}
setsid();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/deb-deps Thu Apr 26 11:46:36 2018 +0200
@@ -0,0 +1,10 @@
+#!/usr/bin/equivs-build
+Section: misc
+Priority: optional
+Standards-Version: 3.9.2
+
+Package: tele-watch-deps
+# Version: <enter version here; defaults to 1.0>
+# Maintainer: Your Name <yourname@example.com>
+Depends: liblinux-inotify2-perl, libunix-syslog-perl
+Description: tele watch dependencies