Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created July 7, 2012 10:23
Show Gist options
  • Star 48 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save dz0ny/3065781 to your computer and use it in GitHub Desktop.
Save dz0ny/3065781 to your computer and use it in GitHub Desktop.
Install java,flash,mp3,mp4 to Chromium OS
## Setup java
if [ `uname -m` == 'x86_64' ]; then
PATH="/usr/lib64/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib64/jvm/java-7-oracle/"
else
PATH="/usr/lib/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
fi

#Flash, java, mp3 and mp4 and pdf support for Chromium OS builds by hexxeh

This script downloads and installs libraries needed for Chromium, so that you can actually "TEST" multimedia experience.

##How to use?

Simply run as root user

curl -L http://goo.gl/qPrfd | bash

or if you prefer wget

wget -qO- http://goo.gl/qPrfd | bash

Then reboot computer!

##You don't know how to become root user?

CTRL+ALT+F2
$ chronos   (user)
$ facepunch (password)
$ sudo su

That's it, enjoy!

No sound?

Login as root

$ mount -o remount, rw /
$ alsaconf

Choose your sound card, then reboot!

Bugs

deb2tar.py was the hardest thing to do here, it should have a lot of bugs (probably) and might only work for this version.

#!/bin/bash
#based on https://wiki.archlinux.org/index.php/Chromium
if [ `uname -m` == 'x86_64' ]; then
# 64-bit
export CHROME="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
export TALK="https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb"
export JAVA="http://javadl.sun.com/webapps/download/AutoDL?BundleId=65687"
else
# 32-bit
export CHROME="https://dl-ssl.google.com/linux/direct/google-chrome-stable_current_i386.deb"
export TALK="https://dl.google.com/linux/direct/google-talkplugin_current_i386.deb"
export JAVA="http://javadl.sun.com/webapps/download/AutoDL?BundleId=65685"
fi
#clean stuff
mount -o remount, rw /
cd /opt/
rm "/opt/deb2tar.py"
curl -o "/opt/deb2tar.py" "https://raw.github.com/gist/3065781/deb2tar.py"
mkdir -p /usr/lib/mozilla/plugins/
#Flash, pdf
echo "Downloading Google Chrome"
curl -z "/opt/chrome-bin.deb" -o "/opt/chrome-bin.deb" -L $CHROME
python /opt/deb2tar.py /opt/chrome-bin.deb /opt/chrome.tar.lzma
rm -rf chrome-unstable
mkdir chrome-unstable
tar -xvf /opt/chrome.tar.lzma -C chrome-unstable
#mp3,mp4
cp /opt/chrome-unstable/opt/google/chrome/libffmpegsumo.so /usr/lib/cromo/ -f
cp /opt/chrome-unstable/opt/google/chrome/libffmpegsumo.so /opt/google/chrome/ -f
cp /opt/chrome-unstable/opt/google/chrome/libffmpegsumo.so /usr/lib/mozilla/plugins/ -f
#pdf
cp /opt/chrome-unstable/opt/google/chrome/libpdf.so /opt/google/chrome/ -f
#flash
cp /opt/chrome-unstable/opt/google/chrome/PepperFlash/libpepflashplayer.so /opt/google/chrome/pepper/ -f
cp /opt/chrome-unstable/opt/google/chrome/PepperFlash/manifest.json /opt/google/chrome/pepper/ -f
curl -L https://raw.github.com/gist/3065781/pepper-flash.info > /opt/google/chrome/pepper/pepper-flash.info
rm -rf chrome-unstable
rm /opt/chrome.tar.lzma
## Google Talk
echo "Downloading Google Talk plugin"
curl -z "/opt/talk-bin.deb" -o "/opt/talk-bin.deb" -L $TALK
python /opt/deb2tar.py /opt/talk-bin.deb /opt/talk.tar.gz
rm -rf /opt/google/talkplugin
tar -xvf /opt/talk.tar.gz -C /
rm /opt/google/chrome/pepper/libnpgoogletalk.so
ln -s /opt/google/talkplugin/libnpgoogletalk.so /opt/google/chrome/pepper/libnpgoogletalk.so
rm /opt/google/chrome/pepper/libnpgtpo3dautoplugin.so
ln -s /opt/google/talkplugin/libnpgtpo3dautoplugin.so /opt/google/chrome/pepper/libnpgtpo3dautoplugin.so
rm /opt/talk.tar.gz
## JAVA
## JAVA
echo "Downloading Oracle Java"
curl -z "/opt/java-bin.tar.gz" -o "/opt/java-bin.tar.gz" -L $JAVA
rm -rf /usr/lib/jvm/java-7-oracle/jre/
mkdir -p /usr/lib/jvm/java-7-oracle/jre/
tar -xvf /opt/java-bin.tar.gz -C /usr/lib/jvm/java-7-oracle/jre/ --strip-components 1
rm /usr/lib/cromo/libnpjp2.so
if [ `uname -m` == 'x86_64' ]; then
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so /usr/lib64/cromo/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so /usr/lib64/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so /opt/google/chrome/libnpjp2.so
else
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/i386/libnpjp2.so /usr/lib/cromo/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/i386/libnpjp2.so /usr/lib/libnpjp2.so
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/i386/libnpjp2.so /opt/google/chrome/libnpjp2.so
fi
curl -L https://raw.github.com/gist/3065781/99java > /etc/env.d/99java
env-update
restart ui
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
# deb2tar - convert a Debian Linux .deb file to a .tar
#
# First line -- file header: "!<arch>" or similar
# Multiple blocks -- each one, a header line followed by data
# Header line -- <filename> <num1> <num2> <num3> <mode> <len>
# Data -- <len> bytes of data
# We want the block called "data.tar.*"
"""
import shlex
import os
import sys
def copypart(
src,
dest,
start,
length,
bufsize=1024 * 1024,
):
"""
Binary copy
"""
in_file = open(src, 'rb')
in_file.seek(start)
out_file = open(dest, 'wb')
pointer = start
chunk = False
amount = bufsize
while pointer < length:
if length - pointer < amount:
amount = length - pointer
chunk = in_file.read(amount)
pointer += len(chunk)
out_file.write(chunk)
in_file.close()
out_file.close()
def main(file_open, file_write):
"""
Copy tar data block
"""
print 'Source file:', file_open
print 'Destination file:', file_write
zacetek = 0
konec = 0
file_name = ''
with open(file_open, 'r', 1024 * 1024) as in_file:
for (pointer, line) in enumerate(in_file):
zacetek += len(line)
if 'data.tar' in line:
meta = shlex.split(line[line.find('data.tar'):len(line)])
konec = int(meta[5])
file_name = str(meta[0])
break
statinfo = os.stat(file_open)
if statinfo.st_size - konec == zacetek:
copypart(file_open, file_write, int(zacetek), int(konec) + int(zacetek))
else:
print '----DEBUG----'
print 'start block', zacetek
print 'end block', konec
print 'end deb', statinfo.st_size
print 'diff', statinfo.st_size - konec
print 'Internal filename is ' + file_name
print 'meta', meta
print 'Failed parsing file! Internal meta mismatch, please report this to author!'
print '----DEBUG----'
if __name__ == '__main__':
try:
main(sys.argv[1], sys.argv[2])
except Exception, e:
print e
print 'Usage:', sys.argv[0], 'debian_file.deb', 'tar_file.tar.lzma or gz'
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Registration file for Pepper Flash player.
FILE_NAME=/opt/google/chrome/pepper/libpepflashplayer.so
PLUGIN_NAME="Shockwave Flash"
VERSION="11.3.31.318"
VISIBLE_VERSION="11.3 r31"
DESCRIPTION="$PLUGIN_NAME $VISIBLE_VERSION"
MIME_TYPES="application/x-shockwave-flash"
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib
import re
import shlex
import subprocess
from urlparse import parse_qs
import httplib
from urlparse import urlparse
import os
import time
debug = False
soup = BeautifulSoup(urllib.urlopen('http://chromeos.hexxeh.net/').read())
## {{{ http://code.activestate.com/recipes/541096/ (r1)
def confirm(prompt=None, resp=False):
"""prompts for yes or no response from the user. Returns True for yes and
False for no.
'resp' should be set to the default value assumed by the caller when
user simply types ENTER.
>>> confirm(prompt='Create Directory?', resp=True)
Create Directory? [y]|n:
True
>>> confirm(prompt='Create Directory?', resp=False)
Create Directory? [n]|y:
False
>>> confirm(prompt='Create Directory?', resp=False)
Create Directory? [n]|y: y
True
"""
if prompt is None:
prompt = 'Confirm'
if resp:
prompt = '%s [%s]|%s: ' % (prompt, 'y', 'n')
else:
prompt = '%s [%s]|%s: ' % (prompt, 'n', 'y')
while True:
ans = raw_input(prompt)
if not ans:
return resp
if ans not in ['y', 'Y', 'n', 'N']:
print 'please enter y or n.'
continue
if ans == 'y' or ans == 'Y':
return True
if ans == 'n' or ans == 'N':
return False
## end of http://code.activestate.com/recipes/541096/ }}}
def get_head(name, req):
url = urlparse(req)
conn = httplib.HTTPConnection(url.netloc)
conn.request('HEAD', url.path + '?' + url.query)
res = conn.getresponse()
return res.getheader(name)
def run(cmd, d=False, shell=False):
# print 'cwd', os.path.dirname(os.path.abspath(__file__))
print cmd
if not debug or d:
proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=False)
(curlstdout, curlstderr) = proc.communicate()
# print '|', curlstdout + curlstderr, '|'
return curlstdout + curlstderr
def find_croot():
disk = run('bash -c "ls /dev/disk/by-label/ -all | grep C-ROOT"', True).split('/')
print 'C-ROOT is :', disk[len(disk) - 1]
if confirm(prompt='Is this correct?', resp=True):
return disk[len(disk) - 1]
else:
return input('Enter correct disk? (sdd5)?')
def unzip(verzija):
run('unzip ' + verzija + '-chromeos.zip')
def kpartx(verzija):
# http://blog.vodkamelone.de/archives/137-Mounting-a-disk-image-containing-several-partitions.html
disk = find_croot()
run('kpartx -a -v ChromeOS-Vanilla-' + verzija + '.img')
time.sleep(5)
run('dd if=/dev/mapper/loop0p3 of=/dev/' + disk)
time.sleep(5)
run('fsck /dev/' + disk + ' -fy')
time.sleep(5)
# run('mount /dev/mapper/loop0p3 /mnt/ -o loop,ro')
# Time.sleep(5)
# run('bash -c "cd /mnt; tar cvf ' + loc + '/chromeos.tar opt/"')
# time.sleep(5)
# run('umount /mnt/')
# time.sleep(5)
run('kpartx -d -v ChromeOS-Vanilla-' + verzija + '.img')
def curl(zip_image, verzija):
run('curl -C - -z ' + verzija + '-chromeos.zip -L ' + zip_image + ' -o ' + verzija
+ '-chromeos.zip')
def get_version(lin):
url = parse_qs(lin['href'])
return str(url['build'][0])
def main():
# http://chromeos.hexxeh.net/download.php?track=vanilla&build=2556.0.2012_07_07_1636-rccf8f959&type=usb
linki = soup.find_all(href=re.compile('track=vanilla.+type=usb'))
i = 1
for lin in linki:
print '(', i, ')', get_version(lin)
i += 1
# break
verzija = get_version(linki[int(input('Choose version to download?')) - 1])
zip_image = get_head('location', 'http://chromeos.hexxeh.net/download.php?track=vanilla&build='
+ verzija + '&type=usb')
size = int(get_head('content-length', zip_image))
try:
size_local = int(os.stat(verzija + '-chromeos.zip').st_size)
except Exception:
size_local = 0
print 'size', size
print 'size local', size_local
if size != size_local:
curl(zip_image, verzija)
unzip(verzija)
kpartx(verzija)
# http://distribution.hexxeh.net/archive/vanilla/2591.0.2012_07_13_1633-rd712ae90/ChromeOS-Vanilla-2591.0.2012_07_13_1633-rd712ae90.zip
if __name__ == '__main__':
main()
@dz0ny
Copy link
Author

dz0ny commented Aug 28, 2012

@MiguelAO1029 audio support has been disabled at compile time, currently there is no way to enable it. Flash works and as many sites use Flash as fallback for MP3,MP4 it will work just fine.

@MiguelAO1029
Copy link

Ok Also I tried talk and still nothing. Someone told me there's an extension I need to get and I don't know what it is.

@rikels
Copy link

rikels commented Nov 5, 2012

i tried running this script on the latest Vanilla build (31-10-2012) but sadly enough it didn't work. am i doing something wrong myself (ID-10t error)? or is it something with the paths, or anything change?

@rikels
Copy link

rikels commented Nov 5, 2012

seems that deb2tar.py isn't working, or the chrome-bin.deb is corrupt. when i execute the command: "python /opt/deb2tar.py /opt/chrome-bin.deb /opt/chrome.tar.lzma" it gives this output:
"source file: /opt/chrome-bin.deb
destination file: /opt/chrome.tar.lzma
---DEBUG---
start block 33002661
end block 33008770
diff 6109
internal filename is data.tar.lzma
meta ['data.tar.lzma' , '13498855520' , '0' , '0' , '100644' , '33002661' , '`']
failed parsing file! internal meta mismatch, please report this to author!
---DEBUG---

i tried re-downloading chrome-bin.deb, but that didn't help either.

@quiro91
Copy link

quiro91 commented Nov 21, 2012

does this script work in last days build? I tryed to use alsaconf but the command wasn't found

@rikels
Copy link

rikels commented Nov 26, 2012

for me the script didn't work because it uses python, which doesn't seem to be in Chromium OS. you can try if my script works, with all credits towards Dz0ny.

but Alsaconf should be working since it has nothing to do with this script. alsaconf is a "program" to configure your soundcard. are you running it as super user? (sudo alsaconf). are you running it in the therminal (not the alt+ctrl+t, but alt+ctrl+F2)

@rikels
Copy link

rikels commented Dec 17, 2012

on the new builds your script is working again, python is back in the new hexxeh builds. but Alsaconf is removed from it.

@pietpietpiet
Copy link

I ran the script on this page http://chromeos-cr48.blogspot.in/2012/10/how-to-run-chrome-os-not-chromium-os-on.html after installing chromium. The script overwrites chromium with a genuine chrome image and on my samsung n210 everything worked out of the box including google voice/video. The only omission is ctrl alt F2 which probably means that is not running in developer mode.

@alexenochs
Copy link

ive got a problem with this... flash player says something along the lines of "couldnt load plugin" after doing the sudo su curl for the hexxeh builds i tried redoing it plenty of times please help me- Edit scratch that if anyone else has this problem just remove chromium os from ur hdd/sdd reinstall it and restart this script THANKS!

@gizmotronic
Copy link

There's an issue with deb2tar.py extracting chrome-bin.deb (and hence the Flash plugin).

Source file: /opt/chrome-bin.deb
Destination file: /opt/chrome.tar.lzma
----DEBUG----
start block 6124
end block 37674757
end deb 37680882
diff 6125
Internal filename is data.tar.lzma
meta ['data.tar.lzma', '1361412583', '0', '0', '100644', '37674757', '`']
Failed parsing file! Internal meta mismatch, please report this to author!
----DEBUG----

@TimothyGu
Copy link

In br3ker.sh, the chrome-unstable should really be chrome-stable.

@mccraveiro
Copy link

Not working on arnoldthebat 64bit build. Any solutions?

@mccraveiro
Copy link

I managed to convert the deb file using this site: http://www.online-convert.com/

@Chopsta
Copy link

Chopsta commented Jun 20, 2013

nice

@perler
Copy link

perler commented Jul 15, 2013

should this provide a java plugin to chrome? this http://www.java.com/en/download/testjava.jsp does't seem to work..

@perler
Copy link

perler commented Jul 28, 2013

and this stoped working at least with chromium 30 dev channel. all sorts of plugins are crashing after the installation, including crosh..

@shagr4th
Copy link

shagr4th commented Aug 7, 2013

I hacked around to fix the deb2tar issue and updated the script to merge all files into a single one, getting plugins from the unstable branch : https://gist.github.com/shagr4th/6178203

flash, pdf and nativeclient are working fine on virtualbox and the latest arnold build...

Next steps would be to test and update the google talk plugin part, if necessary, and find out why the mp3 plugin is not working

@Maarten86
Copy link

Thanks shagr4th! That one is working!

@kawanoryu
Copy link

Hello.
youtube was able to see safely, thanks to you.
Although I am a Japanese, in seeing the animation of the site of TED with a Japanese subtitle, I think that he would like to install 10.3 of flashplayer of a previous version.
I am glad if you develop the patch into which both of old and new flashplayer(s) are put.
since I am creating this text by the automatic translation function -- the case of strange English -- I am sorry!

@precoders
Copy link

Getting error. curl failed writing body...

Without bash, able to download everything..however, flash and other stuff not working...

@jimasun
Copy link

jimasun commented Jan 5, 2014

i get an error on line 1: syntax error near unexpected token "newline"
bash: line 1: ''

curl: (23) failed writing body (0!=7338)

any suggestions?

@ultrajack
Copy link

http://goo.gl/qPrfd had purnished. 404 not found...

@shoeper
Copy link

shoeper commented Apr 4, 2014

fixed broken links and used deb2tar from shagr4th

just run
curl -L https://gist.githubusercontent.com/shoeper/aa6fbd118282669bbab7/raw/br3ker.sh | bash > log.txt OR
curl -L https://gist.githubusercontent.com/shoeper/aa6fbd118282669bbab7/raw/data.sh | bash > log.txt

@derixithy
Copy link

I'm using the latest arnoldthebat image.
When using this scripts i get several directory error's.
For example "/opt/google/chrome/pepper/", the pepper directory does not exists on my build.

I noticed when I copied the files manually that the system does not create the pepper directory but that the copied files get's the name pepper. The system becomes unusable after this.

So maybe it's better to try to create all dirs in advance like the mozilla plugin dir.

Same happens with /usr/lib/chromo

@derixithy
Copy link

Copy link

ghost commented May 13, 2014

For x64 Arnoldthebat builds, you can use my script : https://github.com/MrVaykadji/misc/tree/master/ChromiumOS/mp3-flash-pdf

Works perfectly on Camd64 from 12 may 2014.

@shoeper
Copy link

shoeper commented Aug 9, 2014

@Oskar2cool
Copy link

Do i really have to write all that? Or is there a way to copy/paste?
Thanks

@robertoandrade
Copy link

Now that Chrome has dropped support for NPAPI, do you guys know of an alternative to get Java plugins working on Chrome? I was able to install Crouton and have the icedtea plugin installed and running from my chroot's copy of Chrome but not the one running from the Chrome OS. Would appreciate any tips in making that work on the main installation of Chrome also.

@giliammc
Copy link

giliammc commented Feb 4, 2015

how do i remove it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment