post-install-laptop.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # A very simple post-install script to get everything up and running.
  3. # Primarily designed for my laptop running arch.
  4. # check if the user is root
  5. if [ "$( id -u )" != 0 ]; then
  6. echo "Script needs to be run as root."
  7. exit 1
  8. fi
  9. EDITOR=emacs -nw # change to favorite text editor
  10. SERVERIP=127.0.0.1 # change to server's proper IP
  11. MNTPT=/hdd1 # change to appropriate nfs share location
  12. BACKUPLOC=/.backups-system-files/`hostname` # change as needed!
  13. LOGIND=/etc/systemd/logind.conf
  14. # start network manager
  15. echo "starting NetworkManager"
  16. systemctl enable NetworkManager
  17. systemctl start NetworkManager
  18. # edit fstab to make sure everything is ship-shape
  19. $EDITOR /etc/fstab
  20. # edit logind file to fix suspend issue with xfce4-power-manager
  21. $EDITOR $LOGIND
  22. # install a couple programs from the AUR with packer
  23. echo "Installing a couple programs from the AUR"
  24. packer -S pnmixer compton xfce4-volumed ld-lsb arch-install-scripts
  25. # mount the server and copy everything to the following directories.
  26. echo "mounting server.. "
  27. mount -t nfs4 $SERVERIP:$MNTPT /mnt
  28. echo "copying data to $HOME"
  29. cp -r /mnt$BACKUPLOC$HOME $HOME
  30. echo "copying data to /etc"
  31. cp /mnt$BACKUPLOC/etc /etc
  32. echo "copying data to /usr"
  33. cp -r /mnt$BACKUPLOC/usr /usr
  34. echo "unmount /mnt"
  35. umount /mnt
  36. # Create group git and add the current user to it
  37. groupadd git
  38. gpasswd -a $USER git
  39. git config --global core.sharedRepository group
  40. # Remove scripts since they will no longer be necessary
  41. echo "removing script"
  42. rm /etc/post-install.sh
  43. rm /usr/bin/post-install
  44. echo "Process is complete!"
  45. read -p "reboot now? y/n: " exitR
  46. if [[ "$exitR" = "y" || "$exitR" = "Y" ]]; then
  47. reboot
  48. fi