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

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

Issue 2323153002: Add PAM session wrapper (Closed)
Patch Set: Address feedback Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/installer/linux/debian/chrome-remote-desktop.init
diff --git a/remoting/host/installer/linux/debian/chrome-remote-desktop.init b/remoting/host/installer/linux/debian/chrome-remote-desktop.init
index a36d239122429a27840af8bfa0e87055da4a686d..33f6a428b5ee001e5d8f11f7c8133c4d04ef1c97 100755
--- a/remoting/host/installer/linux/debian/chrome-remote-desktop.init
+++ b/remoting/host/installer/linux/debian/chrome-remote-desktop.init
@@ -12,6 +12,7 @@
# /etc/init.d/chrome-remote-desktop: Start and stop Chrome Remote Desktop host daemon.
HOST_PATH=/opt/google/chrome-remote-desktop/chrome-remote-desktop
+USER_SESSION_PATH=/opt/google/chrome-remote-desktop/user-session
# Group of users for which Chrome Remote Desktop is enabled. Users are added
# to that group when they start the host for the first time.
@@ -46,47 +47,46 @@ run_with_timeout() {
return 1
}
-# Usage: run_and_ignore_error [--login] user program [args...]
-# --login:
-# Run program in a clean login shell. This requires backgrounding, since
-# the user's .profile or .login script might be run, which might contain
-# blocking commands.
+# Usage: run_and_ignore_error user action
+# Carries out the specified action, ignoring any errors.
+# action:
+# --start is handled specially using the user-session wrapper to start a
+# clean log-in session. In any other case, the host script is called through
+# sudo with the specified action flag.
run_and_ignore_error() {
- login_options=""
- if [ "$1" = "--login" ]; then
- login_options="-b -i"
- shift
- fi
-
- user=$1
- shift
+ user="$1"
+ action="$2"
set +e
- sudo -u "$user" $login_options "$@"
+ if [ "$action" = "--start" ]; then
+ "$USER_SESSION_PATH" --user="$user" --me2me-script="$HOST_PATH"
+ else
+ sudo -u "$user" "$HOST_PATH" "$action"
+ fi
}
do_start() {
log_begin_msg "Starting Chrome Remote Desktop host for $1..."
- run_and_ignore_error --login $1 "$HOST_PATH" --start
+ run_and_ignore_error $1 --start
log_end_msg $?
}
do_stop() {
log_begin_msg "Stopping Chrome Remote Desktop host for $1..."
- run_with_timeout run_and_ignore_error $1 "$HOST_PATH" --stop
+ run_with_timeout run_and_ignore_error $1 --stop
log_end_msg $?
}
do_reload() {
log_begin_msg "Reloading Chrome Remote Desktop host configuration for $1..."
- run_and_ignore_error $1 "$HOST_PATH" --reload
+ run_and_ignore_error $1 --reload
log_end_msg $?
}
do_restart() {
log_begin_msg "Restarting Chrome Remote Desktop host for $1..."
- run_and_ignore_error $1 "$HOST_PATH" --stop
- run_and_ignore_error --login $1 "$HOST_PATH" --start
+ run_and_ignore_error $1 --stop
+ run_and_ignore_error $1 --start
log_end_msg $?
}
« no previous file with comments | « remoting/host/installer/linux/Makefile ('k') | remoting/host/installer/linux/debian/chrome-remote-desktop.pam » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698