Created
March 31, 2025 00:16
-
-
Save pizzimenti/c6f212233d1b5aa398431ec090b02366 to your computer and use it in GitHub Desktop.
Manjaro Development Setup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| # Setup development environment on a clean Manjaro Linux install | |
| # Usage: sudo ./manjaro_dev_setup.sh | |
| # Exit on error | |
| set -e | |
| # Check if running as root | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "โ Please run as root (use sudo)" | |
| exit 1 | |
| fi | |
| echo "๐ Starting Manjaro development environment setup..." | |
| # Configure parallel downloads | |
| echo "โ๏ธ Configuring parallel downloads..." | |
| # More targeted approach to set ParallelDownloads | |
| if grep -q "^ParallelDownloads" /etc/pacman.conf; then | |
| # If exists uncommented, replace it | |
| sed -i 's/^ParallelDownloads.*/ParallelDownloads = 11/' /etc/pacman.conf | |
| elif grep -q "^#ParallelDownloads" /etc/pacman.conf; then | |
| # If exists commented, uncomment and set value | |
| sed -i 's/^#ParallelDownloads.*/ParallelDownloads = 11/' /etc/pacman.conf | |
| else | |
| # If not found, add after the [options] section | |
| sed -i '/^\[options\]/a ParallelDownloads = 11' /etc/pacman.conf | |
| fi | |
| # Update system | |
| echo "๐ฆ Updating system packages..." | |
| pacman -Syu --noconfirm | |
| # Install essential development tools | |
| echo "๐ ๏ธ Installing essential development tools..." | |
| pacman -S --noconfirm \ | |
| base-devel \ | |
| neovim \ | |
| chromium \ | |
| code \ | |
| docker \ | |
| python-pip \ | |
| nodejs \ | |
| github-cli \ | |
| glab \ | |
| yay \ | |
| timeshift-autosnap-manjaro | |
| # Enable Docker service (will start after reboot) | |
| echo "๐ณ Setting up Docker..." | |
| systemctl enable docker | |
| echo "โ ๏ธ Docker service enabled but requires a reboot to start properly" | |
| # Get the original user who ran sudo | |
| REAL_USER=$(logname || echo $SUDO_USER) | |
| REAL_HOME=$(getent passwd "$REAL_USER" | cut -d: -f6) | |
| # Add user to docker group so they can run docker without sudo | |
| echo "๐ค Adding user to docker group..." | |
| usermod -aG docker "$REAL_USER" | |
| # Set Neovim as default editor in user's shell profile | |
| echo "โ๏ธ Configuring shell environment..." | |
| if [ -f "$REAL_HOME/.zshrc" ]; then | |
| # Add to zshrc if not already present | |
| if ! grep -q "export EDITOR=nvim" "$REAL_HOME/.zshrc"; then | |
| echo 'export EDITOR=nvim' >> "$REAL_HOME/.zshrc" | |
| echo 'export VISUAL=nvim' >> "$REAL_HOME/.zshrc" | |
| fi | |
| fi | |
| # Configure global Git user settings | |
| echo "๐ง Configuring Git global settings..." | |
| su - "$REAL_USER" -c "git config --global user.name \"Bradley Pizzimenti\"" | |
| su - "$REAL_USER" -c "git config --global user.email \"[email protected]\"" | |
| # Install uBlock Origin for Firefox and Chromium | |
| echo "๐ก๏ธ Installing uBlock Origin extension..." | |
| # Firefox extension directory | |
| FIREFOX_EXTENSIONS_DIR="/usr/lib/firefox/browser/extensions" | |
| # Chromium extension directory | |
| CHROMIUM_EXTENSIONS_DIR="/usr/share/chromium/extensions" | |
| # Create extension directories if they don't exist | |
| mkdir -p "$FIREFOX_EXTENSIONS_DIR" | |
| mkdir -p "$CHROMIUM_EXTENSIONS_DIR" | |
| # uBlock Origin extension IDs | |
| UBLOCK_FIREFOX_ID="[email protected]" | |
| UBLOCK_CHROMIUM_ID="cjpalhdlnbpafiamejdnhcphjbkeiagm" | |
| # Firefox - Download and install uBlock Origin | |
| wget -q "https://addons.mozilla.org/firefox/downloads/file/4003969/ublock_origin-latest.xpi" -O "$FIREFOX_EXTENSIONS_DIR/$UBLOCK_FIREFOX_ID.xpi" | |
| chmod 644 "$FIREFOX_EXTENSIONS_DIR/$UBLOCK_FIREFOX_ID.xpi" | |
| # Chromium - Create extension manifest | |
| cat > "$CHROMIUM_EXTENSIONS_DIR/$UBLOCK_CHROMIUM_ID.json" << EOF | |
| { | |
| "external_update_url": "https://clients2.google.com/service/update2/crx" | |
| } | |
| EOF | |
| chmod 644 "$CHROMIUM_EXTENSIONS_DIR/$UBLOCK_CHROMIUM_ID.json" | |
| # Install AUR applications (as the regular user, not root) | |
| echo "๐ป Installing AUR applications..." | |
| # Temporarily allow the user to use sudo without a password | |
| echo "$REAL_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-temp-privileges | |
| chmod 440 /etc/sudoers.d/99-temp-privileges | |
| # Install AUR packages as the user | |
| su - "$REAL_USER" -c "yay -S --noconfirm cursor-bin 1password claude-code || echo 'โ ๏ธ AUR installation failed - install manually after reboot'" | |
| # Remove the temporary sudo privileges | |
| rm -f /etc/sudoers.d/99-temp-privileges | |
| # Cleanup | |
| echo "๐งน Cleaning up..." | |
| pacman -Sc --noconfirm | |
| # Configure GRUB for maximum verbosity and snapshot menu | |
| echo "โ๏ธ Configuring boot options..." | |
| # Remove "quiet" if present | |
| sed -i 's/quiet //g' /etc/default/grub | |
| # Set loglevel to 9 (maximum) | |
| if grep -q "loglevel=" /etc/default/grub; then | |
| # If loglevel exists, update it to 9 | |
| sed -i 's/loglevel=[0-9]/loglevel=9/g' /etc/default/grub | |
| sed -i 's/loglevel=debug/loglevel=9/g' /etc/default/grub | |
| else | |
| # If loglevel doesn't exist, add it to GRUB_CMDLINE_LINUX_DEFAULT | |
| sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="loglevel=9 /g' /etc/default/grub | |
| fi | |
| # Ensure menu is displayed for snapshots | |
| sed -i 's/GRUB_TIMEOUT_STYLE=.*/GRUB_TIMEOUT_STYLE=menu/g' /etc/default/grub | |
| # Configure snapshot submenu for GRUB | |
| if ! grep -q "^GRUB_BTRFS_SUBMENUNAME" /etc/default/grub; then | |
| echo 'GRUB_BTRFS_SUBMENUNAME="System Snapshots"' >> /etc/default/grub | |
| echo 'GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true"' >> /etc/default/grub | |
| fi | |
| # Update GRUB configuration | |
| update-grub | |
| # Create an initial snapshot if timeshift is installed | |
| if command -v timeshift >/dev/null; then | |
| echo "๐ธ Creating initial system snapshot..." | |
| timeshift --create --comments "Fresh Manjaro development setup" --yes | |
| fi | |
| echo "โจ Manjaro development environment setup complete!" | |
| echo "" | |
| echo "โ ๏ธ Please reboot your system for all changes to take effect." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment