|
#!/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 "$@" |