Skip to content

Commit

Permalink
implement Clean, Build ROM Kits, System resize and parameter management
Browse files Browse the repository at this point in the history
  • Loading branch information
900supersport committed Nov 11, 2013
1 parent 9bd598f commit 02690fa
Show file tree
Hide file tree
Showing 10 changed files with 550 additions and 169 deletions.
18 changes: 16 additions & 2 deletions FreakTabKitchen.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#python imports
import sys
import logging
import os

#900supersport imports
import KitchenConfig
import rominfo

from kitchen_utils import pprint
from utils import CheckMakeFolders, GetCWD, logerror
from rkmainmenu import rkmainmenu

Expand All @@ -45,6 +47,12 @@ def StartKitchen():
The actual Kitchen Config and if present the rominfo in the current workspace will be read, required folders as per config will be created, and then the rkmainmenu will be displayed.
'''

if GetCWD() =='/home/brian/rkKitchen':
os.chdir('/home/brian/Desktop/ROMS/cube/u30gt2/2.06_official')
print GetCWD


logmode = logging.INFO
writemode = 'a'
filename = 'kitchen.log'
Expand Down Expand Up @@ -77,13 +85,19 @@ def StartKitchen():

CheckMakeFolders(kc.KitchenFolders())


rkmainmenu()
kc.Pickle()
ri.Pickle()
except Exception as e:
logerror('FreakTabKitchen::StartKitchen ',e,1)
finally:
print 'Thankyou for using 900supersport''s FreakTab RK Kitchen'

pprint ('=')
pprint ('Thank you for using 900supersport''s FreakTab RK Kitchen')
pprint ('')
pprint ('For support or even just to say thanks see')
pprint ('=')
pprint ('http://www.freaktab.com/showthread.php?8042-FreakTab-RK-ROM-Kitchen-by-900supersport-v2')
print
StartKitchen()

14 changes: 12 additions & 2 deletions KitchenConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class KitchenConfig:
maxsystemsize = 0
minsystemsize = 0
defaultsystemsize = 576716800
defaultuserdataG = 4

def __init__(self):
'''initialise Kithchen Config
Expand Down Expand Up @@ -81,14 +82,17 @@ def __init__(self):
KitchenConfig.maxsystemsize = reader.maxsystemsize
KitchenConfig.minsystemsize = reader.minsystemsize
KitchenConfig.defaultsystemsize = reader.defaultsystemsize
KitchenConfig.defaultuserdataG = reader.defaultuserdataG


#copy values into self for pickle useage
self.editor = KitchenConfig.editor
self.browser = KitchenConfig.browser
self.pwidth = KitchenConfig.pwidth
self.maxsystemsize = KitchenConfig.maxsystemsize
self.minsystemsize = KitchenConfig.minsystemsize
self.defaultsystemsize = KitchenConfig.defaultsystemsize
self.defaultsystemsize = KitchenConfig.defaultsystemsize
self.defaultuserdataG = KitchenConfig.defaultuserdataG

except Exception as e:
logging.error('KitchenConfig::__init__ ' )
Expand All @@ -111,7 +115,13 @@ def KitchenFolders():
,'read'
]
return folders


@staticmethod
def parametersizes():
'''List of parameter sizes
'''
return [2,4,6,8]


@staticmethod
def ROMInfoLoc():
Expand Down
10 changes: 5 additions & 5 deletions deployfiles/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ then

if [ -e /system/preinstall/recovery.img ]
then
if [ ! -e /mnt/external_sd/autoinstall/noflashrecovery ]
flash_image recovery /system/preinstall/recovery.img
mount -o rw,remount /dev/block/mtdblock8 /system
mv /system/preinstall/recovery.img /system/preinstall/recovery.done

flash_image recovery /system/preinstall/recovery.img
mount -o rw,remount /dev/block/mtdblock8 /system
mv /system/preinstall/recovery.img /system/preinstall/recovery.done

mount -o ro,remount /dev/block/mtdblock8 /system
mount -o ro,remount /dev/block/mtdblock8 /system
fi
fi
exit
1 change: 1 addition & 0 deletions kitchenUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def header():
pprint( 'FreakTab RK ROM Kitchen by 900supersport v2.0.0')
pprint( 'Brian Mahoney')
pprint( '19 Oct 2013')
pprint( 'www.freaktab.com')
pprint( '=')
pprint( 'Current ROM ' + rominfo.rominfo.romname)
pprint( 'CWD ' + KitchenConfig.KitchenConfig.cwd)
Expand Down
95 changes: 68 additions & 27 deletions kitchen_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import glob
import time
import struct
import zipfile

#900supersport imports
import KitchenConfig
Expand Down Expand Up @@ -104,43 +105,85 @@ def custom_deploy(deploypath):
deployfiles(dfile,deploypath,1)
except Exception as e:
logerror('kitchen_utils::custom_deploy ',e,1)

def movefiles(movefilename):
'''move files
sample
G, Superuser.apk, app/, 644
'''


def copyfilesworker(movefilename,sourceroot,asroot):
mvcpfilesworker(movefilename,sourceroot,'cp',asroot)


def movefilesworker(movefilename,sourceroot,asroot = 1 ):
mvcpfilesworker(movefilename,sourceroot,'mv',asroot)

def mvcpfilesworker(movefilename,sourceroot,op,asroot):
try:
serr=''
sourceroot = 'working/mntsystem/'
path = os.path.expanduser(movefilename)

with open(path,'r') as f:
for line in f:
cl = line.strip();
# print cl
if cl[:1] <> '#' and len(cl) > 0:
args = cl.split(',')

source = os.path.join(sourceroot, args[0].strip())
dest = os.path.join(sourceroot, args[1].strip())
if len(args) > 2:
destpath = args[2].strip()
else:
destpath = ''

pth,fn =os.path.split(source)

fn= os.path.join(destpath,fn)
logging.debug('kitchen_utils::mvcpfilesworker source' + source)
logging.debug('kitchen_utils::mvcpfilesworker dest' + dest)
iszip = 0
lendest = len(dest)
if lendest > 3:
if dest[lendest-3:] == 'zip':
iszip = 1
logging.debug('kitchen_utils::mvcpfilesworker iszip' + str(iszip))
try:
if os.path.exists(os.path.join(sourceroot, args[0].strip())):
dest = os.path.join(sourceroot, args[1].strip())
CheckMakeFoldersRoot([dest])

moves = 'sudo mv ' + os.path.join(sourceroot, args[0].strip()) + ' ' + dest

logging.debug('moves :' + moves)
os.system(moves)
if os.path.exists(source):
if iszip == 1:
logging.debug('kitchen_utils::mvcpfilesworker ' + dest)
zf = zipfile.ZipFile(dest,mode='a')
#zf.printdir()
zf.write(source,fn)
zf.close()
else:
logging.info('kitchen_utils::mvcpfilesworker ')
logging.info([dest])
CheckMakeFoldersRoot([dest])
moves = op + ' ' + source + ' ' + dest
if asroot==1:
moves = 'sudo ' + moves
logging.debug('kitchen_utils::mvcpfilesworker moves :' + moves)
os.system(moves)
else:
logging.debug('kitchen_utils::mvcpfilesworker source does not exist Source= ' + source)
except IOError as e:
logerror(e)
logerror('kitchen_utils::mvcpfilesworker inner ',e,1)
serr = serr + 'could not move ' + sourceroot.strip() + args[0].strip() + '\n'

if serr <> '':
print serr
choice=raw_input('Press enter to continue')

except Exception as e:
logerror('kitchen_utils::mvcpfilesworker ',e,1)



def movefiles(movefilename):
'''move files
sample
G, Superuser.apk, app/, 644
'''

try:
movefilesworker(movefilename, 'working/mntsystem/')
path = os.path.expanduser(movefilename)

except Exception as e:
logerror('kitchen_utils::movefiles ',e,1)

Expand All @@ -162,28 +205,26 @@ def deployfiles(deployfilename,deploydest,openforreview):
with open(path,'r') as f:
for line in f:
cl = line.strip();
# print cl
if cl[:1] <> '#' and len(cl) > 0:
args = cl.split(',')
sourceroot = ''
if args[0] == 'G':
sourceroot = globalroot
#sourceroot = os.path.expanduser('~/pykitchen/deployfiles/').strip()
elif args[0] == 'L':
sourceroot = localroot
#'localdeploy/'.strip()
# print sourceroot + args[1].strip()
# print deploydest + '/' + args[2].strip()
try:
if os.path.exists(os.path.join(sourceroot, args[1].strip())):
copys = 'sudo cp ' + os.path.join(sourceroot, args[1].strip()) + ' ' + os.path.join(deploydest, args[2].strip())
tgt = os.path.join(sourceroot, args[1].strip())
logging.info('kitchen_utils::deployfiles attempt deploy ' + tgt)
if os.path.exists(tgt):
copys = 'sudo cp ' + tgt + ' ' + os.path.join(deploydest, args[2].strip())
chmods = 'sudo chmod ' + args[3][3:] + ' ' + os.path.join(deploydest, args[2].strip(), args[1].strip())
logging.debug('copy :' + copys)
logging.debug('chmod :' + chmods)
os.system(copys)
os.system(chmods)
except IOError as e:
logerror(e)

serr = serr + 'could not deploy ' + sourceroot.strip() + args[1].strip() + '\n'

if serr <> '':
Expand Down
Loading

0 comments on commit 02690fa

Please sign in to comment.