Skip to content

Instantly share code, notes, and snippets.

@brutuscat
Forked from dz0ny/99java
Last active August 29, 2015 14:02
Show Gist options
  • Save brutuscat/42fe1284f3794fa33cdd to your computer and use it in GitHub Desktop.
Save brutuscat/42fe1284f3794fa33cdd to your computer and use it in GitHub Desktop.
## 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/
## 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
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment