42 lines
2.8 KiB
Bash
42 lines
2.8 KiB
Bash
#! /usr/bin/env bash
|
|
|
|
# sudo mkdir -p /usr/share/keyrings 2>&1 > /dev/null
|
|
|
|
# sudo apt-get install --yes --no-install-recommends \
|
|
# curl gnupg software-properties-common apt-transport-https
|
|
|
|
function add_repo() {
|
|
REPO_FQDN=$1 #'download.docker.com'
|
|
GPG_KEY_URL=${2:-https:\/\/$REPO_FQDN\/gpg}
|
|
GPG_KEY_PATH=/usr/share/keyrings/$REPO_FQDN.gpg
|
|
REPO_ARCH=${3:-$(dpkg --print-architecture)}
|
|
[[ $REPO_ARCH == '-' ]] && REPO_ARCH='' || REPO_ARCH="arch=$REPO_ARCH"
|
|
REPO_URL=${4:-https:\/\/$REPO_FQDN}
|
|
REPO_SUITE=${5:-$(lsb_release -cs)}
|
|
REPO_CMP=${6:-main}
|
|
|
|
curl -fsSL $GPG_KEY_URL | sudo gpg --dearmor -o $GPG_KEY_PATH
|
|
echo "Key created: $GPG_KEY_PATH"
|
|
echo "deb [$(echo "$REPO_ARCH signed-by=$GPG_KEY_PATH" | xargs )] $REPO_URL $REPO_SUITE $REPO_CMP" | \
|
|
sudo tee /etc/apt/sources.list.d/$REPO_FQDN.list > /dev/null
|
|
echo "APT source list added: /etc/apt/sources.list.d/$REPO_FQDN.list"
|
|
}
|
|
|
|
#Long line - 189 characters long
|
|
#add_repo REPO_FQDN/Name GPG_KEY_URL REPO_ARCH REPO_URL REPO_SUITE REPO_CMP # TBD: PIN_PRIORITY
|
|
#defaults: <required> 'https://$REPO_FQDN/gpg' $(dpkg --print-architecture) 'https://$REPO_FQDN' $(lsb_release -cs) 'main' # <optional>
|
|
# ---------------------------- ------------------------------------------------------- ---------- ------------------------------------------ ----------- ---------
|
|
add_repo 'download.docker.com' 'https://download.docker.com/linux/ubuntu/gpg' '' 'https://download.docker.com/linux/ubuntu' '' 'stable'
|
|
add_repo 'deb.anydesk.com' 'https://keys.anydesk.com/repos/DEB-GPG-KEY' '-' 'http://deb.anydesk.com/' 'all' ''
|
|
add_repo 'packages.cloud.google.com' 'https://packages.cloud.google.com/apt/doc/apt-key.gpg' '-' 'https://packages.cloud.google.com/apt' 'cloud-sdk' ''
|
|
add_repo 'packages.microsoft.com' 'https://packages.microsoft.com/keys/microsoft.asc' '' 'http://packages.microsoft.com/repos/code' 'stable' ''
|
|
add_repo 'apt.releases.hashicorp.com' 'https://apt.releases.hashicorp.com/gpg' '' 'https://apt.releases.hashicorp.com' '' ''
|
|
|
|
sudo apt-add-repository --no-update "deb [arch=amd64] http://http.us.debian.org/debian sid main non-free contrib"
|
|
# # Debian sid (unstable) as low-priority option
|
|
(echo 'Package: *'; echo 'Pin: release a=unstable'; echo 'Pin-Priority: 200') | sudo tee /etc/apt/preferences.d/unstable > /dev/null
|
|
# # pin xscreensaver to unstable
|
|
(echo 'Package: xscreenaver*'; echo 'Pin: release a=unstable'; echo 'Pin-Priority: 2000') | sudo tee /etc/apt/preferences.d/xscreensaver > /dev/null
|
|
|
|
sudo apt update
|