feat: uuid fallback, apt setup on Ubuntu
This commit is contained in:
@@ -7,7 +7,7 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
|
|||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN apt-get -qq update
|
RUN apt-get -qq update
|
||||||
RUN apt-get -qq install --no-install-recommends \
|
RUN apt-get -qq install --no-install-recommends \
|
||||||
software-properties-common sudo uuid-runtime
|
software-properties-common sudo
|
||||||
|
|
||||||
# Create user with sudo priviledge
|
# Create user with sudo priviledge
|
||||||
RUN useradd -r -u 1001 --create-home -m "test-user"
|
RUN useradd -r -u 1001 --create-home -m "test-user"
|
||||||
|
|||||||
@@ -13,10 +13,8 @@ to be installed by running:
|
|||||||
# Dependencies if running on Debian
|
# Dependencies if running on Debian
|
||||||
sudo apt update && sudo apt install --no-install-recommends --yes \
|
sudo apt update && sudo apt install --no-install-recommends --yes \
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
uuid-runtime \
|
|
||||||
wget
|
wget
|
||||||
|
|
||||||
|
|
||||||
# Inspect source
|
# Inspect source
|
||||||
wget https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup -qO - | less
|
wget https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup -qO - | less
|
||||||
|
|
||||||
|
|||||||
@@ -46,18 +46,20 @@ function install {
|
|||||||
|
|
||||||
# Add apt repository
|
# Add apt repository
|
||||||
# @arg $1 JSON object containing the following keys
|
# @arg $1 JSON object containing the following keys
|
||||||
|
# * key - entry key
|
||||||
# * repository - apt repository
|
# * repository - apt repository
|
||||||
# * signingKey - gpg signing key url
|
# * signingKey - gpg signing key url
|
||||||
# * components - apt components
|
# * components - apt components
|
||||||
function add_repository {
|
function add_repository {
|
||||||
|
key=$(jq -r ".key" <<<"$1")
|
||||||
repository=$(jq -r ".repository" <<<"$1")
|
repository=$(jq -r ".repository" <<<"$1")
|
||||||
if ! grep -q "^deb .*${repository}" /etc/apt/sources.list; then
|
signingKey=$(jq -r ".signingKey" <<<"$1")
|
||||||
signingKey=$(jq -r ".signingKey" <<<"$1")
|
components=$(jq -r ".components" <<<"$1")
|
||||||
components=$(jq -r ".components" <<<"$1")
|
source="deb [arch=$(dpkg --print-architecture)] ${repository} ${components}"
|
||||||
curl -fsSL $signingKey | sudo apt-key add -
|
echo "$source" | sudo tee "/etc/apt/sources.list.d/${key}.list" >/dev/null
|
||||||
source="deb [arch=$(dpkg --print-architecture)] ${repository} ${components}"
|
wget -O- "$signingKey" |
|
||||||
sudo add-apt-repository --yes "$source"
|
gpg --dearmor |
|
||||||
fi
|
sudo tee "/etc/apt/keyrings/${key}.gpg" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# @arg $1 package list file to install
|
# @arg $1 package list file to install
|
||||||
@@ -79,11 +81,11 @@ function stow_package {
|
|||||||
target=$HOME
|
target=$HOME
|
||||||
;;
|
;;
|
||||||
CONFIG)
|
CONFIG)
|
||||||
mkdir $HOME/.config
|
mkdir -p $HOME/.config
|
||||||
target=$HOME/.config
|
target=$HOME/.config
|
||||||
;;
|
;;
|
||||||
SSH)
|
SSH)
|
||||||
mkdir $HOME/.ssh
|
mkdir -p $HOME/.ssh
|
||||||
target=$HOME/.ssh
|
target=$HOME/.ssh
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ set -eo pipefail
|
|||||||
#
|
#
|
||||||
|
|
||||||
TIME=${TIME:-$(date)}
|
TIME=${TIME:-$(date)}
|
||||||
UUID=${UUID:-$(uuidgen)}
|
UUID=${UUID:-$(cat /proc/sys/kernel/random/uuid)}
|
||||||
HOST=${HOST:-$(hostname)}
|
HOST=${HOST:-$(hostname)}
|
||||||
|
|
||||||
NAME=$(basename "$0")
|
NAME=$(basename "$0")
|
||||||
|
|||||||
@@ -1,36 +1,43 @@
|
|||||||
{
|
{
|
||||||
"apt_repositories": [
|
"apt_repositories": [
|
||||||
{
|
{
|
||||||
|
"key": "hashicorp",
|
||||||
"signingKey": "https://apt.releases.hashicorp.com/gpg",
|
"signingKey": "https://apt.releases.hashicorp.com/gpg",
|
||||||
"repository": "https://apt.releases.hashicorp.com",
|
"repository": "https://apt.releases.hashicorp.com",
|
||||||
"components": "buster main"
|
"components": "bullseye main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "yarn",
|
||||||
"signingKey": "https://dl.yarnpkg.com/debian/pubkey.gpg",
|
"signingKey": "https://dl.yarnpkg.com/debian/pubkey.gpg",
|
||||||
"repository": "https://dl.yarnpkg.com/debian",
|
"repository": "https://dl.yarnpkg.com/debian",
|
||||||
"components": "stable main"
|
"components": "stable main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "google-cloud",
|
||||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||||
"repository": "https://packages.cloud.google.com/apt",
|
"repository": "https://packages.cloud.google.com/apt",
|
||||||
"components": "cloud-sdk main"
|
"components": "cloud-sdk main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "google-k8s",
|
||||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||||
"repository": "https://apt.kubernetes.io/",
|
"repository": "https://apt.kubernetes.io/",
|
||||||
"components": "kubernetes-xenial main"
|
"components": "kubernetes-xenial main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "docker",
|
||||||
"signingKey": "https://download.docker.com/linux/debian/gpg",
|
"signingKey": "https://download.docker.com/linux/debian/gpg",
|
||||||
"repository": "https://download.docker.com/linux/debian",
|
"repository": "https://download.docker.com/linux/debian",
|
||||||
"components": "buster stable"
|
"components": "bullseye stable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "fish",
|
||||||
"signingKey": "https://download.opensuse.org/repositories/shells:fish/Debian_10/Release.key",
|
"signingKey": "https://download.opensuse.org/repositories/shells:fish/Debian_10/Release.key",
|
||||||
"repository": "https://download.opensuse.org/repositories/shells:/fish/Debian_10/",
|
"repository": "https://download.opensuse.org/repositories/shells:/fish/Debian_10/",
|
||||||
"components": "/"
|
"components": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "github",
|
||||||
"signingKey": "https://cli.github.com/packages/githubcli-archive-keyring.gpg",
|
"signingKey": "https://cli.github.com/packages/githubcli-archive-keyring.gpg",
|
||||||
"repository": "https://cli.github.com/packages",
|
"repository": "https://cli.github.com/packages",
|
||||||
"components": "stable main"
|
"components": "stable main"
|
||||||
@@ -64,7 +71,7 @@
|
|||||||
"lsb-release",
|
"lsb-release",
|
||||||
"make",
|
"make",
|
||||||
"net-tools",
|
"net-tools",
|
||||||
"netcat",
|
"netcat-traditional",
|
||||||
"openssh-client",
|
"openssh-client",
|
||||||
"openssh-server",
|
"openssh-server",
|
||||||
"redis-tools",
|
"redis-tools",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
IMAGE=${IMAGE:-"andrejusk/dotfiles"}
|
IMAGE=${IMAGE:-"andrejusk/dotfiles"}
|
||||||
tag=${TAG:-uuidgen}
|
tag=${TAG:-$(cat /proc/sys/kernel/random/uuid)}
|
||||||
|
|
||||||
docker build . \
|
docker build . \
|
||||||
--build-arg UUID=$tag \
|
--build-arg UUID=$tag \
|
||||||
|
|||||||
Reference in New Issue
Block a user