forked from syphyr/cm_build_scripts
/
update_web_cm11
executable file
·64 lines (53 loc) · 1.36 KB
/
update_web_cm11
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
#!/bin/bash
## OTA Rest Server builds directory
BUILDDIR=/var/www/html/CyanogenModOTA/builds
## Root of CM project directory
PROJECT_DIR=~/android/system/cm-11.0
## Changelog location
CHANGE_FILE=~/android/changelog-cm11.html
## Device name
ANDROID_DEVICE=p3110
## End Edit
OUTDIR=$PROJECT_DIR/out/target/product/$ANDROID_DEVICE
## Find file name of ROM and set variable
cd "$OUTDIR"
FILE=$(ls cm-11-*.zip)
## Check if ROM exists before proceding
if [ ! -e "$FILE" ]; then
echo "Build Failed!"
if [ -e `which send_mail_cm11` ]; then
echo ""
echo "Automatic email notification sent for failed build!"
SUBJECT="Build Failed!"
send_mail_cm11 "$SUBJECT"
fi
exit
fi
echo "Build Successful!"
if [ -e `which send_mail_cm11` ]; then
echo ""
echo "Automatic email notification sent for successful build."
SUBJECT="Build Successful for $FILE"
send_mail_cm11 "$SUBJECT"
fi
## Remove extension of file name and set variable
NOEXT=${FILE%\.*}
echo ""
echo "Removing previous builds on OTA REST Server."
echo ""
rm "$BUILDDIR"/full/cm-11-*
echo "Copying ROM ($FILE) to OTA REST Server."
echo ""
cp "$FILE" "$BUILDDIR"/full/
if [ -e "$CHANGE_FILE" ]; then
echo "Copying changelog ($NOEXT.html) to OTA REST Server."
echo ""
cp "$CHANGE_FILE" "$BUILDDIR"/full/"$NOEXT".html
else
echo "Changelog not found!"
echo ""
exit
fi
echo ""
echo "Done."
echo ""