Skip to content

Instantly share code, notes, and snippets.

@ashleydavis
Last active June 9, 2025 00:23
Show Gist options
  • Save ashleydavis/11363de4501ea641f0a18f69ab7eb443 to your computer and use it in GitHub Desktop.
Save ashleydavis/11363de4501ea641f0a18f69ab7eb443 to your computer and use it in GitHub Desktop.
Script for tools setup on Ubuntu Linux.

Development Tools Manager

A comprehensive shell script for managing development tools on Ubuntu 24. Install, update, list, and uninstall your essential development tools with a single command. Now supports 16 tools including JSON processing capabilities, HTTP clients, Microsoft enterprise tools, and remote access solutions.

Features

  • 🚀 One-command installation for all your development tools
  • 📋 Status overview showing installed/missing tools and versions
  • 🔄 Individual tool management - install, update, or remove specific tools
  • 🧹 Clean uninstallation with proper cleanup of repositories and keys
  • ⚡ Smart detection to avoid duplicate installations
  • 🎨 Color-coded output for better readability
  • 🔧 Smart dependencies - automatically installs required tools like jq for JSON processing and curl for HTTP requests

Installation

Run Directly (Recommended)

# Download and run the script directly without saving locally
bash <(wget -qO- https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh)

Alternative Direct Execution

Using curl:

# Download and run with curl
bash <(curl -s https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh)

Save Script Locally (Optional)

If you prefer to save the script for repeated use:

# Download the script using wget
wget -O tools.sh https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh

# Make the script executable
chmod +x tools.sh

Quick Start

# Install all development tools directly
bash <(wget -qO- https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh) all

# Check what's installed
bash <(wget -qO- https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh) ls

# Install specific tools
bash <(wget -qO- https://gist.githubusercontent.com/ashleydavis/11363de4501ea641f0a18f69ab7eb443/raw/d77c1677a1fd36add8ca2de502d7d7a828ff107c/tools.sh) chrome

Usage

Basic Commands

./tools.sh [command|tool|all|ls|uninstall]

Examples

# Install all tools at once
./tools.sh all

# Install specific tools
./tools.sh chrome
./tools.sh vscode
./tools.sh git

# List all tools and their status
./tools.sh ls

# Uninstall specific tools
./tools.sh uninstall chrome
./tools.sh uninstall slack

# Show help
./tools.sh help

Supported Tools

Command Tool Description
chrome Google Chrome Popular web browser
vscode Visual Studio Code Microsoft's code editor
cursor Cursor AI Editor AI-powered code editor
git Git Version control system
gh GitHub CLI GitHub command-line interface
meld Meld Visual diff and merge tool
sourcegit SourceGit Git GUI client

| zoom | Zoom | Video conferencing | | slack | Slack | Team communication | | terraform | Terraform | Infrastructure as code | | awscli | AWS CLI | Amazon Web Services CLI |

Command Reference

Install All Tools

./tools.sh all

Installs all supported development tools. Skips tools that are already installed.

Install Individual Tools

./tools.sh <tool-name>

Installs or updates a specific tool. Example:

./tools.sh vscode
./tools.sh terraform

List Tools Status

./tools.sh ls

Shows a comprehensive table with:

  • Tool command name
  • Full tool name
  • Installation status (INSTALLED/MISSING)
  • Version information for installed tools

Sample output:

=== Development Tools Status ===

TOOL         NAME                 STATUS     VERSION
----         ----                 ------     -------
jq           jq JSON processor    INSTALLED  1.6
curl         curl HTTP client     INSTALLED  7.81.0
chrome       Google Chrome        INSTALLED  119.0.6045.105
edge         Microsoft Edge       INSTALLED  120.0.2210.91
vscode       Visual Studio Code   INSTALLED  1.84.2
git          Git                  INSTALLED  2.43.0
terraform    Terraform           MISSING    -
intune       Microsoft Intune Company Portal  MISSING    -
teamviewer   TeamViewer          MISSING    -

Show Download Sources

./tools.sh sources

Displays where each tool is downloaded from:

  • Official repositories
  • Direct download URLs
  • GitHub releases

Sample output:

=== Download Sources for Development Tools ===

TOOL         NAME                 DOWNLOAD SOURCE
----         ----                 ---------------
jq           jq JSON processor    Ubuntu APT repositories
curl         curl HTTP client     Ubuntu APT repositories
chrome       Google Chrome        https://dl.google.com/linux/chrome/deb/
edge         Microsoft Edge       https://packages.microsoft.com/repos/edge
vscode       Visual Studio Code   https://packages.microsoft.com/repos/code
cursor       Cursor AI Editor     https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable
intune       Microsoft Intune Company Portal  https://packages.microsoft.com/ubuntu/prod
teamviewer   TeamViewer          https://download.teamviewer.com/download/linux/teamviewer_amd64.deb

Uninstall Tools

./tools.sh uninstall <tool-name>

Cleanly removes a tool and its associated repositories/keys. Example:

./tools.sh uninstall chrome
./tools.sh uninstall vscode

Help

./tools.sh help
./tools.sh --help
./tools.sh -h

Displays usage information and available commands.

What Each Tool Installation Does

Repository-based Tools

For tools like Chrome, Microsoft Edge, VS Code, GitHub CLI, Terraform, Microsoft Intune, and system tools (Git, Meld, jq, curl), the script:

  1. Adds official GPG keys
  2. Adds official repositories
  3. Updates package lists
  4. Installs via APT
  5. Ensures automatic updates through the system package manager

Direct Download Tools

For tools like Cursor, SourceGit, Zoom, Slack, and TeamViewer, the script:

  1. Downloads the latest .deb package
  2. Installs using dpkg
  3. Resolves dependencies automatically
  4. Cleans up downloaded files

Special Cases

  • AWS CLI: Installed via the official installer script
  • Git: Installed from Ubuntu repositories
  • Meld: Installed from Ubuntu repositories
  • jq: Installed from Ubuntu repositories (auto-installed as dependency)
  • curl: Installed from Ubuntu repositories (auto-installed as dependency)
  • Cursor: Uses JSON API to get latest download URL, then installs AppImage
  • SourceGit: Uses GitHub API with JSON parsing to get latest release
  • Microsoft Intune: Uses Microsoft's official Ubuntu repository with proper key management

Requirements

  • Ubuntu 24.04 (or compatible Debian-based distribution)
  • sudo privileges for installing packages
  • Internet connection for downloading packages and repositories

Troubleshooting

Permission Denied

chmod +x tools.sh

Tool Already Installed

The script detects existing installations and will offer to reinstall:

[WARN] Visual Studio Code is already installed. Reinstalling...

Installation Failures

The script uses set -e to exit on errors. If an installation fails:

  1. Check your internet connection
  2. Ensure you have sudo privileges
  3. Try running the specific tool installation again
  4. Check the error output for specific issues

Dependency Issues

If you encounter dependency issues with .deb packages:

sudo apt-get install -f

Updating Tools

Repository-based Tools

Tools installed via repositories (Chrome, Edge, VS Code, Intune, etc.) will automatically update through:

sudo apt update && sudo apt upgrade

Manual Updates

For tools installed via direct download, simply run the install command again:

./tools.sh cursor
./tools.sh sourcegit
./tools.sh teamviewer

Customization

To add new tools, modify the script by:

  1. Adding an entry to the TOOLS associative array
  2. Creating install_<toolname>() and uninstall_<toolname>() functions
  3. Adding detection logic to is_installed() and get_version()

Security Notes

  • The script downloads packages from official sources only
  • GPG keys are verified for repository-based installations
  • All downloads use HTTPS connections
  • Temporary files are cleaned up after installation

Contributing

Feel free to submit issues or pull requests to add support for additional development tools or improve existing functionality.

License

This script is provided as-is for educational and convenience purposes. Each installed tool has its own license terms.

#!/bin/bash
# Development Tools Manager for Ubuntu 24
# Usage: ./dev-tools-manager.sh [command|all|ls|uninstall]
# Examples:
# ./dev-tools-manager.sh all # Install all tools
# ./dev-tools-manager.sh chrome # Install/update Chrome
# ./dev-tools-manager.sh ls # List installed/missing tools
# ./dev-tools-manager.sh uninstall chrome # Uninstall Chrome
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Tool definitions
declare -A TOOLS=(
["jq"]="jq JSON processor"
["curl"]="curl HTTP client"
["chrome"]="Google Chrome"
["edge"]="Microsoft Edge"
["vscode"]="Visual Studio Code"
["cursor"]="Cursor AI Editor"
["git"]="Git"
["gh"]="GitHub CLI"
["meld"]="Meld"
["sourcegit"]="SourceGit"
["zoom"]="Zoom"
["slack"]="Slack"
["terraform"]="Terraform"
["awscli"]="AWS CLI"
["intune"]="Microsoft Intune Company Portal"
["teamviewer"]="TeamViewer"
)
# Function to print colored output
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo -e "${BLUE}=== $1 ===${NC}"
}
# Function to check if a tool is installed
is_installed() {
case $1 in
"jq")
command -v jq &> /dev/null
;;
"curl")
command -v curl &> /dev/null
;;
"chrome")
command -v google-chrome &> /dev/null
;;
"edge")
command -v microsoft-edge &> /dev/null
;;
"vscode")
command -v code &> /dev/null
;;
"cursor")
[ -f "/opt/cursor/cursor.AppImage" ] || command -v cursor &> /dev/null
;;
"git")
command -v git &> /dev/null
;;
"gh")
command -v gh &> /dev/null
;;
"meld")
command -v meld &> /dev/null
;;
"sourcegit")
[ -f "/opt/sourcegit/SourceGit" ] || command -v sourcegit &> /dev/null
;;
"zoom")
command -v zoom &> /dev/null
;;
"slack")
command -v slack &> /dev/null
;;
"terraform")
command -v terraform &> /dev/null
;;
"awscli")
command -v aws &> /dev/null
;;
"intune")
command -v intune-portal &> /dev/null
;;
"teamviewer")
command -v teamviewer &> /dev/null
;;
*)
return 1
;;
esac
}
# Function to get version of installed tool
get_version() {
case $1 in
"jq")
jq --version 2>/dev/null | sed 's/jq-//'
;;
"curl")
curl --version 2>/dev/null | head -n1 | cut -d' ' -f2
;;
"chrome")
google-chrome --version 2>/dev/null | cut -d' ' -f3
;;
"edge")
microsoft-edge --version 2>/dev/null | cut -d' ' -f3
;;
"vscode")
code --version 2>/dev/null | head -n1
;;
"cursor")
cursor --version 2>/dev/null | head -n1
;;
"git")
git --version 2>/dev/null | cut -d' ' -f3
;;
"gh")
gh --version 2>/dev/null | head -n1 | cut -d' ' -f3
;;
"meld")
meld --version 2>/dev/null | cut -d' ' -f2
;;
"sourcegit")
echo "Unknown"
;;
"zoom")
echo "Unknown"
;;
"slack")
echo "Unknown"
;;
"terraform")
terraform --version 2>/dev/null | head -n1 | cut -d' ' -f2 | sed 's/v//'
;;
"awscli")
aws --version 2>/dev/null | cut -d' ' -f1 | cut -d'/' -f2
;;
"intune")
echo "Unknown"
;;
"teamviewer")
teamviewer --version 2>/dev/null | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1
;;
*)
echo "Unknown"
;;
esac
}
# Installation functions
install_jq() {
print_header "Installing jq JSON processor"
sudo apt update
sudo apt install -y jq
print_status "jq JSON processor installed successfully"
}
install_curl() {
print_header "Installing curl HTTP client"
sudo apt update
sudo apt install -y curl
print_status "curl HTTP client installed successfully"
}
install_chrome() {
print_header "Installing Google Chrome"
sudo apt update
sudo apt install -y wget curl gpg
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update
sudo apt install -y google-chrome-stable
print_status "Google Chrome installed successfully"
}
install_edge() {
print_header "Installing Microsoft Edge"
sudo apt update
sudo apt install -y wget curl gpg
# Add Microsoft signing key
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/microsoft-edge-keyring.gpg > /dev/null
# Add Microsoft Edge repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-edge-keyring.gpg] https://packages.microsoft.com/repos/edge stable main" | sudo tee /etc/apt/sources.list.d/microsoft-edge.list
# Update package lists and install Edge
sudo apt update
sudo apt install -y microsoft-edge-stable
print_status "Microsoft Edge installed successfully"
}
install_vscode() {
print_header "Installing Visual Studio Code"
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install -y code
rm packages.microsoft.gpg
print_status "Visual Studio Code installed successfully"
}
install_cursor() {
print_header "Installing Cursor AI Editor"
# Install dependencies
sudo apt update
sudo apt install -y wget curl libfuse2
# Ensure jq is installed for JSON parsing
if ! command -v jq &> /dev/null; then
print_status "Installing jq for JSON parsing..."
install_jq
fi
# Create installation directory
sudo mkdir -p /opt/cursor
# Get the real download URL from the API
print_status "Fetching Cursor download URL from API..."
API_RESPONSE=$(curl -s "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable")
if [[ -z "$API_RESPONSE" ]]; then
print_error "Failed to fetch download information from Cursor API"
return 1
fi
# Extract the download URL from the JSON response
DOWNLOAD_URL=$(echo "$API_RESPONSE" | jq -r '.downloadUrl')
if [[ -z "$DOWNLOAD_URL" || "$DOWNLOAD_URL" == "null" ]]; then
print_error "Failed to extract download URL from API response"
return 1
fi
print_status "Download URL: $DOWNLOAD_URL"
# Download the Cursor AppImage using the extracted URL
print_status "Downloading Cursor AppImage..."
sudo wget -O /opt/cursor/cursor.AppImage "$DOWNLOAD_URL"
# Check if download was successful and file is not empty
if [[ ! -f "/opt/cursor/cursor.AppImage" || ! -s "/opt/cursor/cursor.AppImage" ]]; then
print_error "Download failed or file is empty"
return 1
fi
# Make executable
sudo chmod +x /opt/cursor/cursor.AppImage
# Download icon
print_status "Downloading Cursor icon..."
if ! sudo wget -O /opt/cursor/cursor.png "https://www.cursor.com/apple-touch-icon.png" 2>/dev/null; then
# Create a simple fallback icon if download fails
print_warning "Icon download failed, creating fallback icon"
sudo cp /usr/share/pixmaps/text-editor.png /opt/cursor/cursor.png 2>/dev/null || \
sudo touch /opt/cursor/cursor.png
fi
# Create desktop entry
print_status "Creating desktop entry..."
sudo tee /usr/share/applications/cursor.desktop > /dev/null <<EOF
[Desktop Entry]
Name=Cursor
Comment=AI-powered code editor
Exec=/opt/cursor/cursor.AppImage --no-sandbox %F
Icon=/opt/cursor/cursor.png
Terminal=false
Type=Application
Categories=Development;IDE;TextEditor;
StartupWMClass=Cursor
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
EOF
# Create symlink for command line access
print_status "Creating command line symlink..."
sudo ln -sf /opt/cursor/cursor.AppImage /usr/local/bin/cursor
# Update desktop database
sudo update-desktop-database /usr/share/applications/ 2>/dev/null || true
print_status "Cursor AI Editor installed successfully"
print_status "You can launch it from applications menu or run 'cursor' in terminal"
}
install_git() {
print_header "Installing Git"
sudo apt update
sudo apt install -y git
print_status "Git installed successfully"
}
install_gh() {
print_header "Installing GitHub CLI"
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install -y gh
print_status "GitHub CLI installed successfully"
}
install_meld() {
print_header "Installing Meld"
sudo apt update
sudo apt install -y meld
print_status "Meld installed successfully"
}
install_sourcegit() {
print_header "Installing SourceGit"
# Install dependencies
sudo apt update
sudo apt install -y wget curl
# Ensure jq is installed for JSON parsing
if ! command -v jq &> /dev/null; then
print_status "Installing jq for JSON parsing..."
install_jq
fi
# Get the latest release URL from GitHub API with proper error handling
print_status "Fetching latest SourceGit release information..."
LATEST_URL=$(curl -s https://api.github.com/repos/sourcegit-scm/sourcegit/releases/latest | jq -r '.assets[] | select(.name | test(".*linux.*\\.deb$")) | .browser_download_url' | head -1)
# Check if we got a valid URL
if [[ -z "$LATEST_URL" || "$LATEST_URL" == "null" ]]; then
print_error "Failed to fetch latest release URL from GitHub API"
print_status "Trying fallback download method..."
# Fallback to a known working version
LATEST_URL="https://github.com/sourcegit-scm/sourcegit/releases/download/v8.29/sourcegit_8.29-1_amd64.deb"
fi
print_status "Downloading from: $LATEST_URL"
wget -O sourcegit.deb "$LATEST_URL"
# Check if download was successful
if [[ ! -f "sourcegit.deb" || ! -s "sourcegit.deb" ]]; then
print_error "Download failed or file is empty"
rm -f sourcegit.deb
return 1
fi
# Install the package
sudo dpkg -i sourcegit.deb || sudo apt-get install -f -y
rm sourcegit.deb
print_status "SourceGit installed successfully"
}
install_zoom() {
print_header "Installing Zoom"
wget -O zoom.deb "https://zoom.us/client/latest/zoom_amd64.deb"
sudo dpkg -i zoom.deb || sudo apt-get install -f -y
rm zoom.deb
print_status "Zoom installed successfully"
}
install_slack() {
print_header "Installing Slack"
wget -O slack.deb "https://downloads.slack-edge.com/releases/linux/4.36.140/prod/x64/slack-desktop-4.36.140-amd64.deb"
sudo dpkg -i slack.deb || sudo apt-get install -f -y
rm slack.deb
print_status "Slack installed successfully"
}
install_terraform() {
print_header "Installing Terraform"
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt install -y terraform
print_status "Terraform installed successfully"
}
install_awscli() {
print_header "Installing AWS CLI"
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install -y unzip
unzip awscliv2.zip
sudo ./aws/install --update
rm -rf awscliv2.zip aws/
print_status "AWS CLI installed successfully"
}
install_teamviewer() {
print_header "Installing TeamViewer"
# Install dependencies
sudo apt update
sudo apt install -y wget
# Download TeamViewer .deb package
print_status "Downloading TeamViewer package..."
wget -O teamviewer.deb "https://download.teamviewer.com/download/linux/teamviewer_amd64.deb"
# Check if download was successful
if [[ ! -f "teamviewer.deb" || ! -s "teamviewer.deb" ]]; then
print_error "Download failed or file is empty"
rm -f teamviewer.deb
return 1
fi
# Install TeamViewer
print_status "Installing TeamViewer..."
sudo apt install -y ./teamviewer.deb
# Clean up downloaded file
rm teamviewer.deb
print_status "TeamViewer installed successfully"
print_status "During first launch, you'll need to accept the license agreement"
}
print_header "Installing Microsoft Intune Company Portal"
# Install dependencies first
sudo apt update
sudo apt install -y curl gpg
# Install Microsoft package signing key
print_status "Installing Microsoft package signing key..."
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/
rm microsoft.gpg
# Add Microsoft Linux Repository
print_status "Adding Microsoft Linux Repository..."
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/prod $(lsb_release -cs) main" >> /etc/apt/sources.list.d/microsoft-ubuntu-$(lsb_release -cs)-prod.list'
# Update package lists
sudo apt update
# Install Intune portal
print_status "Installing Microsoft Intune Company Portal..."
sudo apt install -y intune-portal
install_intune() {
print_header "Installing Microsoft Intune Company Portal"
# Install dependencies first
sudo apt update
sudo apt install -y curl gpg
# Install Microsoft package signing key
print_status "Installing Microsoft package signing key..."
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/
rm microsoft.gpg
# Add Microsoft Linux Repository
print_status "Adding Microsoft Linux Repository..."
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/prod $(lsb_release -cs) main" >> /etc/apt/sources.list.d/microsoft-ubuntu-$(lsb_release -cs)-prod.list'
# Update package lists
sudo apt update
# Install Intune portal
print_status "Installing Microsoft Intune Company Portal..."
sudo apt install -y intune-portal
print_status "Microsoft Intune Company Portal installed successfully"
print_warning "A system reboot is recommended to complete the installation"
}
# Uninstall functions
uninstall_jq() {
print_header "Uninstalling jq JSON processor"
sudo apt remove -y jq
print_status "jq JSON processor uninstalled successfully"
}
uninstall_curl() {
print_header "Uninstalling curl HTTP client"
sudo apt remove -y curl
print_status "curl HTTP client uninstalled successfully"
}
uninstall_chrome() {
print_header "Uninstalling Google Chrome"
sudo apt remove -y google-chrome-stable
sudo rm -f /etc/apt/sources.list.d/google-chrome.list
sudo rm -f /usr/share/keyrings/google-chrome-keyring.gpg
print_status "Google Chrome uninstalled successfully"
}
uninstall_edge() {
print_header "Uninstalling Microsoft Edge"
sudo apt remove -y microsoft-edge-stable
sudo rm -f /etc/apt/sources.list.d/microsoft-edge.list
sudo rm -f /usr/share/keyrings/microsoft-edge-keyring.gpg
print_status "Microsoft Edge uninstalled successfully"
}
uninstall_vscode() {
print_header "Uninstalling Visual Studio Code"
sudo apt remove -y code
sudo rm -f /etc/apt/sources.list.d/vscode.list
sudo rm -f /etc/apt/trusted.gpg.d/packages.microsoft.gpg
print_status "Visual Studio Code uninstalled successfully"
}
uninstall_cursor() {
print_header "Uninstalling Cursor AI Editor"
sudo rm -f /opt/cursor/cursor.AppImage
sudo rm -f /opt/cursor/cursor.png
sudo rm -f /usr/share/applications/cursor.desktop
sudo rm -f /usr/local/bin/cursor
sudo rmdir /opt/cursor 2>/dev/null || true
sudo update-desktop-database /usr/share/applications/
print_status "Cursor AI Editor uninstalled successfully"
}
uninstall_git() {
print_header "Uninstalling Git"
sudo apt remove -y git
print_status "Git uninstalled successfully"
}
uninstall_gh() {
print_header "Uninstalling GitHub CLI"
sudo apt remove -y gh
sudo rm -f /etc/apt/sources.list.d/github-cli.list
sudo rm -f /usr/share/keyrings/githubcli-archive-keyring.gpg
print_status "GitHub CLI uninstalled successfully"
}
uninstall_meld() {
print_header "Uninstalling Meld"
sudo apt remove -y meld
print_status "Meld uninstalled successfully"
}
uninstall_sourcegit() {
print_header "Uninstalling SourceGit"
sudo apt remove -y sourcegit
print_status "SourceGit uninstalled successfully"
}
uninstall_zoom() {
print_header "Uninstalling Zoom"
sudo apt remove -y zoom
print_status "Zoom uninstalled successfully"
}
uninstall_slack() {
print_header "Uninstalling Slack"
sudo apt remove -y slack-desktop
print_status "Slack uninstalled successfully"
}
uninstall_terraform() {
print_header "Uninstalling Terraform"
sudo apt remove -y terraform
sudo rm -f /etc/apt/sources.list.d/hashicorp.list
sudo rm -f /usr/share/keyrings/hashicorp-archive-keyring.gpg
print_status "Terraform uninstalled successfully"
}
uninstall_awscli() {
print_header "Uninstalling AWS CLI"
sudo rm -rf /usr/local/aws-cli
sudo rm -f /usr/local/bin/aws
sudo rm -f /usr/local/bin/aws_completer
print_status "AWS CLI uninstalled successfully"
}
uninstall_teamviewer() {
print_header "Uninstalling TeamViewer"
sudo apt remove -y teamviewer
print_status "TeamViewer uninstalled successfully"
}
uninstall_intune() {
print_header "Uninstalling Microsoft Intune Company Portal"
# Remove the Intune app
sudo apt remove -y intune-portal
# Remove local registration data (purge)
print_status "Removing local registration data..."
sudo apt purge -y intune-portal
# Clean up Microsoft repository and signing key
print_status "Cleaning up Microsoft repository..."
sudo rm -f /etc/apt/sources.list.d/microsoft-ubuntu-*-prod.list
sudo rm -f /usr/share/keyrings/microsoft.gpg
print_status "Microsoft Intune Company Portal uninstalled successfully"
}
# Function to install a tool
install_tool() {
local tool=$1
case $tool in
"jq") install_jq ;;
"curl") install_curl ;;
"chrome") install_chrome ;;
"edge") install_edge ;;
"vscode") install_vscode ;;
"cursor") install_cursor ;;
"git") install_git ;;
"gh") install_gh ;;
"meld") install_meld ;;
"sourcegit") install_sourcegit ;;
"zoom") install_zoom ;;
"slack") install_slack ;;
"terraform") install_terraform ;;
"awscli") install_awscli ;;
"intune") install_intune ;;
"teamviewer") install_teamviewer ;;
*)
print_error "Unknown tool: $tool"
return 1
;;
esac
}
# Function to uninstall a tool
uninstall_tool() {
local tool=$1
case $tool in
"jq") uninstall_jq ;;
"curl") uninstall_curl ;;
"chrome") uninstall_chrome ;;
"edge") uninstall_edge ;;
"vscode") uninstall_vscode ;;
"cursor") uninstall_cursor ;;
"git") uninstall_git ;;
"gh") uninstall_gh ;;
"meld") uninstall_meld ;;
"sourcegit") uninstall_sourcegit ;;
"zoom") uninstall_zoom ;;
"slack") uninstall_slack ;;
"terraform") uninstall_terraform ;;
"awscli") uninstall_awscli ;;
"intune") uninstall_intune ;;
"teamviewer") uninstall_teamviewer ;;
*)
print_error "Unknown tool: $tool"
return 1
;;
esac
}
# Function to list all tools and their status
show_sources() {
print_header "Download Sources for Development Tools"
echo
printf "%-12s %-20s %s\n" "TOOL" "NAME" "DOWNLOAD SOURCE"
printf "%-12s %-20s %s\n" "----" "----" "---------------"
printf "%-12s %-20s %s\n" "jq" "jq JSON processor" "Ubuntu APT repositories"
printf "%-12s %-20s %s\n" "curl" "curl HTTP client" "Ubuntu APT repositories"
printf "%-12s %-20s %s\n" "chrome" "Google Chrome" "https://dl.google.com/linux/chrome/deb/"
printf "%-12s %-20s %s\n" "edge" "Microsoft Edge" "https://packages.microsoft.com/repos/edge"
printf "%-12s %-20s %s\n" "vscode" "Visual Studio Code" "https://packages.microsoft.com/repos/code"
printf "%-12s %-20s %s\n" "cursor" "Cursor AI Editor" "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable"
printf "%-12s %-20s %s\n" "git" "Git" "Ubuntu APT repositories"
printf "%-12s %-20s %s\n" "gh" "GitHub CLI" "https://cli.github.com/packages"
printf "%-12s %-20s %s\n" "meld" "Meld" "Ubuntu APT repositories"
printf "%-12s %-20s %s\n" "sourcegit" "SourceGit" "https://github.com/sourcegit-scm/sourcegit/releases/latest"
printf "%-12s %-20s %s\n" "zoom" "Zoom" "https://zoom.us/client/latest/zoom_amd64.deb"
printf "%-12s %-20s %s\n" "slack" "Slack" "https://downloads.slack-edge.com/releases/linux/"
printf "%-12s %-20s %s\n" "terraform" "Terraform" "https://apt.releases.hashicorp.com"
printf "%-12s %-20s %s\n" "awscli" "AWS CLI" "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
printf "%-12s %-20s %s\n" "intune" "Microsoft Intune Company Portal" "https://packages.microsoft.com/ubuntu/prod"
printf "%-12s %-20s %s\n" "teamviewer" "TeamViewer" "https://download.teamviewer.com/download/linux/teamviewer_amd64.deb"
echo
}
list_tools() {
print_header "Development Tools Status"
echo
printf "%-12s %-20s %-10s %s\n" "TOOL" "NAME" "STATUS" "VERSION"
printf "%-12s %-20s %-10s %s\n" "----" "----" "------" "-------"
for tool in "${!TOOLS[@]}"; do
name="${TOOLS[$tool]}"
if is_installed "$tool"; then
version=$(get_version "$tool")
printf "%-12s %-20s ${GREEN}%-10s${NC} %s\n" "$tool" "$name" "INSTALLED" "$version"
else
printf "%-12s %-20s ${RED}%-10s${NC} %s\n" "$tool" "$name" "MISSING" "-"
fi
done
echo
}
# Function to install all tools
install_all() {
print_header "Installing All Development Tools"
# Install jq first as it's needed by other tools
if ! is_installed "jq"; then
echo
install_tool "jq"
fi
# Install curl early as it's needed by many tools
if ! is_installed "curl"; then
echo
install_tool "curl"
fi
# Install remaining tools
for tool in "${!TOOLS[@]}"; do
if [[ "$tool" != "jq" && "$tool" != "curl" ]] && ! is_installed "$tool"; then
echo
install_tool "$tool"
elif [[ "$tool" != "jq" && "$tool" != "curl" ]]; then
print_warning "${TOOLS[$tool]} is already installed"
fi
done
echo
print_status "All tools installation completed!"
}
# Function to show usage
show_usage() {
echo "Development Tools Manager for Ubuntu 24"
echo
echo "Usage: $0 [command]"
echo
echo "Commands:"
echo " all Install all tools"
echo " ls List all tools and their status"
echo " sources Show download sources for all tools"
echo " uninstall <tool> Uninstall a specific tool"
echo
echo "Available tools:"
for tool in "${!TOOLS[@]}"; do
printf " %-12s %s\n" "$tool" "${TOOLS[$tool]}"
done
echo
echo "Examples:"
echo " $0 all # Install all tools"
echo " $0 chrome # Install/update Chrome"
echo " $0 ls # List installed/missing tools"
echo " $0 sources # Show download sources"
echo " $0 uninstall chrome # Uninstall Chrome"
}
# Main script logic
main() {
if [ $# -eq 0 ]; then
show_usage
exit 0
fi
case $1 in
"all")
install_all
;;
"ls"|"list")
list_tools
;;
"sources"|"source")
show_sources
;;
"uninstall")
if [ $# -ne 2 ]; then
print_error "Usage: $0 uninstall <tool>"
exit 1
fi
if [[ ! -v TOOLS[$2] ]]; then
print_error "Unknown tool: $2"
exit 1
fi
if is_installed "$2"; then
uninstall_tool "$2"
else
print_warning "${TOOLS[$2]} is not installed"
fi
;;
"help"|"-h"|"--help")
show_usage
;;
*)
if [[ -v TOOLS[$1] ]]; then
if is_installed "$1"; then
print_warning "${TOOLS[$1]} is already installed. Reinstalling..."
fi
install_tool "$1"
else
print_error "Unknown command: $1"
show_usage
exit 1
fi
;;
esac
}
# Run main function with all arguments
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment