#!/bin/bash
# Info : install tools for ubuntu 14.04 for seafile
# Author : wangbo
# CTime : 2016.09.02
#--------- 使用命令:sudo chmod a+x ubuntu_14.04.5_seafile.sh -----------------
#--------- 执行安装脚本程序命令为: sh ubuntu_14.04.5_seafile.sh ---------------------
#-------------------------------------------
#----------------------------------------
#-- 如果出现无法获得锁 /var/lib/apt/lists/lock --
#----------------------------------------
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
#设置github用户名,这个每个人需要修改
GIT_NAME=wangbo121
GIT_EMAIL=wangbo121bit@gmail.com
echo -e "Install ubuntu_14.04.5_seafile.sh Start\n\n"
echo "*************************************"
#设置用户名
USER_NAME=$USER
#更改镜像源
SOURCE_ADDRESS=http://mirror.bit.edu.cn
UBUNTU_VERSION=trusty
SOURCES_LIST=/etc/apt/sources.list
#备份旧的镜像源
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup_$(date +%s)
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-security main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-updates restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-proposed restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-backports restricted universe multiverse" >> $SOURCES_LIST
SOURCE_ADDRESS=http://mirrors.aliyun.com
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-security main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-updates restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-proposed restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-backports restricted universe multiverse" >> $SOURCES_LIST
SOURCE_ADDRESS=http://mirrors.163.com
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-security main restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-updates restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-proposed restricted universe multiverse" >> $SOURCES_LIST
sudo echo "deb $SOURCE_ADDRESS/ubuntu/ $UBUNTU_VERSION-backports restricted universe multiverse" >> $SOURCES_LIST
#更新镜像源
sudo apt-get update
#安装vim代替vi
echo -e "Start install vim\n\n"
sudo apt-get install vim -y
#echo "alias vi=vim " >> ~/.bashrc
#source ~/.bashrc
#安装编译工具 gcc g++ make等等
echo -e "Start install gcc g++\n\n"
sudo apt-get install gcc g++ -y
sudo apt-get install build-essential -y
#安装ssh服务器
#echo -e "Start install ssh\n\n"
#sudo apt-get install openssh-server -y
#安装samba服务器
echo -e "Start install samba\n\n"
sudo apt-get install samba -y
#安装git
sudo apt-get install git git-core -y
#添加wangbo这个用户到dialout组
sudo usermod -a -G dialout $USER_NAME
#配置git,然后下载px4的Firmware,编译##########
#配置用户名
git config --global user.name "$GIT_NAME"
# 配置邮件
git config --global user.email "$GIT_EMAIL"
#解决git clone下载速度慢问题
sudo cp /etc/ssh/ssh_config /etc/ssh/ssh_config_backup_$(date +%s)
sudo sed 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' -i /etc/ssh/ssh_config
#安装64bit的14.04.5安装jdk 如果不可以直接通过apt-get安装那么执行下列命令
sudo add-apt-repository ppa:openjdk-r/ppa -y
sudo apt-get update
sudo apt-get install openjdk-8-jdk openjdk-8-jre -y
sudo apt-get autoremove -y
#error : src/_pylibmcmodule.h:41:20: fatal error: Python.h: No such file or director
sudo apt-get install python-dev
echo -e "All SoftWare have been Installed!!!\n\n"
echo "******************************************"