File tree Expand file tree Collapse file tree 4 files changed +38
-3
lines changed
Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 1+ # crew-sudo.conf: Upstart init configuration file for crew-sudo
2+ description "The crew-sudo daemon"
3+ author "The Chromebrew authors"
4+
5+ # autostart crew-sudo on early boot
6+ start on started boot-services
7+
8+ script
9+ # We pass --foreground to keep crew-sudo in the foreground. Upstart already provides
10+ # the same features for us:
11+ # - It dropped a controlling tty (std{in,err,out} are /dev/null).
12+ # - It calls setsid() for every job.
13+ # - It forked for us.
14+ exec /usr/local/bin/crew-sudo --daemon --foreground
15+ end script
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ def runas_daemon(argv)
88 $mode = :daemon
99
1010 # daemonize
11- Process . daemon ( false , true )
11+ Process . daemon ( false , true ) unless ARGV . include? ( '--foreground' )
12+
1213 Process . setproctitle ( 'sudo-server daemon process' )
1314
1415 warn "crew-sudo: Daemon started with PID #{ Process . pid } "
Original file line number Diff line number Diff line change @@ -35,8 +35,6 @@ when 'crew-sudo'
3535 Run '#{ PROGNAME } --help' for usage.
3636 EOT
3737 end
38- when 'sudod'
39- runas_daemon ( ARGV )
4038when 'sudo'
4139 runas_client ( ARGV )
4240end
Original file line number Diff line number Diff line change 1+ #! /bin/bash -eu
2+
3+ if [ ${EUID} != 0 ] && [ ! -w ${INSTALL_PREFIX} ]; then
4+ echo " Please run this script as root." 2>&1
5+ exit 1
6+ fi
7+
8+ INSTALL_PREFIX=" ${CREW_PREFIX:-/ usr/ local} "
9+
10+ cp -r . ${INSTALL_PREFIX} /lib/crew-sudo
11+
12+ ln -s ../lib/crew-sudo/crew-sudo ${INSTALL_PREFIX} /bin/crew-sudo
13+ ln -s ../lib/crew-sudo/crew-sudo ${INSTALL_PREFIX} /bin/sudo
14+
15+ if [ -d ${INSTALL_PREFIX} /etc/env.d ]; then
16+ # installing under chromebrew
17+ ln -s ../lib/crew-sudo/autostart/crew-sudo.sh ${INSTALL_PREFIX} /etc/env.d/crew_sudo
18+ else
19+ # installing without chromebrew, append the autostart script to bashrc
20+ echo " source ${INSTALL_PREFIX} /lib/crew-sudo/autostart/crew-sudo.sh" > ~ /.bashrc
21+ fi
You can’t perform that action at this time.
0 commit comments