forked from TeamKeyblade/android_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
headerfile
executable file
·88 lines (71 loc) · 2.12 KB
/
headerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Declare global variables
if ( uname -a | grep -q Darwin ); then
export POSIXLY_CORRECT=1
export LOCAL=$( echo "/Volumes/android/swordkitchen/.scripts" )
else
export LOCAL=$( cd $(dirname $0) && pwd )
fi
if [ $LOCAL == $HOME/bin/kitchen ]; then
export REPOS=$( echo "$LOCAL/../../Documents/android/repos" )
else
export REPOS=$( echo "$LOCAL/../../repos" )
fi
export BUILDS=$( echo "$REPOS/../builds" )
if ( find $BUILDS/../publish &> /dev/null); then
cd $BUILDS/../publish
export PUBLISH=$( pwd )
fi
# ::::::::::::::::::::::::::::::::::::::::::::::
# Declare paths
if ( ! echo $PATH | grep -q "$HOME/bin:" ); then
export PATH="$HOME/bin:$PATH"
fi
if ( ! echo $PATH | grep -q $LOCAL ); then
export PATH="$LOCAL/config:$PATH"
export PATH="$LOCAL/menu:$PATH"
export PATH="$LOCAL/update:$PATH"
export PATH="$LOCAL/build:$PATH"
export PATH="$LOCAL:$PATH"
fi
if ( find $BUILDS/../publish &> /dev/null) && ( ! echo $PATH | grep -q "$HOME/bin/publish:" ); then
export PATH="$PUBLISH:$PATH"
fi
# ::::::::::::::::::::::::::::::::::::::::::::::
# Create necessary files/folders
mkdir -p $LOCAL/config
mkdir -p $LOCAL/xml
if ( ! find $LOCAL/config/gitpuller &> /dev/null ); then
export AUTHOR="gitpuller"
scriptmakir
fi
if ( ! find $LOCAL/config/romeditor &> /dev/null ); then
export AUTHOR="romeditor"
scriptmakir
fi
# ::::::::::::::::::::::::::::::::::::::::::::::
# Declare number of threads from processor
processors=$( cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l )
cores=$( cat /proc/cpuinfo | grep -m 1 "cpu cores" | grep -o [0-9] )
threads=$( cat /proc/cpuinfo | grep -m 1 siblings | grep -o [0-9] )
export THREADS_TOTAL=$( expr $processors \* $threads \* $cores )
# ::::::::::::::::::::::::::::::::::::::::::::::
# Start kitchen
if [ "$START" ]; then
export START=""
export INIT=true
kitchen
exit 0
elif [ "$SCRIPT" ]; then
export INIT=true
$SCRIPT
exit 0
else
clear
echo "An Error Has Occurred!"
echo "======================"
echo "If you see this in error, please notify me at either xda or rootzwiki"
echo "if you prefer email you can reach me at [email protected]"
read done
kill 0
fi