install.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/bin/sh
  2. # author : bachir soussi chiadmi
  3. # date : 10/06/2016
  4. function install(){
  5. _cwd="$(pwd)"
  6. # candy
  7. echo 'ILoveCandy (pacman)'
  8. sed -i.back 's/.*\[options\].*/&\nILoveCandy/' /etc/pacman.conf
  9. sed -i.back 's/^#Color$/Color/' /etc/pacman.conf
  10. sed -i.back 's/^#TotalDownload$/TotalDownload/' /etc/pacman.conf
  11. # update systeme
  12. pacman -Syyu
  13. # install basic packages
  14. pacman -S --needed --noconfirm vim rsync wget tmux
  15. # configure vim
  16. echo 'vim configuration'
  17. pacman -S --needed --noconfirm vim-{spell-fr,spell-en,nerdtree,supertab,systemd}
  18. cp -r $_cwp/assets/vim /home/$USER/.vim
  19. cp $_cwd/assets/vimrc /home/$USER/.vimrc
  20. cp -r $_cwd/assets/vim /root/.vim
  21. cp $_cwd/assets/vimrc /root/.vimrc
  22. # configure git
  23. echo 'Git Completion'
  24. pacman -S --needed --noconfirm bash-completion
  25. mkdir /etc/bash_completion.d
  26. wget -O /etc/bash_completion.d/git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
  27. # yaourt
  28. # only needed for pynmea2 and python-picamera
  29. # pacman -S --needed --noconfirm base-devel
  30. # mkdir -p /home/$USER/build-repos
  31. # wget -O /home/$USER/build-repos/package-query.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
  32. # wget -O /home/$USER/build-repos/yaourt.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
  33. # cd /home/$USER/build-repos
  34. # tar -xvf package-query.tar.gz
  35. # tar -xvf yaourt.tar.gz
  36. # cd package-query
  37. # makepkg -srif --noconfirm --needed
  38. # cd ../yaourt
  39. # makepkg -srif --noconfirm --needed
  40. # echo "EDITFILES=1" >> ~/.yaourtrc
  41. # cd $_cwd
  42. # echo "Yaourt install complete!"
  43. # bash & prompt
  44. echo 'Bash and Prompt (liquidprompt)'
  45. git clone https://github.com/nojhan/liquidprompt.git -o github /home/$USER/.liquidprompt
  46. cp $_cwd/assets/bash_profile /home/$USER/.bash_profile
  47. cp $_cwd/assets/bashrc /home/$USER/.bashrc
  48. mkdir /home/$USER/.config
  49. cp $_cwd/assets/config/liquidpromptrc /home/$USER/.config/
  50. source /home/$USER/.bashrc
  51. # hostname
  52. echo 'set hostname'
  53. hostnamectl set-hostname pi-hotspot-4G
  54. sed -i 's/localhost$/&\tpi-hotspot-4G/' /etc/hosts
  55. sed -i 's/^hostname$/&\tpi-hotspot-4G/' /etc/dhcpcd.conf
  56. # avahi
  57. # echo "install avahi"
  58. # pacman -S --needed --noconfirm avahi nss-mdns
  59. # echo "configure avahi"
  60. # systemctl enable avahi-daemon
  61. # systemctl start avahi-deamon
  62. # sed -i 's/hosts: files dns myhostname/hosts: files mdns_minimal [NOTFOUND=return] dns hehe-rail-rover/' /etc/nsswitch.conf
  63. # disable bluetooth
  64. cp $_cwd/assets/rpi-wifi-blacklist.conf /ect/modprod.d/
  65. # gsm
  66. # http://www.linuxforums.org.uk/index.php?topic=1272.0
  67. # http://ubuntuforums.org/showthread.php?t=857515&p=6762696#post6762696
  68. # 06 81 82 74 27
  69. echo 'install gsm 3G tools'
  70. # HUAWEI E3372
  71. sh -c 'echo "max_usb_current=1" >> /boot/config.txt'
  72. pacman -S --needed --noconfirm usb_modeswitch ifplugd
  73. # before : Bus 001 Device 004: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)
  74. # after Bus 001 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd.
  75. # eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
  76. # link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
  77. # LTE HUAWEI
  78. echo "copy lte huawei netctl profile"
  79. cp $_cwd/assets/netctl/huawei /etc/netctl/
  80. cp $_cwd/assets/netctl/synchook /etc/netctl/hooks/
  81. echo "enable and start auto lte connection service"
  82. cp $_cwd/assets/services/lteconnect.service /etc/systemd/system/
  83. systemctl enable lteconnect.service
  84. # HOTSPOT WIFI
  85. echo "enable and start hotspot wifi netctl profile"
  86. cp $_cwd/assets/netctl/wifihotspot /etc/netctl/
  87. netctl enable wifihotspot
  88. netctl start wifihotspot
  89. echo "enable and start auto kill wifi service"
  90. cp $_cwd/assets/services/autokillwifi.service /etc/systemd/system/
  91. systemctl enable autokillwifi.service
  92. # dyndns
  93. # yaourt -S --needed --noconfirm noip
  94. # noip2 -C -Y
  95. }
  96. timedatectl set-ntp true
  97. timedatectl set-timezone Europe/Paris
  98. # use tee to record all the install script output on logfile while keeping it on console
  99. # http://www.coderanch.com/t/419711/Linux-UNIX/capture-shell-scripts-ouput-log
  100. now=$(date +"%Y-%m-%d--%T")
  101. logfile="/home/$USER/pi_hotspot-4G-$now.log"
  102. touch $logfile
  103. install | tee $logfile