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 7set -e 8 9LOGOUT_MSG=" 10Name: Please log out to update 11Priority: Medium 12OnlyAdminUsers: False 13DontShowAfterReboot: true 14DisplayIf: /opt/google/chrome-remote-desktop/is-remoting-session 15Description: 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 18NOTIFIER_DIR="/var/lib/update-notifier/user.d" 19VAR_DIR="/var/lib/chrome-remote-desktop" 20HASHES_FILE="$VAR_DIR/hashes" 21 22case "$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 ;; 41esac 42 43# Create defaults file. 44DEFAULTS_FILE="/etc/default/chrome-remote-desktop" 45if [ ! -e "$DEFAULTS_FILE" ]; then 46 echo 'repo_add_once="true"' > "$DEFAULTS_FILE" 47 echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE" 48fi 49 50# Run the cron job immediately to perform repository configuration. 51nohup sh /etc/cron.daily/chrome-remote-desktop > /dev/null 2>&1 & 52 53#DEBHELPER# 54