Skip to content

Commit

Permalink
Add scripts for configuring apt repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
AgenttiX committed Oct 16, 2024
1 parent 09d390e commit 28f316e
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ zsh-syntax-highlighting
*.dat
*.deb
*.deb.*
*.gpg
*.idx
*.iso
*.jar
Expand All @@ -40,6 +41,7 @@ zsh-syntax-highlighting
*.tar.gz
*.tgz
*.zip
.zsh_history
android/apps
android/platform-tools
android/platform-tools-latest-linux.zip
Expand Down
74 changes: 74 additions & 0 deletions apt/setup_sources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
set -eu
# Setup sources

if [ "${EUID}" -ne 0 ]; then
echo "This script should be run as root."
exit 1
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

mkdir -p /etc/apt/keyrings
apt-get update
apt-get install apt-transport-https ca-certificates curl ubuntu-dbgsym-keyring

# -----
# Ubuntu repos
# -----

# Debug symbols
# https://ubuntu.com/server/docs/debug-symbol-packages
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list

# -----
# Custom repos in alphabetical order
# -----

# Docker
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

# Nvidia CUDA
. "$(dirname "${SCRIPT_DIR}")/drivers/setup_nvidia_repos.sh"

# Signal
# https://signal.org/download/
wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg
cat signal-desktop-keyring.gpg | tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
# The distro name has been "xenial" for quite a while
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |\
tee /etc/apt/sources.list.d/signal-xenial.list

# Syncthing
# https://apt.syncthing.net/
curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | tee /etc/apt/sources.list.d/syncthing.list

# Speedtest
# curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash

# -----
# PPAs
# -----
add-apt-repository ppa:linrunner/tlp
# add-apt-repository ppa:linuxuprising/java
add-apt-repository ppa:phoerious/keepassxc
# add-apt-repository ppa:thopiekar/openrgb
if [ "$(hostnamectl chassis)" = "laptop" ]; then
echo "This seems to be a laptop. Enabling the Touchegg repository."
add-apt-repository ppa:touchegg/stable
else
echo "This does not seem to be a laptop. Skipping Touchegg repository setup."
fi

apt-get update
12 changes: 3 additions & 9 deletions drivers/install_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if [ "${EUID}" -ne 0 ]; then
exit 1
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# Delete old signing key
apt-key del 7fa2af80

Expand All @@ -20,15 +22,7 @@ if [ "${1}" = "--fix" ]; then
apt clean
fi

# CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb

# Nvidia Container Toolkit
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
. "${SCRIPT_DIR}/setup_nvidia_repos.sh"

apt-get update
apt-get install cuda nvidia-container-toolkit
18 changes: 18 additions & 0 deletions drivers/setup_nvidia_repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eu

if [ "${EUID}" -ne 0 ]; then
echo "This script should be run as root."
exit 1
fi

# CUDA
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb

# Nvidia Container Toolkit
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

0 comments on commit 28f316e

Please sign in to comment.