From 7c274a8b7ab166b4614e3d7625209aecc819c8a3 Mon Sep 17 00:00:00 2001 From: kake26 Date: Wed, 23 Apr 2025 20:59:08 -0500 Subject: [PATCH] Add new package manager and enhance master setup with Xanmod kernel --- github_package_update.bash | 46 +++++++++ mastersetup.bash | 186 ++++++++++++++++++++++--------------- 2 files changed, 159 insertions(+), 73 deletions(-) create mode 100644 github_package_update.bash diff --git a/github_package_update.bash b/github_package_update.bash new file mode 100644 index 0000000..7b8cdaf --- /dev/null +++ b/github_package_update.bash @@ -0,0 +1,46 @@ +#!/bin/bash + +# Function to check and pull the latest version of a package from GitHub +check_and_update_package() { + local repo_owner="$1" + local repo_name="$2" + local local_path="$3" + + echo "Checking for updates for $repo_name..." + + # Get the latest release info from GitHub API + latest_release=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/latest") + latest_version=$(echo "$latest_release" | grep -oP '(?<="tag_name": ")([^"]+)') + + if [ -z "$latest_version" ]; then + echo "Failed to fetch latest version for $repo_name." + return 1 + fi + + # Check if the package is already installed at the local path + if [ -d "$local_path" ]; then + # Check if the installed version matches the latest + current_version=$(cd "$local_path" && git describe --tags 2>/dev/null || echo 'unknown') + if [ "$current_version" == "$latest_version" ]; then + echo "$repo_name is already up to date (version: $current_version)." + return 0 + else + echo "Updating $repo_name from version $current_version to $latest_version..." + cd "$local_path" && git pull origin "$latest_version" + fi + else + echo "Installing $repo_name version $latest_version..." + git clone "https://github.com/$repo_owner/$repo_name.git" "$local_path" + cd "$local_path" && git checkout "$latest_version" + fi + + if [ $? -eq 0 ]; then + echo "$repo_name has been updated to version $latest_version." + else + echo "Failed to update $repo_name." + return 1 + fi +} + +# Example usage: +# check_and_update_package 'owner' 'repository' '/path/to/install' diff --git a/mastersetup.bash b/mastersetup.bash index bf2b8ac..0a8c82c 100644 --- a/mastersetup.bash +++ b/mastersetup.bash @@ -1,111 +1,151 @@ #!/bin/bash -# standard lactazora script stub +# Standard lactazora script stub +set -eo pipefail -set -eo pipefail #these can cause problems when you want stuff to keep going - -if [[ -n "${BASHD_DEBUG}" ]]; then # a inevitability that this will be used +if [[ -n "${BASHD_DEBUG}" ]]; then set -x fi -trap cleanup EXIT # A little more robust cleanup - -# trap errors and set the ERR trap +trap cleanup EXIT trap 'echo -e "\nERROR: $BASH_COMMAND\nFILE: ${BASH_SOURCE[0]}\nLINE: ${BASH_LINENO[0]}\n" >&2; exit 1' ERR cleanup() { - # We can clean up any temp files or what nots, but for now a place holder - true + rm -f /tmp/*.deb /tmp/tsetup.*.tar.xz } -# end stub +# a useful function to grab the latest deb from a github repo -# Will setup anything debian based +# 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., "TabbyML/tabby") + local output="$2" # Output file path (e.g., "tabby.deb") + local pattern="$3" # Optional: regex pattern to filter assets (e.g., "tabby_.*_amd64.deb") + local api_url="https://api.github.com/repos/$repo/releases/latest" + local download_url -# First step that always needs to happen -sudo apt update + # Fetch the latest release JSON and extract the download URL for the .deb + download_url=$(curl -s "$api_url" | jq -r --arg pat "${pattern:-.*\.deb}" \ + '.assets[] | select(.name | test($pat)) | .browser_download_url') + + if [[ -z "$download_url" ]]; then + echo "Error: No .deb file found for $repo with pattern '$pattern'" + return 1 + fi + + # Download the .deb file + echo "Downloading $download_url to $output..." + curl -sL "$download_url" -o "$output" + + if [[ $? -eq 0 ]]; then + echo "Successfully downloaded $output" + else + echo "Error: Failed to download $output" + return 1 + fi +} + +# 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 -y -# install curl,git, and wget +# Install Xanmod kernel +echo "Installing Xanmod kernel..." +echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list +wget -qO - https://dl.xanmod.org/gpg.key | sudo apt-key add - +sudo apt update +sudo apt install linux-xanmod-x64v3 -y +# sudo update-grub Grok addded this but its not needed -sudo apt install curl git wget -y # at worst this does nothing +# Homebrew +echo "Installing Homebrew..." +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) --prefix=/opt/homebrew" +echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bashrc +eval "$(/opt/homebrew/bin/brew shellenv)" -# install the fun stuff - -# We begin with homebrew - -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - -# inject homebrew into .bashrc - -echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - -# now pacstall - -sudo bash -c "$(curl -fsSL https://pacstall.dev/q/install)" - -# now makedeb - -# we need a environment variable here +# Pacstall +echo "Installing Pacstall..." +if ! curl -fsSL https://pacstall.dev/q/install | sudo bash; then + echo "Pacstall install failed" >&2 + exit 1 +fi +# 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 bash -ci "$(wget -qO - 'https://shlink.makedeb.org/install')" -# Thats it for top level stuff now we dive a little deeper - -# Now floorp - -curl -fsSL https://ppa.floorp.app/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/Floorp.gpg +# Floorp +echo "Installing Floorp..." +curl -fsSL https://ppa.floorp.app/KEY.gpg | sudo apt-key add - 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 -# now let's do signal - -# 1. Install our official public software signing key: -wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg -cat signal-desktop-keyring.gpg | sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null - -# 2. Add our repository to your list of repositories: +# 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 tee /etc/apt/sources.list.d/signal-xenial.list +sudo apt update +sudo apt install signal-desktop -y -# 3. Update your package database and install Signal: -sudo apt update && sudo apt install signal-desktop -y -# now let's do discord +# 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 -wget 'https://discord.com/api/download?platform=linux&format=deb' -O discord.deb -sudo apt install ./discord.deb -y - -# now let's do telegram - -wget https://td.telegram.org/tlinux/tsetup.5.11.1.tar.xz -O tsetup.5.11.1.tar.xz -tar -xvf tsetup.5.11.1.tar.xz - -# Now lets do kopia +# 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 +# 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 -y -sudo apt install kopia-ui -y +sudo apt install kopia kopia-ui -y -# now lets do steam +# 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 -wget https://cdn.cloudflare.steamstatic.com/client/installer/steam.deb -O steam.deb -sudo apt install ./steam.deb -y - -# that is it for now, maybe later add xanmod or openrc - -# Now lets add NVM - -wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash -source $HOME/.bashrc +# NVM and Node.js +echo "Installing NVM and Node.js..." +bash -i <(wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh) +. ~/.nvm/nvm.sh nvm install --lts -# Now bun +# Bun +echo "Installing Bun..." +curl -fsSL https://bun.sh/install | bash || { echo "Bun install failed" >&2; exit 1; } -curl -fsSL https://bun.sh/install | bash \ No newline at end of file +# Joplin +wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash + +# Tabby +download_latest_deb "Eugeny/tabby" "tabby.deb" +sudo apt install ./tabby.deb -y + +# 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!" \ No newline at end of file