forked from beingmishra/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver_setup.sh
74 lines (58 loc) · 2.73 KB
/
server_setup.sh
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
#!/bin/bash
#
# Script to set up Server
# for android ROM compiling
#
#
# Go to home dir
cd ... || return
# Installing packages
echo -e "\n================== INSTALLING & CONFIGURING PACKAGES ==================\n"
sudo apt-get update
sudo apt-get install -y bc bison build-essential curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev unzip openjdk-8-jdk python ccache
sudo apt-get upgrade -y
# CCache
ccache -M 100G
# Install Android SDK
echo -e "\n================== INSTALLING ANDROID SDK ==================\n"
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip
rm platform-tools-latest-linux.zip
# Install repo
echo -e "\n================== INSTALLING GIT-REPO ==================\n"
wget https://storage.googleapis.com/git-repo-downloads/repo
chmod a+x repo
sudo install repo /usr/local/bin/repo
# Install google drive command line tool
echo -e "\n================== INSTALLING GDRIVE CLI ==================\n"
wget -O gdrive "https://docs.google.com/uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE&export=download"
chmod a+x gdrive
sudo install gdrive /usr/local/bin/gdrive
# Set up environment
echo -e "\n================== SETTING UP ENV ==================\n"
cat <<'EOF' >> ~/.bashrc
# Upload a file to transfer.sh
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
# Super-fast repo sync
repofastsync() { schedtool -B -n 1 -e ionice -n 1 `which repo` sync -c -f --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j8 "$@"; }
export USE_CCACHE=1
EOF
# Add android sdk to path
cat <<'EOF' >> ~/.profile
# Add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
EOF
# Set time zone to IST
sudo ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
# Configure git
echo -e "\n================== CONFIGURING GIT ==================\n"
git config --global user.email "rahul731999@gmail.com"
git config --global user.name "Beingmishra"
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=9999999'
echo "Done"
# Done!
echo -e "\n ALL DONE. Now sync sources & start baking!\n"