Created
July 22, 2011 20:39
-
-
Save optedoblivion/1100373 to your computer and use it in GitHub Desktop.
nbbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REQUIRED="locate zenity" | |
for req in $(echo $REQUIRED); | |
do | |
type -P "$req" &>/dev/null || { echo "Install '$req'" >&2; exit 1; } | |
done | |
if [ $# -lt 1 ]; then | |
echo | |
echo "Usage: $0 <board name> [--sync] [--dir=/path/to/dir]" | |
echo | |
exit 1 | |
fi | |
PRE_BUILD_CMD="" | |
ENVSH="build/envsetup.sh" | |
CM_ROOT=$(locate $ENVSH) | |
CM_ROOT=$(echo $CM_ROOT|sed "s/build\/envsetup.sh//g") | |
BOARD_NAME="" | |
DROPBOX="~/Dropbox" | |
# Iterate through options | |
let i=0 | |
for option in "$@" | |
do | |
if [ $i -lt 1 ];then | |
# use this to skip board name | |
opt=$(echo "$option" | grep -ve "^-") | |
BOARD_NAME="$opt" | |
if [ "$BOARD_NAME" == "" ]; then | |
echo | |
echo "Error: no board name specified!" | |
echo | |
exit 1 | |
fi | |
let i+=1 | |
else | |
opt=$(echo "$option" | grep -e "^-") | |
if [ "$opt" == "--sync" ]; then | |
PRE_BUILD_CMD="reposync" | |
elif [ "$(echo "$opt"|cut -d '=' -f 1)" == "--dir" ]; then | |
CM_ROOT=$(echo $opt | sed 's/--dir=//') | |
fi | |
fi | |
done | |
let cnt=0 | |
for root in $(echo $CM_ROOT); | |
do | |
let cnt+=1 | |
done | |
if [ "$CM_ROOT" == "" ]; then | |
echo | |
echo "No CyanogenMod root found!" | |
echo | |
exit 1 | |
fi | |
if [ $cnt -gt 1 ]; then | |
REAL_ROOT=$(zenity --list --title="Select CyanogenMod Root Path" --column="CyanogenMod Path" $(echo $CM_ROOT | xargs)) | |
if [ "$REAL_ROOT" == "" ]; then | |
echo | |
echo "No CyanogenMod root found!" | |
echo | |
exit 1 | |
fi | |
CM_ROOT=$REAL_ROOT | |
fi | |
cd $CM_ROOT | |
source ./build/envsetup.sh | |
$(echo $PRE_BUILD_CMD) | |
exit 1 | |
CYANOGEN_NIGHTLY=1 brunch "$BOARD_NAME" | |
cp $OUT/update-squished.zip "$DROPBOX" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment