Nybble

arch-arm8v

Feb 20th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.65 KB | None | 0 0
  1. #!/bin/bash
  2. #run this script as root after installing ArchLinuxArm
  3. #you can get this script with command curl -LJO https://www.path-to-this-file.com
  4. userhome="/home/alarm"
  5. #Change these variables as needed
  6. #boxstaticname="server1.mysite.com"
  7. #boxtransientname="ArchPi"
  8. boxname="ArchPi" #Name of this device to be used as hostname also
  9. boxdescription="Arch Linux - Raspberry Pi"
  10.  
  11. pacman-key --init
  12. pacman -Syyu --force --noconfirm
  13. pacman -S --needed --noconfirm sudo bash-completion base-devel wget git tmux libglvnd xorg-server xorg-xinit xf86-video-fbdev libx264 alsa-utils alsa-firmware alsa-plugins openbox obconf compton oblogout lxappearance-obconf tint2 feh ttf-dejavu
  14. #=============================================================================================
  15. #extra packages , you might not need, uncomment if you want them
  16. #pacman -S sdl linux-raspberrypi-headers libcec-rpi kodi-rbp libomxil-bellagio autoconf automake libsdl2-dev libtool libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo libfribidi-dev libfontconfig1-dev libjpeg-dev libgnutls28-dev libluajit-5.1-dev libbluray-dev libtheora-dev libvorbis-dev linux-headers-rpi2 libomxil-bellagio-dev
  17. #=============================================================================================
  18. sed -i.bak -e 's?#en_US\.UTF-8 UTF-8?en_US\.UTF-8 UTF-8?g' /etc/locale.gen
  19. locale-gen
  20. localectl set-locale LANG=en_US.UTF-8
  21. LANG= source /etc/profile.d/locale.sh
  22. export LANG=en_US.UTF-8
  23.  
  24. #make default user part of wheel group
  25. usermod -g users -G wheel,storage,power -s /bin/bash alarm
  26. #Make nano the default editor and give sudo power to users in group wheel
  27. perl -i.bak -0pe 's?# %wheel ALL=\(ALL\) ALL\n?%wheel ALL=\(ALL\) ALL\n?' /etc/sudoers
  28. perl -i.bak -pe 'printf "Defaults editor=/usr/bin/nano\n" if $. == 1' /etc/sudoers
  29.  
  30. timedatectl set-ntp true
  31. tzselect
  32. hostnamectl set-hostname "$boxname"
  33. hostnamectl set-hostname "$boxdescription" --pretty
  34. #hostnamectl set-hostname $boxstaticname --static
  35. #hostnamectl set-hostname $boxtransientname --transient
  36.  
  37. echo -e "127.0.0.1\tlocalhost" >> /etc/hosts
  38. echo -e "::1\t\tlocalhost" >> /etc/hosts
  39. echo -e "127.0.1.1\t"$boxname".localdomain\t"$boxname"" >> /etc/hosts
  40. #little fix to make the mouse work correctly.
  41. perl -i.bak -pe 's/$/ usbhid.mousepoll=0/' /boot/cmdline.txt
  42.  
  43. su alarm -c mkdir -m770 /usr/share/backgrounds && chgrp wheel /usr/share/backgrounds
  44. su alarm -c mkdir -m770 "$userhome"/.builds "$userhome"/.config
  45. su alarm -c cp -R /etc/xdg/openbox "$userhome"/.config/
  46.  
  47. su alarm -c mkdir -m770 "$userhome"/.builds/st && su alarm -c cd "$userhome"/.builds/st
  48. #======================  git stuff ===============================
  49. su alarm -c git clone git://git.suckless.org/st
  50. make -j4 clean install
  51. cd "$userhome"/
  52.  
  53. git clone https://aur.archlinux.org/trizen-git.git
  54. cd trizen-git
  55. makepkg -srci --noconfirm
  56.  
  57. git clone https://github.com/dylanaraps/neofetch
  58. cd neofetch
  59. make -j4 clean install
  60. #===================================================================
  61.  
  62. su alarm -c touch "$userhome"/.config/openbox/autostart "$userhome"/.nanorc
  63. echo -e ". ~/.fehbg &\ntint2 &\n" >> "$userhome"/.config/openbox/autostart
  64. echo -e "set constantshow\n" >> "$userhome"/.nanorc
  65.  
  66. wget -O /usr/share/backgrounds/archpi.jpg http://getwallpapers.com/wallpaper/full/9/d/9/1057081-best-arch-linux-wallpaper-1920x1080.jpg
  67. wget -O /usr/share/backgrounds/arch1.jpg http://getwallpapers.com/wallpaper/full/b/0/9/1056666-arch-linux-wallpaper-1920x1080-for-ios.jpg
  68.  
  69. su alarm -c cp /etc/skel/{.bashrc,.bash_profile} "$userhome"/
  70. su alarm -c touch "$userhome"/.fehbg
  71. echo -e "feh --recursive --bg-fill --no-fehbg --randomize /usr/share/backgrounds/*" > "$userhome"/.fehbg
  72. echo -e "\nalias logout='oblogout'\nalias obstart='printf sudo nano ~/.config/openbox/autostart'" >> "$userhome"/.bashrc
  73. echo -e "alias pacup='sudo pacman -Syyu --noconfirm'" >> "$userhome"/.bashrc
  74. echo -e "alias pac-clean='sudo pacman -Scvv --noconfirm'" >> "$userhome"/.bashrc
  75. echo -e "alias bashrc='sudo nano ~/.bashrc && source ~/.bashrc'" >> "$userhome"/.bashrc
  76. printf "\nif [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then\nexec startx\nfi" >> "$userhome"/.bash_profile
  77.  
  78. su alarm -c cp /etc/X11/xinit/xinitrc "$userhome"/.xinitrc
  79. #find and remove conflicting lines from .xinitrc
  80. sed -i '/^twm &/d' "$userhome"/.xinitrc
  81. sed -i '/^xclock -/d' "$userhome"/.xinitrc
  82. sed -i '/^xterm -/d' "$userhome"/.xinitrc
  83. sed -i '/^exec xterm -/d' "$userhome"/.xinitrc
  84. #add this line to launch openbox as the defaul window manager
  85. echo "exec openbox-session" >> "$userhome"/.xinitrc
  86.  
  87. #choose wireless interface
  88. readarray -t interfaces < <(ip -o link show | awk -F ': ' '{print $2}' | grep "wl")
  89. PS3="Type the number of the interfaceto use for wifi [ENTER]: "
  90. select i in "${interfaces[@]}"; do
  91.   [[ -n "$i" ]] || { printf "Wrong choice, try again \n\n" >&2; continue; }
  92.     break;
  93. done
  94.  
  95. read -r choseninterface <<< "$i"
  96. echo -e "You have chosen: "$choseninterface" \n\n"
  97. ifconfig "$choseninterface" up
  98.  
  99. systemctl enable wpa_supplicant@"$choseninterface"
  100. systemctl enable systemd-networkd
  101. systemctl enable systemd-resolved
  102. systemctl enable systemd-timesyncd
  103. #choose ESSID
  104. readarray -t ssid < <(iwlist "$choseninterface" scan | grep ESSID | awk -F ':' '{print $2}')
  105. PS3="Choose Network to connect to [ENTER]: "
  106. select i in "${ssid[@]}"; do
  107.   [[ -n "$i" ]] || { printf "Wrong choice, try again \n\n" >&2; continue; }
  108.     break;
  109. done
  110.  
  111. read -r chosenssid <<< "$i"
  112. echo -e "You have chosen "$chosenssid"\n\n"
  113. #ask for password for chosen connection
  114. read -p "Enter the password for the selected network and press [ENTER]: " pass
  115.  
  116. interfacefile=/etc/wpa_supplicant/wpa_supplicant-"$choseninterface"'.conf'
  117. chosenssid=$(sed -e 's/^"//' -e 's/"$//' <<< "$chosenssid")
  118. wpa_passphrase "$chosenssid" "$pass" > "$interfacefile"
  119. #delete the text password from file
  120. sed -i '/#psk/d' "$interfacefile"
  121. sed -i '1s/^/update_config=1\n/' "$interfacefile"
  122. sed -i '1s/^/ctrl_interface_group=wheel\n/' "$interfacefile"
  123. sed -i '1s/^/ctrl_interface=\/run\/wpa_supplicant\n/' "$interfacefile"
  124.  
  125. touch /etc/systemd/network/wl.network
  126. echo -e "[Match]\nName=wl*\n\n[Network]\nDHCP=yes\n" > /etc/systemd/network/wl.network
  127.  
  128. #change hdmi_group=1 to hdmi_group=2 if using a monitor for better viewing
  129. perl -i.bak -pe 's/^gpu_mem.*/gpu_mem=320/' /boot/config.txt
  130. #echo -e "\narm_freq=1000\ncore_freq=500\nsdram_freq=500\nover_voltage=6\n\n" >> /boot/config.txt #some overclocking options
  131. echo -e "dtparam=audio=on\nhdmi_drive=2\ndisable_overscan=1\nhdmi_mode=16" >> /boot/config.txt
  132.  
  133. amixer sset 'PCM' unmute && amixer sset 'PCM' 100% #unmute device, just incase it is muted
  134.  
  135. chown -R alarm:wheel "$userhome"
  136. chage -d 0 alarm
  137. reboot
Add Comment
Please, Sign In to add comment