setup-laptop.sh 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/usr/bin/env bash
  2. # Fedora 41 setup script
  3. # Get some OS details
  4. # [[ -e /etc/os-release ]] && source /etc/os-release
  5. # Add external repos
  6. sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Fedora_Rawhide/shells:zsh-users:zsh-completions.repo
  7. sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
  8. sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
  9. # Add/remove packages
  10. sudo dnf remove -y abrt rhythmbox gnome-software spice-vdagent open-vm-tools-desktop orca anaconda-live gnome-initial-setup
  11. sudo dnf install -y \
  12. rpmfusion-free-release \
  13. zsh zsh-completions ShellCheck \
  14. btrbk btrfsmaintenance \
  15. vim htop remmina calibre pinta toolbox code gnome-tweaks \
  16. wl-clipboard syncthing profile-sync-daemon \
  17. python3-virtualenv python3-virtualenvwrapper nautilus-python gettext \
  18. setroubleshoot
  19. # Use zsh as default shell
  20. chsh -s "$(which zsh)"
  21. # Enable profile-sync-daemon for the user
  22. systemctl --user enable --now psd
  23. # Enable automatic system updates
  24. sudo systemctl enable --now dnf5-automatic.timer
  25. # Make btrfs subvolumes
  26. sudo btrfs sub create ~/media/music
  27. sudo btrfs sub create ~/media/tv
  28. sudo btrfs sub create ~/media/pictures
  29. sudo btrfs sub create ~/media/ebooks
  30. sudo btrfs sub create ~/media/movies
  31. sudo btrfs sub create ~/media/podcasts
  32. # Create links
  33. ln -s ~/media/music ~/music
  34. ln -s ~/documents/develop ~/develop
  35. ln -s ~/.local/bin ~/bin
  36. ln -s ~/devices/phone/podcasts ~/media/podcasts
  37. ln -s ~/develop/scripts/share-link ~/.local/share/nautilus/scripts/
  38. # Allow some commands to invoke sudo without a password
  39. echo "bryan ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper, /usr/sbin/btrfs, /usr/bin/journalctl, /usr/bin/dnf, /usr/bin/fwupdmgr, /usr/bin/dmesg" | sudo tee -a /etc/sudoers > /dev/null
  40. # Use full location in nautilus
  41. gsettings set org.gnome.nautilus.preferences always-use-location-entry true
  42. # Increase scrollback limit for gnome-console
  43. kgx --set-scrollback 100000000
  44. # btrbk
  45. # sudo ln -s ~/.config/btrbk/btrbk.conf /etc/btrbk/btrbk.conf
  46. # ssh-keygen -t ed25519 -f ~/.config/btrbk/id_ed25519
  47. #[[ ! -d "/etc/btrbk/ssh/" ]] && sudo mkdir -p /etc/btrbk/ssh
  48. #sudo ln -s ~/.config/btrbk/id_ed25519 /etc/btrbk/ssh/id_ed25519
  49. # Firefox
  50. # mousewheel.acceleration.factor 20
  51. # mousewheel.acceleration.start 2
  52. # gfx.webrender.all true
  53. # browser.tabs.insertAfterCurrent true
  54. # browser.ctrlTab.sortByRecentlyUsed = true
  55. # Create battery charging threshold service
  56. sudo bash -c "cat <<-EOF > /etc/systemd/system/set-battery-charge-threshold.service
  57. [Unit]
  58. Description=Set battery charge thresholds
  59. After=multi-user.target
  60. StartLimitBurst=0
  61. [Service]
  62. Type=oneshot
  63. Restart=on-failure
  64. RemainAfterExit=yes
  65. ExecStart=/bin/bash -c 'echo 80 > /sys/class/power_supply/BAT0/charge_control_start_threshold; echo 90 > /sys/class/power_supply/BAT0/charge_control_end_threshold'
  66. ExecStop=/bin/bash -c 'echo 100 > /sys/class/power_supply/BAT0/charge_control_end_threshold; echo 99 > /sys/class/power_supply/BAT0/charge_control_start_threshold'
  67. [Install]
  68. WantedBy=multi-user.target
  69. EOF"
  70. sudo systemctl daemon-reload &&
  71. sudo systemctl enable --now set-battery-charge-threshold.service
  72. # Increase max_user_watches for VSCode
  73. echo "fs.inotify.max_user_watches=524288" | sudo tee /etc/sysctl.d/local.conf > /dev/null
  74. sudo systemctl restart systemd-sysctl.service
  75. # Install clone dirs
  76. git -C ~/.local/bin clone https://git.bryanroessler.com/bryan/installJRMC.git -b dev
  77. git -C ~/.local/bin clone https://git.bryanroessler.com/bryan/openwrtbuilder.git -b dev