chiark / gitweb /
Merge branch 'mdw/svc-merge'
authorMark Wooding <mdw@distorted.org.uk>
Tue, 28 Jan 2014 15:27:27 +0000 (15:27 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 28 Jan 2014 15:27:27 +0000 (15:27 +0000)
* mdw/svc-merge:
  debian/tripe-peer-services.postinst: Retire the old `watch' service.
  Merge the `connect' and `watch' services.
  svc/watch.in: Rename some of the functions.
  svc/watch.in: Use the `Peer' object from `connect' to carry information.

1  2 
debian/tripe-peer-services.postinst

index c21dc16c70b5a5cd361de14224f4888e362b7146,1a4754c5a1c030520441b2a99db6c4f3c032a592..214f82a91df77112a6767432ed65e7b2f7fd98aa
@@@ -46,7 -46,7 +46,7 @@@ restart_services () 
      echo -n " $name"
  
      ## If there's an instance of the service running already then we ask it
 -    ## to quit.  This is where everything gets commplicated.
 +    ## to quit.  This is where everything gets complicated.
      if silently tripectl svcensure "$name"; then
  
        ## So, what we want to do is ask the service to quit, and make sure it
    echo "."
  }
  
- restart_services conntrack connect watch
+ retire_service () {
+   name=$1 version=$2
+   ## If the service is currently running, then ask it to stop.
+   if tripectl >/dev/null 2>&1 svcensure $name && \
+      ! tripectl >/dev/null 2>&1 svcensure $name $version~
+   then
+     tripectl svcsubmit $name quit
+   fi
+   ## Remove the symbolic link if it's there.
+   if [ -L /etc/tripe/services/$name ]; then
+     case $(readlink /etc/tripe/services/$name) in
+       /usr/lib/tripe/services/$name)
+       rm /etc/tripe/services/$name
+       ;;
+     esac
+   fi
+ }
+ case "$1" in
+   configure)
+     v=$2
+     ## Apply upgrades iteratively until we catch up with reality.
+     while :; do
+       ## Here, we killed the `watch' service.
+       if dpkg --compare-versions "$v" lt-nl 1.0.0pre14~; then
+       retire_service watch 1.0.0pre14
+       v=1.0.0pre14
+       ## No more updates to apply.
+       else
+       break
+       fi
+     done
+     ;;
+ esac
+ restart_services conntrack connect
  
  #DEBHELPER#