Browse Source

removed sudo from install.sh

Bachir Soussi Chiadmi 6 years ago
parent
commit
1d8e8319d5
2 changed files with 35 additions and 33 deletions
  1. 2 0
      README.md
  2. 33 33
      install.sh

+ 2 - 0
README.md

@@ -13,3 +13,5 @@ plug an ethernet cable with internet access on the pi
 boot the pi and connect with ssh (use nmap to find the pi ip)
 
 install git ```pacman -S git```
+
+run install.sh as root

+ 33 - 33
install.sh

@@ -9,32 +9,32 @@ function install(){
 
   # 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
+  sed -i.back 's/.*\[options\].*/&\nILoveCandy/' /etc/pacman.conf
+  sed -i.back 's/^#Color$/Color/' /etc/pacman.conf
+  sed -i.back 's/^#TotalDownload$/TotalDownload/' /etc/pacman.conf
 
   # update systeme
-  sudo pacman -Syyu
+  pacman -Syyu
   # install basic packages
-  sudo pacman -S --needed --noconfirm vim rsync wget tmux
+  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}
+  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
+  cp -r $_cwd/assets/vim /root/.vim
+  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
+  pacman -S --needed --noconfirm bash-completion
+  mkdir /etc/bash_completion.d
+  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
+  # 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
@@ -60,21 +60,21 @@ function install(){
 
   # 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
+  hostnamectl set-hostname pi-hotspot-4G
+  sed -i 's/localhost$/&\tpi-hotspot-4G/' /etc/hosts
+  sed -i 's/^hostname$/&\tpi-hotspot-4G/' /etc/dhcpcd.conf
 
 
   # avahi
   # echo "install avahi"
-  # sudo pacman -S --needed --noconfirm avahi nss-mdns
+  # 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
+  # systemctl enable avahi-daemon
+  # systemctl start avahi-deamon
+  # 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/
+  cp $_cwd/assets/rpi-wifi-blacklist.conf /ect/modprod.d/
 
 
   # gsm
@@ -84,9 +84,9 @@ function install(){
   echo 'install gsm 3G tools'
 
   # HUAWEI E3372
-  sudo sh -c 'echo "max_usb_current=1" >> /boot/config.txt'
+  sh -c 'echo "max_usb_current=1" >> /boot/config.txt'
 
-  sudo pacman -S --needed --noconfirm usb_modeswitch ifplugd
+  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
@@ -94,20 +94,20 @@ function install(){
 
   # 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/
+  cp $_cwd/assets/netctl/huawei /etc/netctl/
+  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
+  cp $_cwd/assets/services/lteconnect.service /etc/systemd/system/
+  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
+  cp $_cwd/assets/netctl/wifihotspot /etc/netctl/
+  netctl enable wifihotspot
+  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
+  cp $_cwd/assets/services/autokillwifi.service /etc/systemd/system/
+  systemctl enable autokillwifi.service
 
 
   # dyndns
@@ -118,8 +118,8 @@ function install(){
 }
 
 
-sudo timedatectl set-ntp true
-sudo timedatectl set-timezone Europe/Paris
+timedatectl set-ntp true
+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