Verybad

Arch Linux autoinstall v2

Feb 7th, 2023 (edited)
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. disk=mmcblk1
  4. efi_size=500MiB
  5. rootfs=btrfs
  6. hostname=t100chi
  7. username=pasha
  8. userpass=1
  9.  
  10. # Formatting the partitions
  11. wipefs -a /dev/$disk
  12. #parted /dev/$disk mklabel msdos
  13. parted /dev/$disk mklabel gpt
  14. parted /dev/$disk mkpart primary fat32 0% $efi_size
  15. parted /dev/$disk set 1 esp on
  16. parted /dev/$disk mkpart primary $efi_size 100%
  17. mkfs.fat -F32 /dev/${disk}p1
  18. mkfs.$rootfs /dev/${disk}p2
  19.  
  20. # Mounting the file systems
  21. mount /dev/${disk}p2 /mnt
  22. mkdir /mnt/boot/efi -p
  23. mount /dev/${disk}p1 /mnt/boot/efi
  24.  
  25. # Выполняем замену строк
  26. sed -i 's/#Color/Color/' /etc/pacman.conf
  27. sed -i 's/^#ParallelDownloads.*/ParallelDownloads = 10/' /etc/pacman.conf
  28. echo 'Server = http://mirror.neolabs.kz/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
  29.  
  30. # Installing minimal base system
  31. pacstrap /mnt base linux terminus-font cpupower openssh cpio inetutils sudo netctl net-tools mc wget wpa_supplicant ntp bash-completion htop wireless_tools axel nano dhcpcd efibootmgr iwd zram-generator smartmontools fastfetch cronie fzf f2fs-tools
  32.  
  33. # Installing base system
  34. #pacstrap /mnt base base-devel linux-headers linux cpupower openssh cpio inetutils sudo git go fakeroot make gcc netctl net-tools mc wget wpa_supplicant dialog ntp bash-completion htop iotop lsof wireless_tools screen lshw dmidecode axel nano dhcpcd linux-firmware ppp xl2tpd amd-ucode intel-ucode efibootmgr iwd zram-generator nfs-utils samba smartmontools fastfetch cronie chntpw audit lazydocker
  35.  
  36. # Generating fstab file
  37. genfstab -U /mnt >> /mnt/etc/fstab
  38.  
  39. # Chrooting into the new system
  40. arch-chroot /mnt /bin/bash <<EOF
  41.  
  42. # Setting the locale
  43. echo "LANG=ru_RU.UTF-8" > /etc/locale.conf
  44. echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && echo 'ru_RU.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
  45.  
  46. # Setting the timezone
  47. ln -sf /usr/share/zoneinfo/Asia/Almaty /etc/localtime
  48.  
  49. # Setting the hostname
  50. echo "$hostname" > /etc/hostname
  51.  
  52. echo 'KEYMAP=ruwin_alt_sh-UTF-8' > /etc/vconsole.conf
  53. echo 'LOCALE=ru_RU.UTF-8' >> /etc/vconsole.conf
  54. echo 'CONSOLEMAP=' >> /etc/vconsole.conf
  55. echo 'FONT=cyr-sun16' >> /etc/vconsole.conf
  56. echo 'USECOLOR=yes' >> /etc/vconsole.conf
  57.  
  58.  
  59. # Installing bootloader
  60. pacman -S grub --noconfirm
  61. #grub-install /dev/sda
  62.  
  63. #BIOS
  64. grub-install --recheck --target=i386-pc --boot-directory=/boot /dev/$disk
  65.  
  66. #UEFI
  67. grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot --removable
  68.  
  69. mkdir -p /boot/grub
  70. grub-mkconfig -o /boot/grub/grub.cfg
  71.  
  72. # Installing X-server and Xfce4
  73. # pacman -S xorg xfce4 xfce4-goodies slim --noconfirm
  74.  
  75. # Creating new user
  76. useradd -m -G wheel $username
  77. echo "$username:$userpass" | chpasswd
  78. echo "root:1" | chpasswd
  79. echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
  80.  
  81. echo 'Server = http://mirror.neolabs.kz/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
  82. echo 'nameserver 8.8.8.8' > /etc/resolv.conf
  83.  
  84.  
  85. wget http://159.69.152.50/ais/yay-install.sh -O /home/$username/yay-install.sh
  86. chown $username:$username /home/$username/yay-install.sh
  87. chmod +x /home/$username/yay-install.sh
  88. echo 'exec startxfce4' > /home/$username/.xinitrc
  89.  
  90.  
  91. #wget http://159.69.152.50/ais/vconsole.conf -O /etc/vconsole.conf
  92. chown root:root /etc/vconsole.conf
  93. chmod 644 /etc/vconsole.conf
  94.  
  95. systemctl enable dhcpcd sshd iwd
  96.  
  97. EOF
  98.  
  99. # Unmounting and rebooting
  100. umount -R /mnt
  101. reboot
  102.  
Advertisement
Add Comment
Please, Sign In to add comment