Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: remoting/host/installer/linux/debian/chrome-remote-desktop.init

Issue 2753243003: Use sudo when starting session as normal user (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ### BEGIN INIT INFO 3 ### BEGIN INIT INFO
4 # Provides: chrome-remote-desktop 4 # Provides: chrome-remote-desktop
5 # Required-Start: $remote_fs $syslog 5 # Required-Start: $remote_fs $syslog
6 # Required-Stop: $remote_fs $syslog 6 # Required-Stop: $remote_fs $syslog
7 # Default-Start: 2 3 4 5 7 # Default-Start: 2 3 4 5
8 # Default-Stop: 0 1 6 8 # Default-Stop: 0 1 6
9 # Short-Description: Chrome Remote Desktop service 9 # Short-Description: Chrome Remote Desktop service
10 ### END INIT INFO 10 ### END INIT INFO
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 # action: 52 # action:
53 # --start is handled specially using the user-session wrapper to start a 53 # --start is handled specially using the user-session wrapper to start a
54 # clean log-in session. In any other case, the host script is called through 54 # clean log-in session. In any other case, the host script is called through
55 # sudo with the specified action flag. 55 # sudo with the specified action flag.
56 run_and_ignore_error() { 56 run_and_ignore_error() {
57 user="$1" 57 user="$1"
58 action="$2" 58 action="$2"
59 59
60 set +e 60 set +e
61 if [ "$action" = "--start" ]; then 61 if [ "$action" = "--start" ]; then
62 "$USER_SESSION_PATH" --user="$user" --me2me-script="$HOST_PATH" 62 # TODO(rkjnsn): Support starting user-initiated sessions with our PAM
63 # wrapper.
64 if [ "$(whoami)" = "root" ]; then
65 "$USER_SESSION_PATH" --user="$user" --me2me-script="$HOST_PATH"
66 else
67 sudo -u "$user" --login --background "$HOST_PATH" --start
68 fi
63 else 69 else
64 sudo -u "$user" "$HOST_PATH" "$action" 70 sudo -u "$user" "$HOST_PATH" "$action"
65 fi 71 fi
66 } 72 }
67 73
68 do_start() { 74 do_start() {
69 log_begin_msg "Starting Chrome Remote Desktop host for $1..." 75 log_begin_msg "Starting Chrome Remote Desktop host for $1..."
70 run_and_ignore_error $1 --start 76 run_and_ignore_error $1 --start
71 log_end_msg $? 77 log_end_msg $?
72 } 78 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 for_each_user do_restart 119 for_each_user do_restart
114 ;; 120 ;;
115 121
116 *) 122 *)
117 log_success_msg "Usage: /etc/init.d/chrome-remote-desktop" \ 123 log_success_msg "Usage: /etc/init.d/chrome-remote-desktop" \
118 "{start|stop|reload|force-reload|restart}" 124 "{start|stop|reload|force-reload|restart}"
119 exit 1 125 exit 1
120 esac 126 esac
121 127
122 exit 0 128 exit 0
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698