├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── AUTHORS ├── CONTRIBUTORS ├── HOWTO-git ├── LICENSE ├── Makefile ├── README.md ├── build ├── CONTRIBUTORS.sed ├── genversion.sh ├── release.sh └── wrapper.sh ├── chroot-bin ├── brightness ├── crouton-noroot ├── crouton-unity-autostart ├── croutonclip ├── croutoncycle ├── croutonfindnacl ├── croutonnotify ├── croutonpowerd ├── croutontriggerd ├── croutonurlhandler ├── croutonversion ├── croutonxinitrc-wrapper ├── gnome-session-wrapper ├── host-wayland ├── setres ├── startgnome ├── startkde ├── startlxde ├── startunity ├── startxfce4 ├── volume ├── xinit └── xiwi ├── chroot-etc ├── kodi-cycle.py ├── kodi-keyboard.xml ├── pulseaudio-default.pa ├── unity-autostart.desktop ├── unity-profiled ├── xbindkeysrc.scm ├── xiwi.conf ├── xorg-dummy.conf ├── xorg-intel-sna.conf ├── xserverrc ├── xserverrc-local.example ├── xserverrc-xiwi └── xserverrc-xorg ├── host-bin ├── crash_reporter_wrapper ├── delete-chroot ├── edit-chroot ├── enter-chroot ├── mount-chroot ├── startcli ├── starte17 ├── startgnome ├── startkde ├── startkodi ├── startlxde ├── startunity ├── startxfce4 ├── startxiwi └── unmount-chroot ├── host-ext ├── .gitignore ├── crouton │ ├── background.html │ ├── background.js │ ├── connected-19.png │ ├── connected-38.png │ ├── disabled-19.png │ ├── disabled-38.png │ ├── disconnected-19.png │ ├── disconnected-38.png │ ├── error-19.png │ ├── error-38.png │ ├── first.html │ ├── icon-128.png │ ├── icon-48.png │ ├── kiwi.nmf │ ├── manifest.json │ ├── popup.html │ ├── popup.js │ ├── window.html │ └── window.js ├── gencrx.sh ├── logo.svg └── nacl_src │ ├── .gitignore │ ├── Makefile │ ├── keycode_converter.h │ └── kiwi.cc ├── installer ├── .gitattributes ├── arch │ ├── bootstrap │ ├── defaults │ ├── getrelease.sh │ ├── prepare │ └── releases ├── crouton ├── debian │ ├── ar │ ├── bootstrap │ ├── defaults │ ├── getrelease.sh │ ├── pkgdetails │ ├── prepare │ └── releases ├── functions ├── kali │ ├── ar │ ├── bootstrap │ ├── defaults │ ├── getrelease.sh │ ├── pkgdetails │ ├── prepare │ └── releases ├── main.sh ├── prepare.sh └── ubuntu │ ├── ar │ ├── bootstrap │ ├── defaults │ ├── getrelease.sh │ ├── pkgdetails │ ├── prepare │ └── releases ├── src ├── fbserver-proto.h ├── fbserver.c ├── findnacld.c ├── freon.c ├── vtmonitor.c ├── websocket.c ├── websocket.h └── xi2event.c ├── targets ├── audio ├── aur ├── chrome ├── chrome-beta ├── chrome-common ├── chrome-dev ├── chromium ├── cli-extra ├── common ├── core ├── e17 ├── extension ├── gnome ├── gnome-desktop ├── gtk-extra ├── kde ├── kde-desktop ├── keyboard ├── kodi ├── lxde ├── lxde-desktop ├── post-common ├── touch ├── unity ├── unity-desktop ├── x11 ├── x11-common ├── xbmc ├── xfce ├── xfce-desktop ├── xiwi └── xorg └── test ├── autotest_control.template ├── daemon.sh ├── genreport.sh ├── reports ├── 00-all.sh ├── 35-xorg.sh └── w0-common.sh ├── run.sh └── tests ├── 00-tester ├── 10-basic ├── 11-32-on-64 ├── 12-edit-chroot ├── 14-background ├── 15-media ├── 16-targetsfile ├── 17-encryption ├── 18-upgrade ├── 20-logind ├── 30-audio ├── 35-xorg ├── 37-xiwi ├── w0-common ├── w1-e17 ├── w2-gnome ├── w2d-gnome-desktop ├── w3-kde ├── w3d-kde-desktop ├── w4-lxde ├── w4d-lxde-desktop ├── w5-unity ├── w5d-unity-desktop ├── w6-kodi ├── w7-xfce ├── w7d-xfce-desktop └── x0-alltargets /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## For users who want to report an issue 2 | Please read [this wiki page] 3 | (https://github.com/dnschneid/crouton/wiki/Common-issues-and-reporting) 4 | for instructions on reporting an issue. 5 | 6 | ## For contributors 7 | Please read [this 8 | section](https://github.com/dnschneid/crouton#i-want-to-be-a-contributor) 9 | of the README and the following relevant sections first. 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ``` 2 | Please paste the output of the following command here: sudo edit-chroot -all 3 | ``` 4 | 5 | #### Please describe your issue: 6 | 7 | 8 | #### If known, describe the steps to reproduce the issue: 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.* 2 | .*.swp 3 | .*.tmp 4 | nacl_sdk/ 5 | /crouton* 6 | /test/run 7 | /releases/ 8 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Google, Inc 2 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Aaron Zauner 2 | Alex Bennée 3 | Alfred Suleymanov 4 | Alfriadox 5 | Alireza Ghasemi 6 | Andrew Kanner 7 | Aron Griffis 8 | Aurelien Lourot 9 | Blaine Bublitz 10 | Braden Farmer 11 | brannon 12 | brmbrmcar 13 | Bryce Thorup 14 | Chris Galle 15 | Chris Varga 16 | Christopher Mårtensson 17 | Chris Varga 18 | Corey Garst 19 | David Reveman 20 | David Schneider 21 | Dennis Lockhart 22 | dimonf 23 | dumpweed 24 | Eugene Y. Q. Shen 25 | George Shank 26 | Icecream95 27 | Igor Bukanov 28 | Jake Waksbaum 29 | Javi Merino 30 | jessaustin 31 | Jim Tittsler 32 | Johan Lorentzon 33 | John Tantalo 34 | joshua stein 35 | Justin Guy 36 | Kenny Strawn 37 | Kerwin Hui 38 | Lef Ioannidis 39 | Magnus Nyberg 40 | Masaki Muranaka 41 | Maurice van Kruchten 42 | Micah Lee 43 | Michael Mattioli 44 | Michael Orr 45 | Mike Kasick 46 | Mikito Takada 47 | Miles Whittaker 48 | Nevada Romsdahl 49 | Nicolas Boichat 50 | Pete Baldridge 51 | Rich Murphey 52 | Ricky Brent 53 | Ryan Fowler 54 | Samuel Dionne-Riel 55 | Simon Podhajsky 56 | Stephen Barber 57 | Steven Maude 58 | Steven Merrill 59 | Ted Matsumura 60 | Tobbe Lundberg 61 | Tony Xue 62 | William Ransohoff 63 | William W. Wu 64 | Yang Wang 65 | Yu-Hsi Chiang 66 | Yuri Pole 67 | Yushin Washio 68 | zguithues 69 | -------------------------------------------------------------------------------- /HOWTO-git: -------------------------------------------------------------------------------- 1 | This repository is a bit strange, because we constantly rebase on dnschneid/crouton. 2 | 3 | That means you need to do the following to fetch modifications from the tree: 4 | git fetch --all 5 | git reset --hard origin/master 6 | 7 | Be careful, as this will erase any other commit you did in your own master branch. 8 | 9 | ==== 10 | Rebasing is done as follows (you need to be in the master branch): 11 | 12 | git pull origin lastcrouton 13 | 14 | # Save a copy of the old branch, just in case: 15 | git branch -f master-base-`cat .git/refs/tags/lastcrouton` 16 | git push origin master-base-`cat .git/refs/tags/lastcrouton` 17 | 18 | git fetch --all 19 | git reset --hard crouton/master 20 | # Careful with the next one 21 | git clean -x -d -n 22 | git clean -x -d -f 23 | 24 | git merge --squash origin/croagh+arch; git commit 25 | git merge --squash origin/clipboard; git commit 26 | git merge --squash origin/audio; git commit 27 | 28 | # Then cherry-pick needed commits from master-base-`cat .git/refs/tags/lastcrouton` 29 | 30 | git tag -f lastcrouton crouton/master 31 | git push -f origin lastcrouton 32 | 33 | git push -f origin master 34 | 35 | ======== 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The crouton Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | TARGET = crouton 6 | EXTTARGET = crouton.zip 7 | LIBS = src/freon.c 8 | LIBSTARGETS = $(patsubst src/%.c, crouton%.so, $(LIBS)) 9 | SRCTARGETS = $(patsubst src/%.c,crouton%,$(filter-out $(LIBS),$(wildcard src/*.c))) 10 | CONTRIBUTORS = CONTRIBUTORS 11 | WRAPPER = build/wrapper.sh 12 | SCRIPTS := \ 13 | $(wildcard chroot-bin/*) \ 14 | $(wildcard chroot-etc/*) \ 15 | $(wildcard host-bin/*) \ 16 | $(wildcard installer/*.sh) installer/functions \ 17 | $(wildcard installer/*/*) \ 18 | $(wildcard src/*) \ 19 | $(wildcard targets/*) 20 | EXTPEXE = host-ext/crouton/kiwi.pexe 21 | EXTPEXESOURCES = $(wildcard host-ext/nacl_src/*.h) \ 22 | $(wildcard host-ext/nacl_src/*.cc) 23 | EXTSOURCES = $(wildcard host-ext/crouton/*) 24 | BOOTSTRAPS := $(wildcard installer/*/bootstrap) 25 | BUILDDIR = crouton.build 26 | GENVERSION = build/genversion.sh 27 | CONTRIBUTORSSED = build/CONTRIBUTORS.sed 28 | RELEASE = build/release.sh 29 | VERSION = 1 30 | TARPARAMS ?= -j 31 | 32 | CFLAGS=-g -Wall -Werror -Os 33 | 34 | croutonfbserver_LIBS = -lX11 -lXdamage -lXext -lXfixes -lXtst 35 | croutonxi2event_LIBS = -lX11 -lXi 36 | croutonfreon.so_LIBS = -ldl -ldrm -I/usr/include/libdrm 37 | 38 | croutonwebsocket_DEPS = src/websocket.h 39 | croutonfbserver_DEPS = src/websocket.h 40 | 41 | ifeq ($(wildcard .git/HEAD),) 42 | GITHEAD := 43 | else 44 | GITHEADFILE := .git/refs/heads/$(shell cut -d/ -f3 '.git/HEAD') 45 | ifeq ($(wildcard $(GITHEADFILE)),) 46 | GITHEAD := .git/HEAD 47 | else 48 | GITHEAD := .git/HEAD .git/refs/heads/$(shell cut -d/ -f3 '.git/HEAD') 49 | endif 50 | endif 51 | 52 | $(TARGET): $(WRAPPER) $(BUILDDIR) $(GENVERSION) $(GITHEAD) Makefile 53 | { \ 54 | sed -e "s/\$$TARPARAMS/$(TARPARAMS)/" \ 55 | -e "s/VERSION=.*/VERSION='$(shell $(GENVERSION) $(VERSION))'/" \ 56 | $(WRAPPER) \ 57 | && (cd $(BUILDDIR) && tar --owner=root --group=root -c $(TARPARAMS) *)\ 58 | && chmod +x /dev/stdout \ 59 | ;} > $(TARGET) || ! rm -f $(TARGET) 60 | 61 | $(BUILDDIR): $(SCRIPTS) Makefile 62 | rm -rf $(BUILDDIR) && mkdir -p $(BUILDDIR) \ 63 | && cp -at $(BUILDDIR) --parents $(SCRIPTS) \ 64 | && for bootstrap in $(BOOTSTRAPS); do \ 65 | tmp=$(BUILDDIR); \ 66 | [ -h "$$bootstrap" ] && continue; \ 67 | echo "Preparing bootstrap dependencies for $$bootstrap" >&2; \ 68 | tmp=$(BUILDDIR) sh -e "$$bootstrap" \ 69 | || ! rm -rf $(BUILDDIR) || exit 1; \ 70 | done 71 | 72 | $(EXTTARGET): $(EXTSOURCES) Makefile 73 | rm -f $(EXTTARGET) && zip -q --junk-paths $(EXTTARGET) $(EXTSOURCES) 74 | 75 | $(EXTPEXE): $(EXTPEXESOURCES) 76 | $(MAKE) -C host-ext/nacl_src 77 | 78 | $(SRCTARGETS): $(patsubst crouton%,src/%.c,$@) $($@_DEPS) Makefile 79 | gcc $(CFLAGS) $(patsubst crouton%,src/%.c,$@) $($@_LIBS) -o $@ 80 | 81 | $(LIBSTARGETS): $(patsubst crouton%.so,src/%.c,$@) $($@_DEPS) Makefile 82 | gcc $(CFLAGS) -shared -fPIC $(patsubst crouton%.so,src/%.c,$@) $($@_LIBS) -o $@ 83 | 84 | extension: $(EXTTARGET) 85 | 86 | $(CONTRIBUTORS): $(GITHEAD) $(CONTRIBUTORSSED) 87 | git shortlog -s | sed -f $(CONTRIBUTORSSED) | sort -uf > $(CONTRIBUTORS) 88 | 89 | contributors: $(CONTRIBUTORS) 90 | 91 | release: $(CONTRIBUTORS) $(TARGET) $(RELEASE) 92 | [ ! -d .git ] || git status | grep -q 'working [a-z]* clean' || \ 93 | { echo "There are uncommitted changes. Aborting!" 1>&2; exit 2; } 94 | $(RELEASE) $(TARGET) 95 | 96 | force-release: $(CONTRIBUTORS) $(TARGET) $(RELEASE) 97 | $(RELEASE) -f $(TARGET) 98 | 99 | all: $(TARGET) $(SRCTARGETS) $(LIBSTARGETS) $(EXTTARGET) 100 | 101 | clean: 102 | rm -f $(TARGET) $(EXTTARGET) $(SRCTARGETS) $(LIBSTARGETS) 103 | rm -rf $(BUILDDIR) 104 | 105 | .PHONY: all clean contributors extension release force-release 106 | -------------------------------------------------------------------------------- /build/CONTRIBUTORS.sed: -------------------------------------------------------------------------------- 1 | s/^[ \t0-9]*// 2 | s/^DennisL.*$/Dennis Lockhart/ 3 | s/^drinkcat$/Nicolas Boichat/ 4 | s/^divx118$/Maurice van Kruchten/ 5 | s/^tedm$/Ted Matsumura/ 6 | s/^magnus$/Magnus Nyberg/ 7 | s/^eyqs$/Eugene Y. Q. Shen/ 8 | /^nromsdahl$/d 9 | /^root$/d 10 | /^ttk153$/d 11 | /^lnxsrt$/d 12 | /\?/d 13 | -------------------------------------------------------------------------------- /build/genversion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Outputs a version string with the specified prefix. 7 | 8 | if [ "$#" != 1 ]; then 9 | echo "Usage: ${0##*/} VERSION" 1>&2 10 | exit 1 11 | fi 12 | 13 | source='' 14 | 15 | # Get the branch from git 16 | git="`dirname "$0"`/../.git" 17 | if [ -f "$git/HEAD" ]; then 18 | source="`cut -d/ -f3 "$git/HEAD"`" 19 | if [ -n "$source" ]; then 20 | if [ -f "$git/refs/heads/$source" ]; then 21 | source="$source:`head -c 8 "$git/refs/heads/$source"`" 22 | else 23 | source="${source%"${source#????????}"}" 24 | fi 25 | source="~$source" 26 | fi 27 | fi 28 | 29 | VERSION="$1-%Y%m%d%H%M%S$source" 30 | 31 | exec date "+$VERSION" 32 | -------------------------------------------------------------------------------- /build/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | # Generates a release in the releases/ directory (which should be a checkout of 9 | # the releases branch of the same repo) and pushes it. 10 | 11 | USAGE="Usage: ${0##*/} [-f] bundle [..] 12 | -f Hard-reset the releases branch in case of unpushed releases." 13 | FORCE='' 14 | 15 | # CD into the repo's root directory 16 | dir="`readlink -f -- "$0"`" 17 | cd "${dir%/*}/.." 18 | 19 | # Import common functions 20 | . installer/functions 21 | 22 | if [ "$1" = '-f' ]; then 23 | FORCE=y 24 | shift 25 | fi 26 | 27 | if [ "$#" = 0 ]; then 28 | error 2 "$USAGE" 29 | fi 30 | 31 | # Check the releases directory and update, or create it if necessary 32 | if [ -d releases/.git ]; then 33 | if ! grep -q 'releases$' releases/.git/HEAD; then 34 | error 1 'releases/ is not in the releases branch.' 35 | fi 36 | if ! awk "/'releases'/{print \$1}" releases/.git/FETCH_HEAD | \ 37 | diff -q releases/.git/refs/heads/releases - >/dev/null; then 38 | echo 'releases/ is ahead of or not up-to-date with remote' 1>&2 39 | if [ -z "$FORCE" ]; then 40 | exit 1 41 | fi 42 | fi 43 | git -C releases fetch origin releases 44 | git -C releases reset --hard origin/releases 45 | elif [ -e releases ]; then 46 | error 1 "releases/ is not a git repo" 47 | else 48 | url="`git remote -v | awk '$1=="origin" && $3=="(fetch)" {print $2}'`" 49 | git clone --single-branch --branch releases --reference . "$url" releases 50 | fi 51 | 52 | # Apply the releases 53 | for bundle in "$@"; do 54 | bundle="${bundle##*/}" 55 | if [ ! -f "$bundle" ]; then 56 | error 1 "$bundle bundle does not exist" 57 | fi 58 | version="`sh "$bundle" -V`" 59 | if [ "$version" = "${version#crouton*:}" ]; then 60 | error 1 "$bundle bundle is invalid" 61 | fi 62 | branch="${version#*~}" 63 | branch="${branch%:*}" 64 | dest="${branch#master}" 65 | dest="crouton${dest:+-}$dest" 66 | # Compare the current release to avoid duplicates 67 | if [ -f "releases/$dest" ] && \ 68 | sh "releases/$dest" -V | grep -q "${version#*~}"; then 69 | echo "Release already current: `sh "$bundle" -V`" 70 | continue 71 | fi 72 | # Copy it in and make a commit 73 | cp -fv "$bundle" "releases/$dest" 74 | git -C releases add "$dest" 75 | git -C releases commit -m "$version" 76 | done 77 | 78 | # Push the resulting releases 79 | git -C releases push origin releases 80 | git -C releases fetch origin releases 81 | 82 | exit 0 83 | -------------------------------------------------------------------------------- /build/wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file of the source repository, which has been replicated 5 | # below for convenience of distribution: 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above 14 | # copyright notice, this list of conditions and the following disclaimer 15 | # in the documentation and/or other materials provided with the 16 | # distribution. 17 | # * Neither the name of Google Inc. nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # This is a wrapped tarball. This script untars itself to a temporary directory 34 | # and then runs installer/main.sh with the parameters passed to it. 35 | # You can pass -x [directory] to extract the contents somewhere. 36 | 37 | set -e 38 | 39 | VERSION='git' 40 | 41 | # Minimum Chromium OS version is R45 stable 42 | CROS_MIN_VERS=7262 43 | 44 | if [ "$1" = '-x' -a "$#" -le 2 ]; then 45 | # Extract to the specified directory. 46 | SCRIPTDIR="${2:-"${0##*/}.unbundled"}" 47 | mkdir -p "$SCRIPTDIR" 48 | else 49 | # Make a temporary directory and auto-remove it when the script ends. 50 | SCRIPTDIR="`mktemp -d --tmpdir=/tmp "${0##*/}.XXX"`" 51 | TRAP="rm -rf --one-file-system '$SCRIPTDIR';$TRAP" 52 | trap "$TRAP" INT HUP 0 53 | fi 54 | 55 | # Extract this file after the ### line 56 | # TARPARAMS will be set by the Makefile to match the compression method. 57 | line="`awk '/^###/ { print FNR+1; exit 0; }' "$0"`" 58 | tail -n "+$line" "$0" | tar -x $TARPARAMS -C "$SCRIPTDIR" 59 | 60 | # Exit here if we're just extracting 61 | if [ -z "$TRAP" ]; then 62 | exit 63 | fi 64 | 65 | # See if we want to just run a script from the bundle 66 | if [ "$1" = '-X' ]; then 67 | script="$SCRIPTDIR/$2" 68 | if [ ! -f "$script" ]; then 69 | cd "$SCRIPTDIR" 70 | echo "USAGE: ${0##*/} -X DIR/SCRIPT [ARGS] 71 | Runs a script directly from the bundle. Valid DIR/SCRIPT combos:" 1>&2 72 | ls chroot-bin/* host-bin/* 1>&2 73 | if [ -n "$2" ]; then 74 | echo 1>&2 75 | echo "Invalid script '$2'" 1>&2 76 | fi 77 | exit 2 78 | fi 79 | shift 2 80 | # If this script was called with '-x' or '-v', pass that on 81 | SETOPTIONS="-e" 82 | if set -o | grep -q '^xtrace.*on$'; then 83 | SETOPTIONS="$SETOPTIONS -x" 84 | fi 85 | if set -o | grep -q '^verbose.*on$'; then 86 | SETOPTIONS="$SETOPTIONS -v" 87 | fi 88 | sh $SETOPTIONS "$script" "$@" 89 | exit "$?" 90 | fi 91 | 92 | # Execute the main script inline. It will use SCRIPTDIR to find what it needs. 93 | . "$SCRIPTDIR/installer/main.sh" 94 | 95 | exit 96 | ### end of script; tarball follows 97 | -------------------------------------------------------------------------------- /chroot-bin/brightness: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # A shortcut script to control device brightness. 7 | # Usage: 8 | # brightness [b|k] [up|down|# [instant]] 9 | 10 | # Choose the device 11 | device='Screen' 12 | nokbd='' 13 | case "$1" in 14 | k*) device='Keyboard' 15 | nokbd='echo "Command not supported with keyboard backlight." 1>&2; exit 1' 16 | shift;; 17 | b*) shift;; 18 | esac 19 | 20 | # Handle user command 21 | print='' 22 | postcmd='' 23 | case "$1" in 24 | u*) precmd='Increase';; 25 | d*) precmd='Decrease';; 26 | [0-9]*) eval $nokbd; 27 | precmd='Set'; postcmd="Percent double:$1 int32:${2:-"1"}${2:+"2"}";; 28 | *) eval $nokbd; precmd='Get'; postcmd='Percent'; print='--print-reply';; 29 | esac 30 | 31 | host-dbus dbus-send --system --dest=org.chromium.PowerManager \ 32 | --type=method_call $print /org/chromium/PowerManager \ 33 | org.chromium.PowerManager.${precmd}${device}Brightness${postcmd} | { 34 | read -r junk 35 | read -r double percent 36 | if [ -n "$print" ]; then 37 | echo "${percent%.*}" 38 | fi 39 | } 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /chroot-bin/crouton-noroot: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Wrapper for scripts that shouldn't be launched as root. 7 | # Symlink to launch the application with the same name in /usr/bin/ 8 | # Launch directly with a parameter to launch that executable 9 | # Launch directly with a blank or - first parameter and a word to just check and 10 | # exit with an exit code, printing out the second parameter as the app name. 11 | 12 | APPLICATION="${0##*/}" 13 | if [ "$APPLICATION" = 'crouton-noroot' ]; then 14 | if [ -z "$1" -o "$1" = '-' -o "$1" = '--' ]; then 15 | APPLICATION='' 16 | else 17 | APPLICATION="$1" 18 | shift 19 | fi 20 | else 21 | APPLICATION="/usr/bin/$APPLICATION" 22 | fi 23 | 24 | if [ "$USER" = root -o "$UID" = 0 ]; then 25 | app="${APPLICATION:-"$2"}" 26 | echo "Do not launch ${app##*/} as root inside the chroot." 1>&2 27 | exit 2 28 | elif [ -z "$APPLICATION" ]; then 29 | exit 0 30 | fi 31 | 32 | exec "$APPLICATION" "$@" 33 | -------------------------------------------------------------------------------- /chroot-bin/crouton-unity-autostart: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | # 6 | # Helper script for launching services normally managed by upstart. 7 | # Called during session's XDG autostart. 8 | 9 | RELEASE="`/usr/local/bin/croutonversion -r`" 10 | 11 | # Run the exec line from an Upstart conf file. Right now this assumes no space 12 | # in the path and no arguments. 13 | execfromconf() { 14 | local exec_cmd="`awk '/^exec/{print $2; exit}' "$1"`" 15 | if [ -x "$exec_cmd" ]; then 16 | "$exec_cmd" & 17 | fi 18 | } 19 | 20 | # Upstart launches unity on utopic+, and this needs to be started before 21 | # any dependent services. 22 | if [ "$RELEASE" = 'xenial' ]; then 23 | PATH="$PATH":/sbin /usr/bin/unity & 24 | fi 25 | 26 | # Launch window-stack-bridge for Unity HUD support, and unity-panel-service for 27 | # indicators. 28 | if [ "$RELEASE" != 'precise' ]; then 29 | services="unity-panel-service window-stack-bridge" 30 | for service in $services; do 31 | conf_file=/usr/share/upstart/sessions/"$service".conf 32 | execfromconf "$conf_file" 33 | done 34 | fi 35 | 36 | # If on trusty or later, indicators also need to be started. 37 | if [ "$RELEASE" = 'trusty' -o "$RELEASE" = 'xenial' ]; then 38 | for conf_file in /usr/share/upstart/sessions/*.conf; do 39 | if grep -q '^start on.* indicator-services-start' "$conf_file"; then 40 | execfromconf "$conf_file" 41 | fi 42 | done 43 | fi 44 | -------------------------------------------------------------------------------- /chroot-bin/croutonfindnacl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # croutonfindnacl address signature ["pids"] 7 | # 8 | # This script is used by croutonfbserver to find the nacl_helper process it is 9 | # connected to, and, in particular, the file descriptor corresponding to the shm 10 | # memory that the nacl_helper process shares with Chromium. 11 | # 12 | # - address: NaCl-space address of the shared memory (hexadecimal). We assume 13 | # that the NaCl/hardware memory mapping conserves the address, 14 | # possibly with a prefix in the MSBs. 15 | # - signature: random 8 byte pattern (hexadecimal, machine byte order) that is 16 | # written at the beginning of the shared buffer by the NaCl 17 | # application. The first 8 bytes of each candidate buffer is read, 18 | # guaranteeing that the correct buffer is returned. 19 | # - pids: (normally ununsed, defaults to all processes named "nacl_helper") 20 | # Space-separated list of PIDs to scan for. 21 | # 22 | # On success, prints "pid:filename" and exits with code 0. 23 | # On error (shm not found, invalid parameters), exits with code >0. 24 | 25 | set -e 26 | 27 | VERBOSE= 28 | 29 | if [ "$#" -lt 2 -o "$#" -gt 3 ]; then 30 | echo "Invalid parameters" 31 | exit 2 32 | fi 33 | 34 | ADDRESS="$1" 35 | PATTERN="$2" 36 | PIDS="${3:-"`pgrep nacl_helper`"}" 37 | 38 | MATCH="" 39 | 40 | # Iterate over all NaCl helper processes 41 | for pid in $PIDS; do 42 | [ -n "$VERBOSE" ] && echo "pid:$pid" 1>&2 43 | # Find candidate mappings 44 | file="`awk '$1 ~ /^[0-9a-f]*'"$ADDRESS"'-/ && $2 == "rw-s" \ 45 | && $6 ~ /\/shm\/\.(com\.google\.Chrome|org\.chromium\.Chromium)/ \ 46 | { print $6 } 47 | ' "/proc/$pid/maps"`" 48 | [ -n "$VERBOSE" ] && echo "file:$file" 1>&2 49 | if [ -z "$file" ]; then 50 | continue 51 | fi 52 | 53 | # Iterate over mappings, and check signature 54 | for fd in "/proc/$pid/fd"/*; do 55 | link="$(readlink -- "$fd" || true)" 56 | link="${link% (deleted)}" 57 | if [ "$link" = "$file" ]; then 58 | # Check if signature matches 59 | pattern="`od -An -t x1 -N8 "$fd" | tr -d ' '`" 60 | [ -n "$VERBOSE" ] && echo "FD:$fd ($pattern)" 1>&2 61 | if [ "$pattern" = "$PATTERN" ]; then 62 | # Second match? This should never happen 63 | if [ -n "$MATCH" ]; then 64 | echo -n "-1:ambiguous" 65 | exit 1 66 | fi 67 | MATCH="$pid:$fd" 68 | fi 69 | fi 70 | done 71 | done 72 | 73 | if [ -n "$MATCH" ]; then 74 | echo -n "$MATCH" 75 | exit 0 76 | else 77 | echo -n "-1:no match" 78 | exit 1 79 | fi 80 | -------------------------------------------------------------------------------- /chroot-bin/croutonnotify: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | USAGE="${0##*/} -j 7 | ${0##*/} -t title [-m message] [-d] [-i icon] [-I id] 8 | Raises a notification in Chromium OS (requires crouton extension). 9 | 10 | When -j is specified, reads JSON data from stdin, in the format required 11 | by chrome.notifications API, with 2 additional fields, \"crouton_id\" and 12 | \"crouton_display\", corresponding respectively to the notification id, and the 13 | display to switch to when the notification is clicked (croutoncycle parameter). 14 | 15 | Otherwise, constructs a \"basic\" notification with the requested fields. 16 | 17 | Options: 18 | -j Read JSON data from stdin (see example below) 19 | -t Title to display (chrome.notifications field: \"title\") 20 | -m Message to display (chrome.notifications field: \"message\") 21 | -d Switch to display in environment variable DISPLAY ($DISPLAY) when 22 | the notification is clicked. Default: Do not switch display. 23 | -i Small icon to display on the left of the notification 24 | (chrome.notifications field: \"iconUrl\") 25 | -I ID to pass to chrome.notifications.create: only the last 26 | notification with a given ID is shown. 27 | Default: Display a new notification. 28 | 29 | Example JSON data: 30 | "'{ 31 | "type": "basic", 32 | "title": "Primary Title", 33 | "message": "Primary message to display", 34 | "crouton_display": ":1", 35 | "iconUrl": "data:image/png;base64," 36 | }' 37 | 38 | . "$(dirname "$0")/../installer/functions" 39 | 40 | SWITCHDISPLAY="" 41 | MESSAGE="" 42 | TITLE="" 43 | ID="" 44 | ICON="" 45 | JSON="" 46 | 47 | # Process arguments 48 | while getopts 'di:I:jm:t:' f; do 49 | case "$f" in 50 | d) SWITCHDISPLAY="$DISPLAY";; 51 | i) ICON="$OPTARG";; 52 | I) ID="$OPTARG";; 53 | j) JSON="y";; 54 | m) MESSAGE="$OPTARG";; 55 | t) TITLE="$OPTARG";; 56 | \?) error 2 "$USAGE";; 57 | esac 58 | done 59 | 60 | # No extra parameters, -j precludes other parameters, and at least title 61 | # must be specified (or -j) 62 | if [ "$#" != "$((OPTIND-1))" ] || 63 | [ "$JSON" = 'y' -a -n "$SWITCHDISPLAY$ICON$ID$MESSAGE$TITLE" ] || 64 | [ -z "$JSON$TITLE" ]; then 65 | error 2 "$USAGE" 66 | fi 67 | 68 | if [ -n "$ICON" ] && [ ! -r "$ICON" -o ! -f "$ICON" ]; then 69 | error 2 "Cannot open $ICON." 70 | fi 71 | 72 | # Escape json string (backslash and double quotes) 73 | json_escape() { 74 | echo -n "$1" | sed -e 's/\\/\\u005C/g;s/"/\\u0022/g;2~1s/^/\\u000A/;' \ 75 | | tr -d '\n' 76 | } 77 | 78 | STATUS="$({ 79 | echo -n "N" 80 | if [ -z "$JSON" ]; then 81 | echo -n '{ 82 | "type": "basic", 83 | "title": "'"$(json_escape "$TITLE")"'", 84 | "message": "'"$(json_escape "$MESSAGE")"'", 85 | "crouton_display": "'"$(json_escape "$SWITCHDISPLAY")"'", 86 | "crouton_id": "'"$(json_escape "$ID")"'"' 87 | if [ -n "$ICON" ]; then 88 | ext="${ICON##*.}" 89 | if grep -Iq '&2 42 | exit 2 43 | fi 44 | exec "$EXEC" "$@";; 45 | esac 46 | 47 | hostdbus='' 48 | if hash host-dbus 2>/dev/null; then 49 | hostdbus='host-dbus' 50 | fi 51 | 52 | pingpowerd() { 53 | $hostdbus dbus-send --system --dest=org.chromium.PowerManager \ 54 | --type=method_call /org/chromium/PowerManager \ 55 | org.chromium.PowerManager.HandleUserActivity \ 56 | int32:0 || true 57 | } 58 | 59 | if [ "$CMD" = 'p' ]; then 60 | # Ping 61 | pingpowerd 62 | exec "${EXEC:-"true"}" "$@" 63 | elif [ "$CMD" = 'i' ]; then 64 | # Inhibit 65 | while pingpowerd; do 66 | sleep "$INHIBITSLEEP" 67 | done & 68 | pid=$! 69 | addtrap "kill '$pid' 2>/dev/null" 70 | if [ -n "$EXEC" ]; then 71 | "$EXEC" "$@" 72 | elif [ -n "$2" ]; then 73 | shift 74 | "$@" 75 | else 76 | wait $pid 77 | fi 78 | elif [ -n "$EXEC" ]; then 79 | exec "$EXEC" "$@" 80 | elif [ "$CMD" = 's' ]; then 81 | if hash croutoncycle 2>/dev/null; then 82 | croutoncycle cros 83 | fi 84 | $hostdbus dbus-send --system --dest=org.chromium.PowerManager \ 85 | --type=method_call /org/chromium/PowerManager \ 86 | org.chromium.PowerManager.RequestSuspend || true 87 | elif [ "$CMD" = 'd' ]; then 88 | if [ -z "$DISPLAY" ]; then 89 | error 1 'Cannot launch daemon: $DISPLAY not specified.' 90 | fi 91 | 92 | # Daemon 93 | xdgs='/usr/bin/xdg-screensaver' 94 | xi2pid='' 95 | 96 | # Send pings to powerd at regular intervals, if the user is active (i.e. 97 | # there are input events), or if the screensaver is disabled. 98 | # For performance reason, we probably do not want to monitor every single 99 | # X input events. Therefore, we start a subshell that pings powerd upon 100 | # receiving a single event, then quits. 101 | # Every $DAEMONSLEEP seconds we check if that subshell if alive, and 102 | # restart it if necessary. This means that we miss events during up to 103 | # $DAEMONSLEEP seconds, and, if powerd timeout is X seconds, then the 104 | # screen may already dim after X-DAEMONSLEEP seconds of inactivity. This is 105 | # not noticeable if DAEMONSLEEP is much smaller than X (usually, X=300s). 106 | 107 | while sleep "$DAEMONSLEEP"; do 108 | if [ "`"$xdgs" status 2>/dev/null`" = 'disabled' ]; then 109 | # Screensaver disabled: ping 110 | pingpowerd 111 | elif [ -z "$xi2pid" ] || ! kill -0 "$xi2pid" 2>/dev/null; then 112 | # croutonxi2event subshell is not running 113 | 114 | if [ -n "$xi2pid" ]; then 115 | # Fail if return status from process != 0: wait returns the exit 116 | # status of the child, and this shell exits on error (-e) 117 | wait $xi2pid 118 | fi 119 | 120 | # Wait for input event, then ping immediately 121 | ( croutonxi2event -1 >/dev/null 2>&1 && pingpowerd ) & 122 | xi2pid=$! 123 | fi 124 | done 125 | fi 126 | 127 | exit 0 128 | -------------------------------------------------------------------------------- /chroot-bin/croutontriggerd: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | # 6 | # Monitors keyboard events for the crouton switch command. 7 | 8 | . "`dirname "$0"`/../installer/functions" 9 | 10 | # hexdump output format variables 11 | if getconf LONG_BIT | grep -q 32; then 12 | HEXDUMP_FMT='2/4 "%u 0 " " " 2/2 "%u " " " 1/4 "%u " "\n"' 13 | else 14 | HEXDUMP_FMT='4/4 "%u " " " 2/2 "%u " " " 1/4 "%u " "\n"' 15 | fi 16 | SECONDS_LO='$1' 17 | SECONDS_HI='$2' 18 | USECONDS_LO='$3' 19 | USECONDS_HI='$4' 20 | TYPE='$5' 21 | KEY='$6' 22 | STATE='$7' 23 | 24 | # constants 25 | TYPE_EV_KEY=1 26 | STATE_DOWN=1 27 | STATE_UP=0 28 | KEY_LEFTCTRL=29 29 | KEY_LEFTALT=56 30 | KEY_LEFTSHIFT=42 31 | KEY_RIGHTCTRL=97 32 | KEY_RIGHTALT=100 33 | KEY_RIGHTSHIFT=54 34 | KEY_F1=59 35 | KEY_F2=60 36 | 37 | EVENT_DEV_POLL=15 38 | 39 | # Only one at a time. xbindkeys lockfile is for legacy compatibility 40 | mkdir -m 775 -p "$CROUTONLOCKDIR" 41 | exec 3>>"$CROUTONLOCKDIR/xbindkeys" 42 | chmod -Rf g+rwX "$CROUTONLOCKDIR" || true 43 | chgrp -Rf crouton "$CROUTONLOCKDIR" || true 44 | if ! flock -n 3; then 45 | echo "Another instance of ${0##*/} running, waiting..." 46 | flock 3 47 | fi 48 | 49 | # Reset event variables to handle strange environments 50 | unset `set | grep -o '^event[0-9]*'` 2>/dev/null || true 51 | 52 | # Poll for new event files and dump the output 53 | while :; do 54 | # Clean up old hexdumps and start new ones 55 | for event in `set | grep -o '^event[0-9]*'` /dev/input/event*; do 56 | # Check if the event file is already monitored 57 | eval "pid=\"\${${event##*/}:-0}\"" 58 | if [ "$pid" != 0 ]; then 59 | # Check if it's still running 60 | if kill -0 "$pid" 2>/dev/null; then 61 | continue 62 | fi 63 | wait "$pid" || true 64 | fi 65 | # Clean up old variables 66 | if [ "${event#/}" = "$event" ]; then 67 | unset "$event" 68 | else 69 | # Read in the event files and split into input_event fields 70 | stdbuf -oL hexdump -e "$HEXDUMP_FMT" "$event" & 71 | eval "${event##*/}='$!'" 72 | fi 73 | done 74 | # Avoid picking up the event variable 75 | unset event 76 | # Kill all event daemons 77 | pids="`set | sed -n 's/^event[0-9]*=.\(.*\).$/\1/p' | tr '\n' ' '`" 78 | settrap "kill $pids 2>/dev/null;" 79 | # Wait for next poll 80 | sleep "$EVENT_DEV_POLL" 81 | done | unbuffered_awk " 82 | function update() { 83 | c = lc || rc; s = ls || rs; a = la || ra 84 | if (!cmd && c && s && a && p) { 85 | cmd = \"p\" 86 | } else if (!cmd && c && s && a && n) { 87 | cmd = \"n\" 88 | } else if (cmd && !c && !s && !a && !p && !n) { 89 | system(\"/usr/local/bin/croutoncycle \" cmd) 90 | cmd = \"\" 91 | } 92 | } 93 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_LEFTCTRL { lc = $STATE; update() } 94 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_LEFTSHIFT { ls = $STATE; update() } 95 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_LEFTALT { la = $STATE; update() } 96 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_RIGHTCTRL { rc = $STATE; update() } 97 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_RIGHTSHIFT { rs = $STATE; update() } 98 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_RIGHTALT { ra = $STATE; update() } 99 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_F1 { p = $STATE; update() } 100 | $TYPE == $TYPE_EV_KEY && $KEY == $KEY_F2 { n = $STATE; update() } 101 | " 102 | -------------------------------------------------------------------------------- /chroot-bin/croutonurlhandler: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | NEWTABPAGE='chrome://newtab' 7 | USAGE="${0##*/} [-n] [URL] 8 | Open an URL in Chromium OS (requires crouton extension). 9 | If no URL is specified, opens $NEWTABPAGE instead. 10 | Switches back to Chromium OS unless -n is specified." 11 | 12 | . "`dirname "$0"`/../installer/functions" 13 | 14 | noswitch='' 15 | if [ "$1" = '-n' ]; then 16 | noswitch='y' 17 | shift 18 | fi 19 | 20 | if [ -z "$*" ]; then 21 | set -- "$NEWTABPAGE" 22 | elif [ "$1" = '-h' -o "$1" = '--help' ]; then 23 | error 0 "$USAGE" 24 | fi 25 | 26 | STATUS="`echo -n U"$*" | websocketcommand`" 27 | 28 | if [ "$STATUS" != 'UOK' ]; then 29 | error 1 "${STATUS#?}" 30 | fi 31 | 32 | if [ -z "$noswitch" ]; then 33 | croutoncycle cros 34 | fi 35 | -------------------------------------------------------------------------------- /chroot-bin/croutonversion: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | VERSION='unknown' 7 | RELEASE='unknown' 8 | ARCH='unknown' 9 | 10 | APPLICATION="${0##*/}" 11 | CHANGES='' 12 | DOWNLOAD='' 13 | UPDATES='' 14 | 15 | BRANCH="${VERSION##*~}" 16 | BRANCH="${BRANCH%%:*}" 17 | COMMIT="${VERSION##*:}" 18 | CHANGESURL="https://github.com/dnschneid/crouton/compare/$COMMIT..." 19 | INSTALLER="crouton-$BRANCH" 20 | INSTALLER="${INSTALLER%-master}" 21 | CROUTONURL="https://github.com/dnschneid/crouton/raw/releases/$INSTALLER" 22 | DEST="$HOME/Downloads/$INSTALLER" 23 | 24 | USAGE="$APPLICATION [options] 25 | 26 | Reports the version of crouton installed, checks if updates are available, 27 | and/or launches a changelog. 28 | 29 | If no options are specified, outputs crouton version information to STDOUT. 30 | 31 | Options: 32 | -a Prints the architecture of this chroot to stdout. 33 | -c Launches a browser to view the list of changes. 34 | If -u is specified, only launches if a newer version exists. 35 | -d Downloads the latest version of crouton to the location specified. 36 | If -u is specified, only downloads if the version is newer. 37 | -f FILE Changes the destination of the downloaded crouton. 38 | Default: $DEST 39 | -h Prints out usage. 40 | -r Prints the release of this chroot to stdout. 41 | -u Checks for updates, and prints out the updated version number." 42 | 43 | 44 | # Function to exit with exit code $1, spitting out message $@ to stderr 45 | error() { 46 | local ecode="$1" 47 | shift 48 | echo "$*" 1>&2 49 | exit "$ecode" 50 | } 51 | 52 | # Process arguments 53 | while getopts 'acdf:ru' f; do 54 | case "$f" in 55 | a) echo "$ARCH"; exit 0;; 56 | c) CHANGES='y';; 57 | d) DOWNLOAD='y';; 58 | f) DEST="$OPTARG";; 59 | r) echo "$RELEASE"; exit 0;; 60 | u) UPDATES='y';; 61 | \?) error 2 "$USAGE";; 62 | esac 63 | done 64 | 65 | # No extra parameters 66 | if [ "$#" != "$((OPTIND-1))" ]; then 67 | error 2 "$USAGE" 68 | fi 69 | 70 | # Print out version if nothing else specified 71 | if [ -z "$CHANGES$DOWNLOAD$UPDATES" ]; then 72 | echo "crouton: version $VERSION" 73 | echo "release: $RELEASE" 74 | echo "architecture: $ARCH" 75 | xmethodfile='/etc/crouton/xmethod' 76 | if [ -r "$xmethodfile" ]; then 77 | echo "xmethod: `cat "$xmethodfile"`" 78 | fi 79 | targetfile='/etc/crouton/targets' 80 | if [ -r "$targetfile" ]; then 81 | echo "targets: `sed 's/^,//' "$targetfile"`" 82 | fi 83 | hostrel='/var/host/lsb-release' 84 | if [ -r "$hostrel" ]; then 85 | host="`awk -F= '/_RELEASE_DESCRIPTION=/{print $2}' "$hostrel"`" 86 | fi 87 | echo "host: version ${host:-unknown}" 88 | echo "kernel: $(uname -a)" 89 | freon="yes" 90 | if [ -f /sys/class/tty/tty0/active ]; then 91 | freon="no" 92 | fi 93 | echo "freon: $freon" 94 | exit 0 95 | fi 96 | 97 | # Print out version to stderr for info 98 | echo "crouton: version $VERSION" 1>&2 99 | 100 | latest='' 101 | tmpdir='' 102 | if [ -n "$UPDATES$DOWNLOAD" ]; then 103 | tmpdir="`mktemp -d --tmpdir=/tmp crouton.XXX`" 104 | trap "rm -rf --one-file-system '$tmpdir'" INT HUP 0 105 | echo "Retrieving latest version of $INSTALLER" 1>&2 106 | if ! wget "$CROUTONURL" -O "$tmpdir/$INSTALLER" 2>"$tmpdir/log"; then 107 | cat "$tmpdir/log" 1>&2 108 | echo "Failed to retrieve latest version of $INSTALLER" 1>&2 109 | exit 1 110 | fi 111 | latest="`awk -F"'" '/^VERSION=/{print $2;exit}' "$tmpdir/$INSTALLER"`" 112 | fi 113 | 114 | # Print out latest version number if requested 115 | if [ -n "$UPDATES" ]; then 116 | echo "latest: version $latest" 117 | elif [ -n "$latest" ]; then 118 | echo "latest: version $latest" 1>&2 119 | fi 120 | 121 | # Save latest version if requested 122 | if [ -n "$DOWNLOAD" -a "$VERSION" != "$latest" ]; then 123 | echo "Saving latest version to $DEST" 1>&2 124 | mv -f "$tmpdir/$INSTALLER" "$DEST" 125 | fi 126 | 127 | # Launch changelog if requested 128 | if [ -n "$CHANGES" -a "$VERSION" != "$latest" ]; then 129 | # Check if changelogs are available from this version / to this branch 130 | if ! wget "$CHANGESURL$BRANCH" -O/dev/full 2>&1 | grep -q '404 Not Found'; then 131 | CHANGESURL="$CHANGESURL$BRANCH" 132 | elif ! wget "${CHANGESURL}master" -O/dev/full 2>&1 | grep -q '404 Not Found'; then 133 | CHANGESURL="${CHANGESURL}master" 134 | else 135 | # Fall back on the main commit log 136 | CHANGESURL='https://github.com/dnschneid/crouton/commits/' 137 | fi 138 | # One of these will probably work... 139 | for x in exo-open gnome-open kde-open xdg-open \ 140 | sensible-browser x-www-browser www-browser; do 141 | if hash "$x" 2>/dev/null; then 142 | browser="$x" 143 | break 144 | fi 145 | done 146 | if [ -z "$browser" ]; then 147 | error 2 "No browser found to view $CHANGESURL" 148 | fi 149 | # Launch the webpage 150 | if ! "$browser" "$CHANGESURL"; then 151 | error 1 "Failed to launch browser to view $CHANGESURL" 152 | fi 153 | fi 154 | 155 | exit 0 156 | -------------------------------------------------------------------------------- /chroot-bin/gnome-session-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | # 6 | # Provides a wrapper around gnome-session to allow gnome-session based 7 | # desktop environments to work with crouton nicely 8 | 9 | USAGE="${0##*/} [session] 10 | A wrapper around gnome-session that can be passed to xinit. 11 | Provide the session type in the DESKTOP_SESSION variable, 12 | or as an optional session argument. 13 | 14 | Examples: 15 | (launch GNOME from crosh with session in DESKTOP_SESSION) 16 | DESKTOP_SESSION=gnome xinit /etc/X11/xinit/xinitrc ${0##*/} 17 | 18 | (launch Unity from an xterm with session as an argument) 19 | ${0##*/} ubuntu" 20 | 21 | export DESKTOP_SESSION="${DESKTOP_SESSION:-"$1"}" 22 | export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:-"x11"}" 23 | export XDG_SESSION_CLASS="user" 24 | 25 | SESSION='gnome-session' 26 | CINNAMON_SESSION='cinnamon-session' 27 | 28 | if [ -z "$DESKTOP_SESSION" ]; then 29 | echo "$USAGE" 1>&2 30 | exit 2 31 | fi 32 | 33 | # Cinnamon 2.0 and later uses its own fork of gnome-session 34 | if [ "${DESKTOP_SESSION#cinnamon}" != "$DESKTOP_SESSION" ] && \ 35 | hash "$CINNAMON_SESSION" 2>/dev/null; then 36 | SESSION="$CINNAMON_SESSION" 37 | fi 38 | 39 | SESSION_FILE="/usr/share/$SESSION/sessions/$DESKTOP_SESSION.session" 40 | XDG_CURRENT_DESKTOP="$(awk -F "=" '/DesktopName/ {print $2}' "$SESSION_FILE")" 41 | if [ -n "$XDG_CURRENT_DESKTOP" ]; then 42 | XDG_SESSION_DESKTOP="$XDG_CURRENT_DESKTOP" 43 | export XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP 44 | fi 45 | 46 | if [ -z "$DISPLAY" ]; then 47 | CHROOTRELEASE="`croutonversion -r`" 48 | if [ "$CHROOTRELEASE" = "arch" -o "$CHROOTRELEASE" = "alarm" ]; then 49 | exec xinit "$0" 50 | else 51 | exec xinit /etc/X11/xinit/xinitrc "$0" 52 | fi 53 | else 54 | exec "$SESSION" --session="$DESKTOP_SESSION" 55 | fi 56 | -------------------------------------------------------------------------------- /chroot-bin/host-wayland: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Either runs the specified command with the environment set to use the host's 7 | # wayland server, or prints out the environment changes required. 8 | 9 | # If wayland-0 socket does not exit, no Chromium OS wayland server exist 10 | if [ ! -S "/var/run/chrome/wayland-0" ]; then 11 | err="No Chromium OS Wayland server is available." 12 | if [ "$#" = 0 ]; then 13 | echo "echo '$err' 1>&2" 14 | else 15 | echo "$err" 1>&2 16 | exit 1 17 | fi 18 | else 19 | export XDG_RUNTIME_DIR='/var/run/chrome' 20 | if [ "$#" = 0 ]; then 21 | echo "export XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR'" 22 | else 23 | exec "$@" 24 | fi 25 | fi 26 | -------------------------------------------------------------------------------- /chroot-bin/setres: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Changes the resolution of the current display. 7 | # If XMETHOD is xiwi, tries to create a new exact resolution, and change mode 8 | # to that. If that fails (e.g. non-patched xorg-dummy), take the closest, 9 | # smaller, available resolution in xrandr, and if no smaller resolution is 10 | # available, pick the closest one. 11 | # If XMETHOD is anything else, set a resolution from cvt output. 12 | # In all cases, outputs the applied resolution. 13 | 14 | set -e 15 | 16 | if [ "$#" -lt 2 -o "$#" -gt 4 ]; then 17 | echo "USAGE: ${0##*/} x y [r [output]]" 1>&2 18 | exit 2 19 | fi 20 | x="$1" 21 | y="$2" 22 | r="${3:-60}" 23 | o="${4}" 24 | if [ -z "$o" ]; then 25 | o="`xrandr -q | awk 'x{print $1;exit}/^Screen 0/{x=1}'`" 26 | fi 27 | 28 | xmethod="`xprop -root 'CROUTON_XMETHOD' | sed -n 's/^.*\"\(.*\)\"/\1/p'`" 29 | 30 | if [ "${xmethod%%-*}" != "xiwi" ]; then 31 | cvt "$x" "$y" "$r" | { 32 | read -r _ 33 | read -r _ mode data 34 | mode="${mode#\"}" 35 | mode="${mode%\"}" 36 | xrandr --newmode "$mode" $data 2>/dev/null || true 37 | xrandr --addmode "$o" "$mode" 38 | xrandr --output "$o" --mode "$mode" 39 | echo "$mode" 40 | } 41 | exit 0 42 | fi 43 | 44 | # Replace mode $2 in output $1, with new data $3..$# 45 | # Deletes the mode if $3 is not provided 46 | replacemode() { 47 | local o="$1" 48 | local mode="$2" 49 | shift 2 50 | xrandr --delmode "$o" "$mode" 2>/dev/null || true 51 | xrandr --rmmode "$mode" 2>/dev/null || true 52 | if [ "$#" -gt 0 ]; then 53 | xrandr --newmode "$mode" "$@" 54 | xrandr --addmode "$o" "$mode" 55 | fi 56 | } 57 | 58 | # Try to change to arbitrary resolution 59 | mhz="$((r*x*y/1000000))" 60 | name="kiwi_${x}x${y}_${r}" 61 | 62 | # Try to switch mode, if it already exists. 63 | if xrandr --output "$o" --mode "$name" 2>/dev/null; then 64 | echo "${x}x${y}_${r}" 65 | exit 0 66 | fi 67 | 68 | # Add the new mode 69 | xrandr --newmode "$name" $mhz $x $x $x $x $y $y $y $y 70 | xrandr --addmode "$o" "$name" 71 | 72 | # The next line fails on non-patched xorg-dummy 73 | if xrandr --output "$o" --mode "$name"; then 74 | # Success: remove old modes 75 | others="`xrandr | sed -n 's/^.*\(kiwi[0-9x_]*\)[^*]*$/\1/p'`" 76 | for othername in $others; do 77 | xrandr --delmode "$o" "$othername" 2>/dev/null || true 78 | xrandr --rmmode "$othername" 2>/dev/null || true 79 | done 80 | echo "${x}x${y}_${r}" 81 | exit 0 82 | else 83 | # Delete the new mode 84 | xrandr --delmode "$o" "$name" 2>/dev/null || true 85 | xrandr --rmmode "$name" 2>/dev/null || true 86 | fi 87 | 88 | # Probably xorg-dummy got overwritten. Recommend an update. 89 | echo "Failed to set custom resolution. Update your chroot and try again." 1>&2 90 | exit 1 91 | -------------------------------------------------------------------------------- /chroot-bin/startgnome: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Launches GNOME; automatically falls back to gnome-panel 7 | 8 | exec crouton-noroot gnome-session-wrapper gnome 9 | -------------------------------------------------------------------------------- /chroot-bin/startkde: -------------------------------------------------------------------------------- 1 | crouton-noroot -------------------------------------------------------------------------------- /chroot-bin/startlxde: -------------------------------------------------------------------------------- 1 | crouton-noroot -------------------------------------------------------------------------------- /chroot-bin/startunity: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Launches Unity; will fall back to Unity-2D on supported releases 7 | 8 | # Ensure global app menus work. 9 | export UBUNTU_MENUPROXY=1 10 | export GTK_MODULES="unity-gtk-module" 11 | 12 | exec crouton-noroot gnome-session-wrapper ubuntu 13 | -------------------------------------------------------------------------------- /chroot-bin/startxfce4: -------------------------------------------------------------------------------- 1 | crouton-noroot -------------------------------------------------------------------------------- /chroot-bin/xinit: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Adds a :# to the xinit command line, where # is the first available display 7 | # number. Also adds the -- to the command line and references the global 8 | # xserverrc if it isn't already there. By putting this in /usr/local/bin, PATH 9 | # will prefer it and scripts that call xinit will automagically work. 10 | 11 | xserverrc='/etc/X11/xinit/xserverrc' 12 | dash='--' 13 | for arg in "$@"; do 14 | if [ -z "$dash" ]; then 15 | # Check if there's a xserverrc specified. 16 | if [ "${arg#/}" != "$arg" ]; then 17 | xserverrc='' 18 | fi 19 | break 20 | elif [ "$arg" = '--' ]; then 21 | dash= 22 | fi 23 | done 24 | 25 | # Never use display :0 (confusing if aura does not use X11) 26 | disp=1 27 | while [ -f "/tmp/.X$disp-lock" ]; do 28 | disp=$((disp+1)) 29 | done 30 | 31 | # If possible, switch to VT1 to avoid strangeness when launching from VT2 32 | chvt 1 2>/dev/null || true 33 | 34 | exec /usr/bin/xinit /usr/local/bin/croutonxinitrc-wrapper "$@" $dash $xserverrc ":$disp" 35 | -------------------------------------------------------------------------------- /chroot-bin/xiwi: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Runs the specified X11 application in its own X server in Chromium OS. 7 | 8 | USAGE="Usage: ${0##*/} [-f] [-F|-T] APPLICATION [PARAMETERS ...] 9 | Launches a windowed session in Chromium OS for any graphical application. 10 | Applications launched in this way show in independent windows or tabs. 11 | All parameters are passed to the specified application. 12 | 13 | By default, the app is launched in a window. 14 | 15 | Options: 16 | -F Launch the APPLICATION full-screen. 17 | -T Launch the APPLICATION in a tab. 18 | -f Prevent ${0##*/} from quitting automatically. (see NOTE below) 19 | 20 | NOTE: 21 | ${0##*/} will normally close when the application returns. Some gui applications 22 | fork before or during normal operation, which can confuse ${0##*/} and cause it to 23 | quit prematurely. If your application does not have a parameter that prevents 24 | it from forking, and crouton is unable to automatically detect the fork, you can 25 | use -f to prevent ${0##*/} from quitting automatically. 26 | ${0##*/} will quit if you close the Chromium OS window when nothing is displayed. 27 | 28 | A default window manager will full-screen all windows, unless APPLICATION begins 29 | with 'start' or is 'xinit'. You can cycle through multiple windows inside the 30 | application via Ctrl-Alt-Tab/Ctrl-Alt-Shift-Tab, or close them via 31 | Ctrl-Alt-Shift-Escape. If APPLICATION begins with 'start' but you still want to 32 | use the default window manager, specify the full path of the application." 33 | 34 | . "`dirname "$0"`/../installer/functions" 35 | xiwicmd="`readlink -f -- "$0"`" 36 | OPTSTRING='FfTt' 37 | 38 | if [ "$#" = 0 ]; then 39 | error 2 "$USAGE" 40 | elif [ "$1" = '/' ]; then 41 | shift 1 42 | foreground='' 43 | while getopts "$OPTSTRING" f; do 44 | case "$f" in 45 | f) foreground='y';; 46 | t|T|F) :;; 47 | \?) error 2 "$USAGE";; 48 | esac 49 | done 50 | shift "$((OPTIND-1))" 51 | xsetroot -cursor_name left_ptr 52 | if [ "$1" != 'xinit' -a "${1#start}" = "$1" ]; then 53 | i3 -c "/etc/crouton/xiwi.conf" & 54 | # Wait for i3 to launch 55 | xprop -spy -root | grep -q _NET_ACTIVE_WINDOW 56 | # Launch the window title monitoring daemon 57 | # _NET_ACTIVE_WINDOW is more reliable than _NET_CLIENT_LIST_STACKING for 58 | # keeping track of the topmost window. 59 | xprop -spy -notype -root 0i ' $0\n' '_NET_ACTIVE_WINDOW' 2>/dev/null | { 60 | name="`cat /etc/crouton/name`" 61 | monpid='' 62 | monwid='' 63 | while read _ wid; do 64 | if [ "$wid" = "$monwid" ]; then 65 | continue 66 | fi 67 | if [ -n "$monpid" ]; then 68 | kill "$monpid" 2>/dev/null 69 | fi 70 | monwid="$wid" 71 | (xprop -spy -notype -id "$wid" 'WM_NAME' 2>/dev/null || echo) \ 72 | | while read _ title; do 73 | title="${title%\"}" 74 | xprop -root -f CROUTON_NAME 8s -set CROUTON_NAME \ 75 | "$name/$1${title:+": "}${title#*\"}" 76 | { 77 | echo -n 'C' 78 | croutoncycle l 79 | } | websocketcommand >/dev/null 80 | done & 81 | monpid="$!" 82 | done 83 | if [ -n "$monpid" ]; then 84 | kill "$monpid" 2>/dev/null 85 | fi 86 | } & 87 | # Launch user init scripts 88 | if [ -f "$HOME/.xiwirc" ]; then 89 | /bin/sh "$HOME/.xiwirc" || true 90 | fi 91 | fi 92 | starttime="$(date +%s)" 93 | "$@" 94 | endtime="$(date +%s)" 95 | if [ -n "$foreground" -o "$(($endtime-$starttime))" -le 2 ]; then 96 | xprop -spy -notype -root 0i ' $0\n' 'CROUTON_CONNECTED' \ 97 | | while read _ connected; do 98 | if [ "$connected" != 0 ]; then 99 | continue 100 | fi 101 | # _NET_CLIENT_LIST_STACKING is more reliable than 102 | # _NET_ACTIVE_WINDOW for detecting when no windows exist 103 | if ! xprop -notype -root '_NET_CLIENT_LIST_STACKING' \ 104 | | grep -q '0x'; then 105 | kill "$$" 106 | break 107 | fi 108 | done 109 | fi 110 | else 111 | export XMETHOD='xiwi-window' 112 | while getopts "$OPTSTRING" f; do 113 | case "$f" in 114 | f) :;; 115 | F) export XMETHOD='xiwi-fullscreen';; 116 | t|T) export XMETHOD='xiwi-tab';; 117 | \?) error 2 "$USAGE";; 118 | esac 119 | done 120 | eval "exe=\"\$$OPTIND\"" 121 | if ! hash "$exe" 2>/dev/null; then 122 | error 2 "${0##*/}: $exe: not found" 123 | fi 124 | exec /usr/local/bin/xinit "$xiwicmd" / "$@" 125 | fi 126 | -------------------------------------------------------------------------------- /chroot-etc/kodi-cycle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | # 6 | # Python script to call croutoncycle. This is needed to let the 7 | # hotkeys ctr-shift-alt F1/F2 work when kodi is in fullscreen. 8 | import subprocess 9 | import sys 10 | 11 | if len(sys.argv) == 2 and sys.argv[1] in ("prev", "next"): 12 | exitcode = subprocess.call(["/usr/local/bin/croutoncycle", sys.argv[1]]) 13 | else: 14 | sys.stderr.write("Usage: %s prev|next\n" % str(sys.argv[0])) 15 | exitcode = 2 16 | sys.exit(exitcode) 17 | -------------------------------------------------------------------------------- /chroot-etc/kodi-keyboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | RunScript(/etc/crouton/kodi-cycle.py,prev) 10 | RunScript(/etc/crouton/kodi-cycle.py,next) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chroot-etc/pulseaudio-default.pa: -------------------------------------------------------------------------------- 1 | #!/usr/bin/pulseaudio -nF 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Include default configuration first 7 | .include /etc/pulse/default.pa 8 | 9 | # Forward audio to Chromium OS audio server 10 | load-module module-alsa-sink device=cras sink_name=cras-sink 11 | load-module module-alsa-source device=cras source_name=cras-source 12 | set-default-sink cras-sink 13 | set-default-source cras-source 14 | -------------------------------------------------------------------------------- /chroot-etc/unity-autostart.desktop: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | [Desktop Entry] 6 | Type=Application 7 | Name=crouton autostart script for Unity 8 | Exec=/usr/local/bin/crouton-unity-autostart 9 | OnlyShowIn=Unity; 10 | NoDisplay=true 11 | X-GNOME-Autostart-Phase=Initialization 12 | X-GNOME-Autostart-Notify=true 13 | X-GNOME-AutoRestart=true 14 | -------------------------------------------------------------------------------- /chroot-etc/unity-profiled: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | # 6 | # Helper script for Unity called at user login. 7 | # Right now this just sets up .desktop files in the user's autostart 8 | # directory to override global autostart. 9 | 10 | RELEASE="`/usr/local/bin/croutonversion -r`" 11 | 12 | # unity-settings-daemon should run instead of gnome-settings-daemon in trusty 13 | if [ "$RELEASE" = 'trusty' -o "$RELEASE" = 'xenial' ]; then 14 | autostartdir="$HOME/.config/autostart" 15 | mkdir -p "$autostartdir" 16 | cat > "$autostartdir"/gnome-settings-daemon.desktop <&2 11 | exit 1 12 | fi 13 | fi 14 | 15 | xserverrc="/etc/crouton/xserverrc-${XMETHOD%%-*}" 16 | if [ "${XMETHOD##*/}" != "$XMETHOD" -o ! -f "$xserverrc" ]; then 17 | echo "Invalid X11 backend '$XMETHOD'" 1>&2 18 | exit 2 19 | fi 20 | 21 | . "$xserverrc" 22 | -------------------------------------------------------------------------------- /chroot-etc/xserverrc-local.example: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Sample script to customize X server invocation. To activate copy it to 7 | # /etc/crouton/xserverrc-local 8 | # 9 | # The file is sourced before invoking the X server with the variable 10 | # XMETHOD set to xiwi, or xorg and the variable XARGS containing the 11 | # command line arguments that will be passed to the server. 12 | # 13 | # Uncoment if fonts look too big on machines with 1366x768 11.6" screen 14 | #XARGS="$XARGS -dpi 135x135" 15 | -------------------------------------------------------------------------------- /chroot-etc/xserverrc-xiwi: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | logfile="/tmp/Xorg.crouton.$$.log" 7 | for arg in "$@"; do 8 | disp="`echo "$arg" | sed -n 's/^\:\([0-9]*\)$/\1/p'`" 9 | if [ -n "$disp" ]; then 10 | logfile="/tmp/Xorg.crouton.$disp.log" 11 | fi 12 | done 13 | 14 | if [ "${XMETHOD%%-*}" != 'xiwi' ]; then 15 | export XMETHOD='xiwi' 16 | fi 17 | XARGS="-nolisten tcp -config xorg-dummy.conf -logfile $logfile" 18 | if [ -f /etc/crouton/xserverrc-local ]; then 19 | . /etc/crouton/xserverrc-local 20 | fi 21 | 22 | # Find the Xorg executable (first 2 required by Arch, third by Debian/Ubuntu) 23 | XBINS="/usr/lib/xorg-server/Xorg /usr/bin/Xorg.bin /usr/bin/Xorg" 24 | XBIN="" 25 | for xbin in $XBINS; do 26 | if [ -x "$xbin" ] && ! [ -u "$xbin" -o -g "$xbin" ]; then 27 | XBIN="$xbin" 28 | break 29 | fi 30 | done 31 | 32 | if [ -z "$XBIN" ]; then 33 | echo "Cannot find non-setuid Xorg executable." 1>&2 34 | exit 1 35 | fi 36 | 37 | exec "$XBIN" $XARGS "$@" 38 | -------------------------------------------------------------------------------- /chroot-etc/xserverrc-xorg: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | if [ "${XMETHOD%%-*}" != 'xorg' ]; then 7 | export XMETHOD='xorg' 8 | fi 9 | XARGS='-nolisten tcp' 10 | if [ -f /etc/crouton/xserverrc-local ]; then 11 | . /etc/crouton/xserverrc-local 12 | fi 13 | 14 | X=/usr/bin/X 15 | 16 | # Handle Freon systems 17 | if [ ! -f "/sys/class/tty/tty0/active" ]; then 18 | # We won't be able to launch properly if running from frecon 19 | ppid="$$" 20 | while [ -n "$ppid" -a "$ppid" -ne 1 ]; do 21 | ppid="`ps -p "$ppid" -o 'ppid=' 2>/dev/null | sed 's/ //g'`" 22 | if ps -p "$ppid" -o 'comm=' | grep -q '^frecon$'; then 23 | echo 'Xorg X11 servers cannot be launched from Frecon.' 1>&2 24 | echo 'Return to Chromium OS and use crosh to launch X.' 1>&2 25 | exit 2 26 | fi 27 | done 28 | # Prepare lock file 29 | mkdir -p '/tmp/crouton-lock' 30 | touch '/tmp/crouton-lock/display' 31 | chmod -Rf g+rwX '/tmp/crouton-lock' 32 | chgrp -Rf crouton '/tmp/crouton-lock' 33 | # Freon necessitates the preload hack for X to coexist 34 | X=/usr/bin/Xorg 35 | logfile="/tmp/Xorg.crouton.$$.log" 36 | for arg in "$@"; do 37 | disp="`echo "$arg" | sed -n 's/^\:\([0-9]*\)$/\1/p'`" 38 | if [ -n "$disp" ]; then 39 | logfile="/tmp/Xorg.crouton.$disp.log" 40 | fi 41 | done 42 | XARGS="$XARGS -logfile $logfile" 43 | export LD_PRELOAD="/usr/local/lib/croutonfreon.so:$LD_PRELOAD" 44 | fi 45 | 46 | exec "$X" $XARGS "$@" 47 | -------------------------------------------------------------------------------- /host-bin/delete-chroot: -------------------------------------------------------------------------------- 1 | edit-chroot -------------------------------------------------------------------------------- /host-bin/startcli: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start a CLI session in a new VT. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | if [ -f /sbin/frecon ]; then 18 | # Until we get a stable interface to controlling frecon, just use the pty 19 | openvt='' 20 | else 21 | openvt='openvt -vws --' 22 | fi 23 | 24 | export TERM='linux' 25 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t cli-extra -l \ 26 | "$@" "" $openvt 27 | -------------------------------------------------------------------------------- /host-bin/starte17: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start an e17 session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t e17 "$@" "" \ 18 | exec xinit /usr/bin/enlightenment_start 19 | -------------------------------------------------------------------------------- /host-bin/startgnome: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start a GNOME session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t gnome "$@" "" \ 18 | exec startgnome 19 | -------------------------------------------------------------------------------- /host-bin/startkde: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start a KDE session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t kde "$@" "" \ 18 | exec xinit /usr/bin/startkde 19 | -------------------------------------------------------------------------------- /host-bin/startkodi: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start an KODI session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t kodi "$@" "" \ 18 | exec croutonpowerd -i xinit /usr/bin/kodi --standalone 19 | -------------------------------------------------------------------------------- /host-bin/startlxde: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start an LXDE session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t lxde "$@" "" \ 18 | exec xinit /usr/bin/startlxde 19 | -------------------------------------------------------------------------------- /host-bin/startunity: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start a Unity session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t unity "$@" "" \ 18 | exec startunity 19 | -------------------------------------------------------------------------------- /host-bin/startxfce4: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | 10 | USAGE="$APPLICATION [options] 11 | 12 | Wraps enter-chroot to start an Xfce session. 13 | By default, it will log into the primary user on the first chroot found. 14 | 15 | Options are directly passed to enter-chroot; run enter-chroot to list them." 16 | 17 | exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t xfce "$@" "" \ 18 | exec startxfce4 19 | -------------------------------------------------------------------------------- /host-bin/startxiwi: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Copyright (c) 2016 The crouton Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | set -e 7 | 8 | APPLICATION="${0##*/}" 9 | ENTERCHROOT="$(dirname "$(readlink -f -- "$0")")/enter-chroot" 10 | OPTS_ENTER='' 11 | OPTS_XIWI='' 12 | 13 | USAGE="$APPLICATION [options] chroot_app [parameters] 14 | 15 | Wraps enter-chroot to launch a window or tab in Chromium OS for any graphical application. 16 | Applications launched in this way show in independent windows or tabs. 17 | 18 | By default, it will use the primary user on the first xiwi-enabled chroot found and launch 19 | the chroot_app in a window. 20 | 21 | Options: 22 | $("$ENTERCHROOT" -h 2>&1 | grep -e ' -[bckntu]') 23 | -F Launch the chroot_app full-screen. 24 | -T Launch the chroot_app in a tab. 25 | -f Prevent xiwi from quitting automatically. (see NOTE below) 26 | 27 | NOTE: 28 | xiwi will normally close when the application returns. Some gui applications 29 | fork before or during normal operation, which can confuse xiwi and cause it to 30 | quit prematurely. If your application does not have a parameter that prevents 31 | it from forking, and crouton is unable to automatically detect the fork, you can 32 | use -f to prevent xiwi from quitting automatically. 33 | xiwi will quit if you close the Chromium OS window when nothing is displayed. 34 | 35 | You can cycle through multiple windows inside the application 36 | via Ctrl-Alt-Tab/Ctrl-Alt-Shift-Tab, or close them via Ctrl-Alt-Shift-Escape. 37 | If the chroot_app begins with 'start' but you still want to 38 | use the default window manager, specify the full path of the application. 39 | " 40 | 41 | while getopts 'bc:k:n:t:u:FTf' OPT; do 42 | case "$OPT" in 43 | b) OPTS_ENTER="$OPTS_ENTER -$OPT";; 44 | c|k|n|t|u) 45 | OPTARG="$(echo -n "$OPTARG" | sed -e "s/'/'\\\\\\''/g")" 46 | OPTS_ENTER="$OPTS_ENTER -$OPT '$OPTARG'";; 47 | f|F|T) OPTS_XIWI="$OPTS_XIWI -$OPT";; 48 | \?) echo "$USAGE" 1>&2 49 | exit 2;; 50 | esac 51 | done 52 | shift "$((OPTIND-1))" 53 | 54 | if [ "$#" = "0" ]; then 55 | echo "$USAGE" 1>&2 56 | exit 2 57 | fi 58 | 59 | eval "exec sh -e \"\$ENTERCHROOT\" -t xiwi $OPTS_ENTER \ 60 | exec xiwi $OPTS_XIWI \"\$@\"" 61 | 62 | -------------------------------------------------------------------------------- /host-ext/.gitignore: -------------------------------------------------------------------------------- 1 | crouton.crx 2 | crouton.zip 3 | crouton.pem 4 | crouton/kiwi.pexe 5 | -------------------------------------------------------------------------------- /host-ext/crouton/background.html: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |