Chroot-Install.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. SDA1=/dev/sda1
  3. SDA=/dev/sda
  4. MNT=/mnt
  5. FSTAB=/etc/fstab
  6. PACMAN_MIRROR=/etc/pacman.d/mirrorlist
  7. HOSTNAME=/etc/hostname
  8. LOCAL_TIME=/etc/localtime
  9. LOCALE_GEN=/etc/locale.gen
  10. LOCALE_CONF=/etc/locale.conf
  11. MKINITCPIO_CONF=/etc/mkinitcpio.conf
  12. GRUB_CFG=/boot/grub/grub.cfg
  13. BASH=/bin/bash
  14. SUDOERS=/etc/sudoers
  15. CREATOR="CSCoder4ever"
  16. echo "Welcome to $CREATOR's installation script! part 2 of 2"
  17. echo "generating locale"
  18. locale-gen && locale > $LOCALE_CONF
  19. sleep 1 && echo "Creating Initial RAM disk"
  20. mkinitcpio -p linux
  21. sleep 1 && echo "set root password"
  22. passwd
  23. sleep 1 && echo "Configuring grub"
  24. grub-install --target=i386-pc --recheck --debug --force $SDA && grub-mkconfig -o /boot/grub/grub.cfg
  25. sleep 1 && read -p "Create user now? y/n: " userResponse
  26. if [[ "$userResponse" = "y" || "$userResponse" = "Y" ]]; then
  27. read -p "Enter new username: " userName
  28. useradd -m -g users -G audio,video,optical,storage,disk,lp,sys,wheel,rfkill,log,systemd-journal -s $BASH $userName
  29. passwd $userName
  30. else
  31. echo "Skipping..."
  32. fi
  33. sleep 1 && read -p "Would you like to update the machine and install necessary programs? y/n: " SyuR
  34. if [[ "$SyuR" = "y" || "$SyuR" = "Y" ]]; then
  35. pacman -Syyu
  36. sleep 1 && echo "Installing necessary server programs"
  37. pacman -S openssh git mc samba wget htop fakeroot jshon expac nfs-utils net-tools webmin apache php php-apache\
  38. mariadb perl-net-ssleay screenfetch emacs tmux bc zsh #jenkins apache-ant maven
  39. else
  40. echo "skipping..."
  41. fi
  42. # if packer's PKGBUILD file is found, it will install it.
  43. if [ -f PKGBUILD ]; then
  44. echo "Packer PKGBUILD found, installing.. "
  45. makepkg --asroot
  46. pacman -U packer-*.pkg.tar.*
  47. echo "updating packer"
  48. packer -Syyu
  49. fi
  50. sleep 1 && echo "removing temporary files"
  51. rm /part2.sh
  52. # if either PKGBUILD and/or packer tar exist, remove them at will
  53. if [ -f PKGBUILD ]; then
  54. rm /PKGBUILD
  55. fi
  56. if [ -f packer-*.pkg.tar.* ]; then
  57. rm /packer-*.pkg.tar.*
  58. fi
  59. sleep 1 && echo "Installation complete!"
  60. exit