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