Skip to content

Instantly share code, notes, and snippets.

@illucent
Forked from dz0ny/99java
Created February 20, 2014 21:31
Show Gist options
  • Save illucent/9123633 to your computer and use it in GitHub Desktop.
Save illucent/9123633 to your computer and use it in GitHub Desktop.

#Flash, mp3 and mp4, pdf support for Chrome OS build by hexxeh

This script downloads and installs libraries needed for Chromium. So that you actually "TEST" media experience and then even buy that "chromebox".

##How to use?

Simply run as root user

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

##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
#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"
#Flash, pdf
if [ ! -f /opt/chrome-bin.deb ]
then
curl -o "/opt/chrome-bin.deb" "https://dl-ssl.google.com/linux/direct/google-chrome-unstable_current_i386.deb"
fi
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
#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
rm -rf chrome-unstable
rm /opt/chrome.tar.lzma
## Google Talk
if [ ! -f /opt/talk-bin.deb ]
then
curl -o "/opt/talk-bin.deb" "https://dl.google.com/linux/direct/google-talkplugin_current_i386.deb"
fi
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/talk.tar.gz
#!/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 line.find('data.tar') > -1:
konec = int(shlex.split(line)[5])
file_name = unicode(shlex.split(line)[0])
break
statinfo = os.stat(file_open)
print 'start block', zacetek
print 'end block', konec
print 'end deb', statinfo.st_size
print 'diff', statinfo.st_size - konec
if konec < 100:
konec = statinfo.st_size-1
if zacetek and konec:
print 'Filename is ' + file_name
copypart(file_open, file_write, int(zacetek), int(konec) + int(zacetek))
else:
print 'Failed parsing file!'
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment