public
Last active

Install java,flash,mp3,mp4 to Chromium OS

  • Download Gist
99java
1 2 3 4 5 6 7 8 9
## 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
br3ker.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#!/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
deb2tar.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
#!/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'
pepper-flash.info
1 2 3 4 5 6 7 8 9 10 11 12
# 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"
readme.md
Markdown

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.

update.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
#!/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()

@riadle No, no automatic updates.

After becoming root, when i type the command line, I get stuck on a 'bash: cur1: command not found'.

Any suggestions on that?

@Malify Its curl(L) not cur1

@vik21 Script is robust, unless builds do something radically with system paths it will work. As for Gtalk I haven't tested it, but it seems it's loaded.

@jcn115 what version and build are you using. Seems like broken build...

Tried this and MP3 won't work.

@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.

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.

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?

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.

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

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)

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

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.

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!

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----

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

Not working on arnoldthebat 64bit build. Any solutions?

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

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

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

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

Thanks shagr4th! That one is working!

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!

Getting error. curl failed writing body...

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

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?

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

fixed broken links and used deb2tar from shagr4th

just run
curl -L http://mno.pw/r/1 | bash > log.txt OR
curl -L http://mno.pw/r/2 | bash > log.txt

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.