Files
pi_hotspot_4G/install.sh
T

130 lines
4.4 KiB
Bash

#!/bin/sh
# author : bachir soussi chiadmi
# date : 10/06/2016
function install(){
_cwd="$(pwd)"
# candy
echo 'ILoveCandy (pacman)'
sudo sed -i.back 's/.*\[options\].*/&\nILoveCandy/' /etc/pacman.conf
sudo sed -i.back 's/^#Color$/Color/' /etc/pacman.conf
sudo sed -i.back 's/^#TotalDownload$/TotalDownload/' /etc/pacman.conf
# update systeme
sudo pacman -Syyu
# install basic packages
sudo pacman -S --needed --noconfirm vim rsync wget tmux
# configure vim
echo 'vim configuration'
sudo pacman -S --needed --noconfirm vim-{spell-fr,spell-en,nerdtree,supertab,systemd}
cp -r $_cwp/assets/vim /home/$USER/.vim
cp $_cwd/assets/vimrc /home/$USER/.vimrc
sudo cp -r $_cwd/assets/vim /root/.vim
sudo cp $_cwd/assets/vimrc /root/.vimrc
# configure git
echo 'Git Completion'
sudo pacman -S --needed --noconfirm bash-completion
sudo mkdir /etc/bash_completion.d
sudo wget -O /etc/bash_completion.d/git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
# yaourt
# only needed for pynmea2 and python-picamera
# sudo pacman -S --needed --noconfirm base-devel
# mkdir -p /home/$USER/build-repos
# wget -O /home/$USER/build-repos/package-query.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
# wget -O /home/$USER/build-repos/yaourt.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
# cd /home/$USER/build-repos
# tar -xvf package-query.tar.gz
# tar -xvf yaourt.tar.gz
# cd package-query
# makepkg -srif --noconfirm --needed
# cd ../yaourt
# makepkg -srif --noconfirm --needed
# echo "EDITFILES=1" >> ~/.yaourtrc
# cd $_cwd
# echo "Yaourt install complete!"
# bash & prompt
echo 'Bash and Prompt (liquidprompt)'
git clone https://github.com/nojhan/liquidprompt.git -o github /home/$USER/.liquidprompt
cp $_cwd/assets/bash_profile /home/$USER/.bash_profile
cp $_cwd/assets/bashrc /home/$USER/.bashrc
mkdir /home/$USER/.config
cp $_cwd/assets/config/liquidpromptrc /home/$USER/.config/
source /home/$USER/.bashrc
# hostname
echo 'set hostname'
sudo hostnamectl set-hostname pi-hotspot-4G
sudo sed -i 's/localhost$/&\tpi-hotspot-4G/' /etc/hosts
sudo sed -i 's/^hostname$/&\tpi-hotspot-4G/' /etc/dhcpcd.conf
# avahi
# echo "install avahi"
# sudo pacman -S --needed --noconfirm avahi nss-mdns
# echo "configure avahi"
# sudo systemctl enable avahi-daemon
# sudo systemctl start avahi-deamon
# sudo sed -i 's/hosts: files dns myhostname/hosts: files mdns_minimal [NOTFOUND=return] dns hehe-rail-rover/' /etc/nsswitch.conf
# disable bluetooth
sudo cp $_cwd/assets/rpi-wifi-blacklist.conf /ect/modprod.d/
# gsm
# http://www.linuxforums.org.uk/index.php?topic=1272.0
# http://ubuntuforums.org/showthread.php?t=857515&p=6762696#post6762696
# 06 81 82 74 27
echo 'install gsm 3G tools'
# HUAWEI E3372
sudo sh -c 'echo "max_usb_current=1" >> /boot/config.txt'
sudo pacman -S --needed --noconfirm usb_modeswitch ifplugd
# before : Bus 001 Device 004: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)
# after Bus 001 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd.
# eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
# link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
# LTE HUAWEI
echo "copy lte huawei netctl profile"
sudo cp $_cwd/assets/netctl/huawei /etc/netctl/
sudo cp $_cwd/assets/netctl/synchook /etc/netctl/hooks/
echo "enable and start auto lte connection service"
sudo cp $_cwd/assets/services/lteconnect.service /etc/systemd/system/
sudo systemctl enable lteconnect.service
# HOTSPOT WIFI
echo "enable and start hotspot wifi netctl profile"
sudo cp $_cwd/assets/netctl/wifihotspot /etc/netctl/
sudo netctl enable wifihotspot
sudo netctl start wifihotspot
echo "enable and start auto kill wifi service"
sudo cp $_cwd/assets/services/autokillwifi.service /etc/systemd/system/
sudo systemctl enable autokillwifi.service
# dyndns
# yaourt -S --needed --noconfirm noip
# noip2 -C -Y
}
sudo timedatectl set-ntp true
sudo timedatectl set-timezone Europe/Paris
# use tee to record all the install script output on logfile while keeping it on console
# http://www.coderanch.com/t/419711/Linux-UNIX/capture-shell-scripts-ouput-log
now=$(date +"%Y-%m-%d--%T")
logfile="/home/$USER/pi_hotspot-4G-$now.log"
touch $logfile
install | tee $logfile