Advertisement
Guest User

Untitled

a guest
Jan 15th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.49 KB | None | 0 0
  1. #!/bin/sh -e
  2. ################################################################################
  3. BASE='alsa-utils base base-devel ccache efibootmgr linux-zen linux-firmware ntp'
  4. ################################################################################
  5. DRIVERS='intel-ucode intel-media-driver libva-vdpau-driver vulkan-icd-loader vulkan-intel gstreamer-vaapi'
  6. ################################################################################
  7. GNOME='file-roller gnome-calculator gdm gedit gnome-control-center gnome-keyring gnome-screenshot gnome-shell gnome-system-monitor gnome-terminal gnome-weather nautilus networkmanager xdg-user-dirs-gtk gnome-tweaks totem gst-plugins-ugly gst-libav gvfs-mtp eog'
  8. ################################################################################
  9. APPS='firefox firefox-ublock-origin telegram-desktop qt5-wayland'
  10. ################################################################################
  11. TOOLS='asp git nano neofetch pacman-contrib youtube-dl wget'
  12. ################################################################################
  13. FONTS='ttf-liberation noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-opensans'
  14. ################################################################################
  15.  
  16.     ### Connect to the internet ###
  17. #need autoconnect+test, rewrite
  18. #wifi-menu
  19. #sleep 3
  20. #if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
  21. #  echo "IPv4 is up"
  22. #else
  23. #  echo "IPv4 is down"
  24. #fi
  25.  
  26.     ### Update the system clock ###
  27. timedatectl set-ntp true
  28.  
  29.     ### Configuring and mounting drives ###
  30. parted --script --align optimal /dev/sda 'mklabel gpt' 'mkpart primary 0% 128MB' 'mkpart primary 128MB 126GB' 'mkpart primary 126GB 100%' 'set 1 esp on'
  31. mkfs.vfat -F32 /dev/sda1
  32. mkfs.ext4 -F /dev/sda2
  33. mkswap /dev/sda3
  34. swapon /dev/sda3
  35. mount -o noatime,discard /dev/sda2 /mnt
  36. mkdir /mnt/boot
  37. mount /dev/sda1 /mnt/boot
  38.  
  39.     ### Select the mirrors ###
  40. pacman -Sy --quiet --noconfirm --noprogressbar reflector
  41. reflector --protocol https --sort rate --save /etc/pacman.d/mirrorlist
  42.  
  43.     ### Install the packages ###
  44. pacstrap /mnt $BASE $DRIVERS $GNOME $APPS $TOOLS $FONTS
  45.  
  46.     ### Fstab Setup ###
  47. genfstab -U /mnt >> /mnt/etc/fstab
  48. sed -i "s/0 2/0 0/" /mnt/etc/fstab
  49. sed -i "s/0 1/0 0/" /mnt/etc/fstab
  50.  
  51. mkdir /mnt/install
  52. cat > /mnt/install/setup.sh << "EOF1"
  53. #!/bin/sh -e
  54.  
  55.     ### Time zone ###
  56. ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
  57. hwclock --systohc
  58.  
  59.     ### Localization ###
  60. sed -i "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
  61. sed -i "s/#ko_KR.UTF-8 UTF-8/ko_KR.UTF-8 UTF-8/" /etc/locale.gen
  62. sed -i "s/#ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/" /etc/locale.gen
  63. locale-gen
  64. echo "LANG=en_US.UTF-8" > /etc/locale.conf
  65.  
  66.     ### Network configuration ###
  67. echo localhost > /etc/hostname
  68. echo -e "127.0.0.1\tlocalhost\n::1\tlocalhost\n127.0.1.1\tlocalhost.localdomain localhost" > /etc/hosts
  69.  
  70.     ### Root password ###
  71. echo -e "$PASSWORD\n$PASSWORD\n" | passwd
  72.  
  73.     ### Creating boot entry ###
  74. efibootmgr --disk /dev/sda --part 1 --create --label "Arch Linux" --loader /vmlinuz-linux-zen --unicode "root=PARTUUID=$(blkid -s PARTUUID -o value /dev/sda2) rw initrd=intel-ucode.img initrd=initramfs-linux-zen.img quiet udev.log_priority=3 i915.fastboot=1 i915.enable_fbc=1 i915.enable_guc=2 mitigations=off"
  75.  
  76.     ### Create a user account ###
  77. useradd --create-home --gid users --groups wheel,lp,storage,video,network,power --shell /bin/bash user_name
  78. echo -e "$PASSWORD\n$PASSWORD\n" | passwd user_name
  79.  
  80.     ### Enabling late microcode updates ###
  81. #
  82. # Use api, rewrite
  83. #
  84. curl --output /install/microcode.tar.gz -L https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-20191115.tar.gz
  85. tar -xf /install/microcode.tar.gz --directory /install
  86. mv /install/Intel-Linux-Processor-Microcode-Data-Files-microcode-20191115/intel-ucode /usr/lib/firmware
  87. # curl -s https://api.github.com/repos/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/latest \
  88. # grep "tarball_url" \
  89. # cut -d : -f 2,3 \
  90. # tr -d \" \
  91. # wget -qi -
  92.  
  93.     ### Creating pacman hook for "Reflector" ###
  94. mkdir /etc/pacman.d/hooks
  95. cat > /etc/pacman.d/hooks/mirrorupgrade.hook << "EOF2"
  96. [Trigger]
  97. Operation = Upgrade
  98. Type = Package
  99. Target = pacman-mirrorlist
  100.  
  101. [Action]
  102. Description = Updating pacman-mirrorlist with reflector and removing pacnew...
  103. When = PostTransaction
  104. Depends = reflector
  105. Exec = /bin/sh -c "reflector --protocol https --sort rate --save /etc/pacman.d/mirrorlist;  rm -f /etc/pacman.d/mirrorlist.pacnew"
  106. EOF2
  107.  
  108.     ### 'mkinitcpio' Setup ###
  109. sed -i "s/MODULES=()/MODULES=(ext4 i915)/" /etc/mkinitcpio.conf
  110. sed -i "s/(base udev autodetect modconf block filesystems keyboard fsck)/(base udev autodetect modconf block)/" /etc/mkinitcpio.conf
  111. mkinitcpio -p linux-zen
  112.  
  113.     ### Sound setting ###
  114. amixer sset Master on
  115. amixer sset Master 0.00dB
  116. amixer sset Master 18.75dB-
  117. amixer sset Capture cap
  118. amixer sset Capture 12.75dB
  119. #For soundcard
  120. #sed -i "s/; high-priority = yes/high-priority = yes/" /etc/pulse/daemon.conf
  121. #sed -i "s/; resample-method = speex-float-1/resample-method = copy/" /etc/pulse/daemon.conf
  122. #sed -i "s/; default-sample-format = s16le/default-sample-format = s24le/" /etc/pulse/daemon.conf
  123. #sed -i "s/; default-sample-rate = 44100/default-sample-rate = 96000/" /etc/pulse/daemon.conf
  124. #sed -i "s/; alternate-sample-rate = 48000/alternate-sample-rate = 44100/" /etc/pulse/daemon.conf
  125. #sed -i "s/; default-sample-channels = 2/default-sample-channels = 2/" /etc/pulse/daemon.conf
  126.  
  127.     ### "Makepkg" Setup ###
  128. sed -i "s/-march=x86-64 -mtune=generic/-march=native/" /etc/makepkg.conf
  129. sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j4"/' /etc/makepkg.conf
  130. sed -i 's/(!distcc color !ccache check !sign)/(!distcc color ccache check !sign)/' /etc/makepkg.conf
  131. sed -i "s/PKGEXT='.pkg.tar.xz'/PKGEXT='.pkg.tar'/" /etc/makepkg.conf
  132.  
  133.     ### Work with SystemD services ###
  134. systemctl enable NetworkManager.service
  135. systemctl enable bluetooth.service
  136. systemctl enable gdm.service
  137. systemctl mask lvm2-monitor.service
  138. systemctl mask lvm2-lvmpolld.socket
  139. systemctl mask lvm2-lvmetad.socket
  140. systemctl mask cryptsetup.target
  141.  
  142.     ### Setting environment variables ###
  143. echo "QT_QPA_PLATFORM=wayland-egl" >> /etc/environment
  144. echo "LIBVA_DRIVER_NAME=iHD" >> /etc/environment
  145. echo "MOZ_ENABLE_WAYLAND=1" >> /etc/environment
  146. echo "VDPAU_DRIVER=va_gl" >> /etc/environment
  147.  
  148.     ### Setup "sudoers" ###
  149. sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
  150. echo -e "\n##Sudo will provide visual feedback when the user presses a key" >> /etc/sudoers
  151. echo "Defaults pwfeedback" >> /etc/sudoers
  152.  
  153.     ### Remove .desktop files ###
  154. rm /usr/share/applications/avahi-discover.desktop
  155. rm /usr/share/applications/qvidcap.desktop
  156. rm /usr/share/applications/qv4l2.desktop
  157. rm /usr/share/applications/bssh.desktop
  158. rm /usr/share/applications/bvnc.desktop
  159.  
  160.     ### Other commands ###
  161. sed -i "s/#SystemMaxUse=/SystemMaxUse=12M/" /etc/systemd/journald.conf
  162. sed -i "s/#Storage=external/Storage=none/" /etc/systemd/coredump.conf
  163.  
  164. exit
  165. EOF1
  166.  
  167. chmod +x /mnt/install/setup.sh
  168. export PASSWORD=$(echo $1)
  169. arch-chroot /mnt /install/setup.sh
  170.  
  171. rm -r /mnt/install
  172. umount -R /mnt
  173.  
  174. echo -e "\n\n\n\n\n\n\n\n\n\n\n\n                    -@\n                   .##@\n                  .####@\n                  @#####@                     Installation completed.\n                . *######@\n               .##@o@#####@\n              /############@\n             /##############@\n            @######@**%######@\n           @######\`     %#####o               Restart the computer, do not forget to remove the USB-drive ...\n          @######@       ######%\n        -@#######h       ######@.\`\n       /#####h**\`\`       \`**%@####@\n      @H@*\`                    \`*%#@\n     *\`                            \`*\n\n\n\n\n\n\n\n\n\n\n\n"
  175.  
  176. ####################
  177. ########################################
  178. ############################################################
  179. ################################################################################
  180.     ### Essential packages from AUR ###
  181. # gnome-shell-extension-remove-dropdown-arrows 9-1
  182. # arch-firefox-search 0.8.2-8 - not installing
  183. # aurutils 2.3.3-1 - not installing
  184.  
  185.     ### Other commands ###
  186. # gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click 'true'
  187. # echo "options bluetooth disable_ertm=1" >> /etc/modprobe.d/xbox_bt.conf
  188. # xsetwacom set 14 Area 5700 4157 15200 9500
  189. ################################################################################
  190. ############################################################
  191. ########################################
  192. ####################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement