Skip to content

Instantly share code, notes, and snippets.



Last active Dec 10, 2015
What would you like to do?
shell script to run arch linux on ChromeOS, based on
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
# Put your fun stuff here.
if uname -a | grep -q SAMSUNG ; then
echo "Booting into ChromeOS Linux"
sudo mount -i -o remount,exec /home/chronos/user/
echo "Welcome to Arch Linux: `uname -a`"
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# Function to assemble the Git parsingart of our prompt.
git_prompt ()
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
git_branch=$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p')
if git diff --quiet 2>/dev/null >&2; then
echo "[$git_color$git_branch${c_reset}]"
# Thy holy prompt.
PROMPT_COMMAND='PS1="${c_user}\u${c_reset}@${c_user}\h${c_reset}:${c_path}\w${c_reset}$(git_prompt)\$ "'
alias go="~/local-dev/scripts/go"
alias godev='cd ~/local-dev'
alias gonode='cd ~/local-dev/node-dev'
" An example for a vimrc file.
" Maintainer: Bram Moolenaar <>
" Last change: 2011 Apr 15
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
set backup " keep a backup file
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set backupdir=~/.vim/backups,.
set directory=~/.vim/backups,.
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
if uname -a | grep -q SAMSUNG ; then
echo "Changing Root to Arch Linux"
sudo cp /etc/resolv.conf /usr/local/arch/etc/resolv.conf
sudo mount -o bind /dev /usr/local/arch/dev
sudo mount -t devpts none /usr/local/arch/dev/pts
# link to the chronos home drive to get access to the Downloads folder
sudo mount -o bind /home/chronos/user /usr/local/arch/root
sudo mount -t proc proc /usr/local/arch/proc
sudo mount -t sysfs sys /usr/local/arch/sys
sudo chroot /usr/local/arch /bin/bash
sudo umount /usr/local/arch/dev/pts
sudo umount /usr/local/arch/dev
sudo umount /usr/local/arch/proc
sudo umount /usr/local/arch/sys
sudo umount /usr/local/arch/root
# don't change to arch linux if it's already running!
echo "You're already running `uname -a`"
exit 0

This comment has been minimized.

Copy link

@macton macton commented Jan 29, 2013

Variation on a theme: Here are my notes for a similar setup (except on external sdcard)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.