Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / remoting / host / installer / linux / debian / postinst
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     # TODO(lambroslambrou): Remove the '-9' when the underlying problem with
26     # hosts not responding to SIGTERM has been fixed - http://crbug.com/420090
27     echo "Shutting down Chrome Remote Desktop hosts (they will restart automatically)..."
28     killall -9 -q chrome-remote-desktop-host || true
29     # If any files have changed that require the user to restart their virtual
30     # desktops (eg, the wrapper script itself) then notify them but don't do
31     # anything that would result in them losing state.
32     if [ -f "$HASHES_FILE" ]; then
33       if [ -d "$NOTIFIER_DIR" ]; then
34         if ! md5sum --status -c "$HASHES_FILE" 2>/dev/null; then
35           echo "Sending logout notification messages to virtual desktops."
36           echo "$LOGOUT_MSG" > "$NOTIFIER_DIR/chrome-remote-desktop-logout"
37         fi
38       fi
39       rm "$HASHES_FILE"
40       rmdir --ignore-fail-on-non-empty "$VAR_DIR"
41     fi
42     ;;
43 esac
44
45 # Create defaults file.
46 DEFAULTS_FILE="/etc/default/chrome-remote-desktop"
47 if [ ! -e "$DEFAULTS_FILE" ]; then
48   echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
49   echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE"
50 fi
51
52 # Run the cron job immediately to perform repository configuration.
53 nohup sh /etc/cron.daily/chrome-remote-desktop > /dev/null 2>&1 &
54
55 #DEBHELPER#