Removed androidphones and added pkgchecker which is broken...

This commit is contained in:
Mike Staszel 2010-07-17 21:01:46 -07:00
parent 0d8c3bceb1
commit 509f4c22fd
8 changed files with 221 additions and 178 deletions

View file

@ -1,23 +0,0 @@
This directory is to develop a way to boot Plugbox
on Android phones (HTC for now?).
==== On the Phone ====
- Any ROM, rooted
- A big SD card - Plugbox needs at least 300MB to work nicely
- Terminal Emulator from the Android Market
- "adb" from the Android SDK base package
- USB debugging mode enabled in Settings
==== Preparing an image ====
You'll need to make an ext2 image file (for now).
Download Plugbox as a .tar.gz file,
use dd if=/dev/zero of=plugbox.img count=10000000
then mkfs.ext2 plugbox.img (answer yes to force it),
mount -o loop plugbox.img ./plugboxmountfolder
then extract the rootfs into there, without a kernel or anything.
Unmount the image, put it in the ./plugbox folder found here,
and then copy that entire folder to /sdcard/ on your phone,
so it looks like /sdcard/plugbox/plugbox.img, etc.
More soon.

View file

@ -1,34 +0,0 @@
echo "Preparing Plugbox Linux..."
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/plugbox
export bin=/system/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop2 b 7 0
mount -o loop,noatime -t ext2 $kit/plugbox.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo ""
echo "Brought to you by NexusOneHacks.net and PlugApps."
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo ""
echo "Cleaning up..."
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
#losetup -d /dev/loop2

View file

@ -1,4 +0,0 @@
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"

View file

@ -1,47 +0,0 @@
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email admin@androidfanatic.com
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Android Filesytem remounted as read/write"
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: admin@androidfanatic.com"
echo " "
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash

View file

@ -1,50 +0,0 @@
# This script is taken from NexusOneHacks.net and modified for
# Plugbox Linux
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootplugbox
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootplugbox
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootplugbox /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/plugbox
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Plugbox Chroot Bootloader v0.1"
echo "Plugbox Bootloader is now installed!"
echo "This process does NOT damage Android!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo "Modified for Plugbox Linux by PlugApps.com"
echo " "
echo "To enter Plugbox Linux console just type 'bootplugbox'"

View file

@ -1,20 +0,0 @@
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts

214
scripts/pkgchecker/pkgchecker Executable file
View file

@ -0,0 +1,214 @@
#!/usr/bin/env python
# coding= UTF-8
#
# Created by Mika 'ighea' Hynnä <ighea[at]iki[dot]fi>
# Set the ABS and GIT directories here:
git_dir="/media/Plugbox/builder/plugapps/"
abs_dir="/media/Plugbox/builder/abs/"
import os
import sys
import distutils
from distutils import version
import subprocess
import time
abs_updater_version="2010.04.28"
class UpdateCheck:
def __init__(self, git_dir="/media/Plugbox/builder/plugapps/",abs_dir="/media/Plugbox/builder/abs/"):
self.abs_dir=abs_dir
self.git_dir=git_dir
return
def is_greater(self, ver1, ver2):
# Checks if ver2 is greater than ver1
v1,r1 = ver1.split("-")
v2,r2 = ver2.split("-")
if (v1 == v2 and int(r1) < int(r2)):
return True
v1 = v1.split(".")
v2 = v2.split(".")
for i in range(0, len(v2)):
if (int(v1[i]) == int(v2[i])):
#print v1[i], "==", v2[i]
continue
else:
if (int(v1[i]) < int(v2[i])):
#print v1[i], "<", v2[i]
return True
else:
#print v1[i], ">=", v2[i]
return False
return False
def get_local_database_items(self):
repopackages = []
# Fetch available packages
pipe = os.popen("pacman -Sl", "r")
for line in pipe:
data = line.replace(os.linesep,"")
repo, name, version = data.split(" ")
repopackages.append((repo,name,version))
pipe.close()
return repopackages
def pretify_pkgbuild_line(self, line):
charp=line.find('#')
if charp != -1:
line = line[:charp].strip()
line = line.replace(' ', '').replace(os.linesep,'')
return line
def get_version(self, pkgbuild, verbose=False):
# Returns the PKGBUILD's version string (pkgver-pkgrel)
version = "0"
p = subprocess.Popen("source "+pkgbuild+"; echo -n version:$pkgver-$pkgrel", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
datain, err = p.communicate()
if (len(datain) > 0):
vstart = datain.find("version:")
if (vstart != -1):
version = datain[vstart+len("version:"):]
if (verbose and err != None and len(err.strip()) > 0):
print "ERR:", err
return version
def check_package(self, repo, name, version,verbose=False):
pkgbuild_path = self.abs_dir+os.path.sep+repo+os.path.sep+name+os.path.sep+"PKGBUILD"
pkgbuild_git_path = self.git_dir+os.path.sep+repo+os.path.sep+name+os.path.sep+"PKGBUILD"
# First check git path
if os.path.exists(pkgbuild_git_path):
git_version = self.get_version(pkgbuild_path)
current = distutils.version.LooseVersion(version)
gitver = distutils.version.LooseVersion(git_version)
if (current < gitver):
return git_version
# If pkgbuild was not found or it was not newer than current pacman database item
# check the ABS database for item
if os.path.exists(pkgbuild_path):
abs_version = self.get_version(pkgbuild_path)
current = distutils.version.LooseVersion(version)
absver = distutils.version.LooseVersion(abs_version)
if (current < absver):
return abs_version
elif(verbose):
print "Couldn't find ABS entry for package: "+repo+"/"+name+""
return None
def get_updates(self, verbose=False):
# Returns array of tuples (repo, name, current_version, new_version)
updates=[]
newversion=""
# Go through all local database packages and check if there's a newer package in abs (abs_dir)
for repo, name, version in self.get_local_database_items():
newversion = self.check_package(repo, name, version, verbose)
if (newversion != None):
if (verbose):
print repo+"/"+name, "current:", version, "version in abs:", newversion
updates.append((repo,name,version,newversion))
return updates
def updates(self, verbose=False, outputfile=None, replaceoutputfile=False):
updates = self.get_updates(verbose)
if (len(updates) > 0):
print "Package\tCurrent\t-\tNew"
for repo, name, current, new in updates:
print repo+"/"+name+" "+current+" --> "+new
if (outputfile != None):
data = ""
olddata=""
if (replaceoutputfile == False):
if (os.path.exists(outputfile)):
try:
FILE = open(outputfile, "r")
olddata = FILE.read()
FILE.close()
except:
print "Error while opening outputfile: "+outputfile
data = "<p><table id=\"checker_table\">\n"
data += "<caption>Checked on "+time.ctime(time.time())+"</caption>\n"
data += "<tr>"
data += "<th class=\"checker_header\">Package</th>"
data += "<th class=\"checker_header\">Current</th>"
data += "<th class=\"checker_header\">Available</th>"
data += "</tr>\n"
for repo, name, current, new in updates:
data += "<tr>"
data += "<td class=\"checker_repository\">"+repo+"/"+name+"</td>"
data += "<td class=\"checker_current\">"+current+"</td>"
data += "<td class=\"checker_new\">"+new+"</td>"
data += "</tr>\n"
data += "</table></p>\n"
try:
FILE = open(outputfile, "w")
FILE.write(data)
FILE.write(olddata)
FILE.close()
except:
print "ERROR: Couldn't write to outputfile: "+outputfile
else:
print "Everything is up-to-date!"
return
if __name__ == "__main__":
verbose = False
outputfile = None
replaceoutputfile = False
if (len(sys.argv) <= 1):
print "ABSChecker v"+abs_updater_version
print ""
print "Checks packages in current pacman repository database against PKGBUILDs in local ABS database and returns list of out-of-date packages."
print ""
print " Usage: abschecker command [-v] [outputfile]"
print " commands:"
print " check\t\t check for updates"
print " flags:"
print " -v\t\t very verbose mode"
print " -r\t\t do not append to outputfile, replace instead"
print ""
print " If 'outputfile' is specified abschecker will dump a html output in it."
print ""
else:
if (sys.argv[1] == "check"):
counter=0
for arg in sys.argv:
counter+=1
if (arg.startswith("-")):
if (arg == "-v"):
verbose = True
print "Verbose mode ON"
elif (arg == "-r"):
replaceoutputfile = True
print "Output file set to be replaced if specified"
elif (counter > 2):
if (len(sys.argv) >= 3 and len(sys.argv[2]) > 0):
outputfile = arg
print "Output to: "+outputfile
uc = UpdateCheck(git_dir, abs_dir)
uc.updates(verbose, outputfile, replaceoutputfile)
else:
print "Invalid command!"

View file

@ -0,0 +1,7 @@
body {color:black;}
#checker_table {border:1px solid black}
.checker_header {border: 1px solid black;text:bold;text-align:left}
.checker_repository {border: 1px solid black;text:italic}
.checker_current {border: 1px solid black;color:black}
.checker_new {border: 1px solid
black;color:black;background-color:F5A9A9}