Home | History | Annotate | Download | only in debian
      1 #!/bin/bash
      2 
      3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 set -e
      8 
      9 LOGOUT_MSG="
     10 Name: Please log out to update
     11 Priority: Medium
     12 OnlyAdminUsers: False
     13 DontShowAfterReboot: true
     14 DisplayIf: /opt/google/chrome-remote-desktop/is-remoting-session
     15 Description: Chrome Remote Desktop has been updated. Please save your work and log out in order to apply this update. Your virtual desktop will be restarted automatically.
     16 "
     17 
     18 NOTIFIER_DIR="/var/lib/update-notifier/user.d"
     19 VAR_DIR="/var/lib/chrome-remote-desktop"
     20 HASHES_FILE="$VAR_DIR/hashes"
     21 
     22 case "$1" in
     23   "configure")
     24     # Kill host processes. The wrapper script will restart them.
     25     echo "Shutting down Chrome Remote Desktop hosts (they will restart automatically)..."
     26     killall -q chrome-remote-desktop-host || true
     27     # If any files have changed that require the user to restart their virtual
     28     # desktops (eg, the wrapper script itself) then notify them but don't do
     29     # anything that would result in them losing state.
     30     if [ -f "$HASHES_FILE" ]; then
     31       if [ -d "$NOTIFIER_DIR" ]; then
     32         if ! md5sum --status -c "$HASHES_FILE" 2>/dev/null; then
     33           echo "Sending logout notification messages to virtual desktops."
     34           echo "$LOGOUT_MSG" > "$NOTIFIER_DIR/chrome-remote-desktop-logout"
     35         fi
     36       fi
     37       rm "$HASHES_FILE"
     38       rmdir --ignore-fail-on-non-empty "$VAR_DIR"
     39     fi
     40     ;;
     41 esac
     42 
     43 #DEBHELPER#
     44