166 lines
6.3 KiB
Bash
Executable file
166 lines
6.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Standard lactazora script stub
|
|
set -eo pipefail
|
|
|
|
if [[ -n "${BASHD_DEBUG}" ]]; then
|
|
set -x
|
|
fi
|
|
|
|
trap cleanup EXIT
|
|
trap 'echo -e "\nERROR: $BASH_COMMAND\nFILE: ${BASH_SOURCE[0]}\nLINE: ${BASH_LINENO[0]}\n" >&2; exit 1' ERR
|
|
|
|
cleanup() {
|
|
rm -f /tmp/*.deb /tmp/tsetup.*.tar.xz
|
|
}
|
|
|
|
# a useful function to grab the latest deb from a github repo
|
|
|
|
# Function to download the latest .deb file from a GitHub repo's releases
|
|
# Usage: download_latest_deb "owner/repo" "output_file" ["asset_pattern"]
|
|
# curtsey of Grok
|
|
download_latest_deb() {
|
|
local repo="$1" # GitHub repo (e.g., "Eugeny/tabby")
|
|
local output="$2" # Output file path (e.g., "/tmp/tabby_amd64.deb")
|
|
local pattern="$3" # Optional: regex pattern to filter assets (e.g., "tabby-.*-linux-x64\\.deb")
|
|
local api_url="https://api.github.com/repos/$repo/releases/latest"
|
|
local download_url
|
|
|
|
# Fetch the latest release JSON and extract the download URL for the .deb
|
|
download_url=$(curl -s -f "$api_url" | jq -r --arg pat "${pattern:-.*\\.deb}" \
|
|
'.assets[] | select(.name | test($pat)) | .browser_download_url' | head -n 1)
|
|
if [[ -z "$download_url" ]]; then
|
|
echo "Error: No .deb file found for $repo with pattern '$pattern' or API request failed" >&2
|
|
return 1
|
|
fi
|
|
|
|
# Download the .deb file
|
|
echo "Downloading $download_url to $output..."
|
|
if ! curl -sL -f "$download_url" -o "$output"; then
|
|
echo "Error: Failed to download $output" >&2
|
|
return 1
|
|
fi
|
|
echo "Successfully downloaded $output"
|
|
}
|
|
|
|
# System update and base tools
|
|
echo "Updating system and installing base tools..."
|
|
sudo apt update
|
|
sudo apt upgrade -y
|
|
sudo apt install curl git wget btrfs-progs jq -y
|
|
|
|
# Install Xanmod kernel
|
|
echo "Installing Xanmod kernel..."
|
|
# Ensure gnupg is installed for key management
|
|
sudo apt install gnupg -y
|
|
# Download and store the Xanmod GPG key in /etc/apt/keyrings
|
|
wget -qO - https://dl.xanmod.org/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/xanmod-keyring.gpg
|
|
# Add the Xanmod repository with signed-by
|
|
echo "deb [signed-by=/etc/apt/keyrings/xanmod-keyring.gpg] http://deb.xanmod.org releases main" | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
|
|
sudo apt update
|
|
sudo apt install linux-xanmod-x64v3 -y
|
|
# sudo update-grub Grok addded this but its not needed
|
|
|
|
# Homebrew
|
|
echo "Installing Homebrew..."
|
|
if [[ -z "$SUDO_USER" ]]; then
|
|
echo "Error: Script must be run with sudo by a non-root user (SUDO_USER not set)" >&2
|
|
exit 1
|
|
fi
|
|
# Run Homebrew installer as the original user
|
|
sudo -u "$SUDO_USER" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) --prefix=/opt/homebrew"
|
|
# Add Homebrew to the user's .bashrc
|
|
echo "eval \"\$(/opt/homebrew/bin/brew shellenv)\"" | sudo -u "$SUDO_USER" tee -a "/home/$SUDO_USER/.bashrc" > /dev/null
|
|
# Ensure Homebrew is available in the current session
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
|
|
# makedeb
|
|
echo "Installing makedeb..."
|
|
export MAKEDEB_RELEASE="makedeb"
|
|
if ! wget -q --spider https://shlink.makedeb.org/install; then
|
|
echo "makedeb URL failed" >&2
|
|
exit 1
|
|
fi
|
|
sudo -u "$SUDO_USER" bash -ci "$(wget -qO - 'https://shlink.makedeb.org/install')"
|
|
|
|
# Floorp
|
|
echo "Installing Floorp..."
|
|
curl -fsSL https://ppa.floorp.app/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/Floorp.gpg
|
|
sudo curl -sS --compressed -o /etc/apt/sources.list.d/Floorp.list "https://ppa.floorp.app/Floorp.list"
|
|
sudo apt update
|
|
sudo apt install floorp -y
|
|
|
|
# Signal
|
|
echo "Installing Signal..."
|
|
wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > /tmp/signal-desktop-keyring.gpg
|
|
sudo mv /tmp/signal-desktop-keyring.gpg /usr/share/keyrings/
|
|
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |\
|
|
sudo tee /etc/apt/sources.list.d/signal-xenial.list
|
|
sudo apt update
|
|
sudo apt install signal-desktop -y
|
|
|
|
|
|
# Discord
|
|
echo "Installing Discord..."
|
|
wget -O /tmp/discord.deb 'https://discord.com/api/download?platform=linux&format=deb'
|
|
sudo apt install /tmp/discord.deb -y
|
|
|
|
# Telegram
|
|
echo "Installing Telegram..."
|
|
wget https://td.telegram.org/tlinux/tsetup.5.11.1.tar.xz -O /tmp/tsetup.5.11.1.tar.xz
|
|
tar -xvf /tmp/tsetup.5.11.1.tar.xz -C /tmp
|
|
sudo mv /tmp/Telegram /opt/Telegram
|
|
sudo ln -sf /opt/Telegram/Telegram /usr/local/bin/telegram
|
|
rm -rf /tmp/Telegram
|
|
rm /tmp/tsetup.5.11.1.tar.xz
|
|
|
|
# Kopia
|
|
echo "Installing Kopia..."
|
|
curl -s https://kopia.io/signing-key | sudo gpg --dearmor -o /etc/apt/keyrings/kopia-keyring.gpg
|
|
echo "deb [signed-by=/etc/apt/keyrings/kopia-keyring.gpg] http://packages.kopia.io/apt/ stable main" | sudo tee /etc/apt/sources.list.d/kopia.list
|
|
sudo apt update
|
|
sudo apt install kopia kopia-ui -y
|
|
|
|
# Steam
|
|
echo "Installing Steam..."
|
|
wget https://cdn.cloudflare.steamstatic.com/client/installer/steam.deb -O /tmp/steam.deb
|
|
sudo apt install /tmp/steam.deb -y
|
|
|
|
# NVM and Node.js
|
|
echo "Installing NVM and Node.js..."
|
|
sudo -u "$SUDO_USER" wget -O /tmp/nvm.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh
|
|
sudo -Hu "$SUDO_USER" bash /tmp/nvm.sh
|
|
rm /tmp/nvm.sh
|
|
#sudo -u "$SUDO_USER" . ~/.nvm/nvm.sh
|
|
#sudo -u "$SUDO_USER" nvm install --lts
|
|
# not sure why these other lines are here, I'll have to check
|
|
|
|
# Bun
|
|
echo "Installing Bun..."
|
|
sudo -u "$SUDO_USER" wget -O /tmp/bun.sh https://bun.sh/install
|
|
sudo -Hu "$SUDO_USER" bash /tmp/bun.sh
|
|
rm /tmp/bun.sh
|
|
|
|
# Joplin
|
|
sudo -u "$SUDO_USER" wget -O /tmp/joplin_install.sh https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh
|
|
sudo -Hu "$SUDO_USER" bash /tmp/joplin_install.sh
|
|
rm /tmp/joplin_install.sh
|
|
|
|
# Tabby
|
|
echo "Installing Tabby..."
|
|
download_latest_deb "Eugeny/tabby" "/tmp/tabby_amd64.deb" "tabby-.*-linux-x64\\.deb"
|
|
if [[ -f "/tmp/tabby_amd64.deb" ]]; then
|
|
sudo apt install /tmp/tabby_amd64.deb -y
|
|
else
|
|
echo "Error: Tabby .deb file not found at /tmp/tabby_amd64.deb" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Windsurf
|
|
|
|
curl -fsSL "https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/windsurf.gpg" | sudo gpg --dearmor -o /usr/share/keyrings/windsurf-stable-archive-keyring.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/windsurf-stable-archive-keyring.gpg arch=amd64] https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/apt stable main" | sudo tee /etc/apt/sources.list.d/windsurf.list > /dev/null
|
|
sudo apt update
|
|
sudo apt upgrade windsurf -y
|
|
|
|
echo "Setup complete!"
|