Skip to content

Commit

Permalink
chore: Add Docker installation script
Browse files Browse the repository at this point in the history
Signed-off-by: Schubert Anselme <[email protected]>
  • Loading branch information
sanselme committed Nov 3, 2024
1 parent 6f96694 commit 809a766
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 279 deletions.
2 changes: 1 addition & 1 deletion .commitlintrc
2 changes: 1 addition & 1 deletion .editorconfig
2 changes: 1 addition & 1 deletion .idea
2 changes: 1 addition & 1 deletion .markdownlint.yaml
2 changes: 1 addition & 1 deletion .vscode
2 changes: 1 addition & 1 deletion .yamllint.yaml
117 changes: 0 additions & 117 deletions config/bashrc

This file was deleted.

4 changes: 0 additions & 4 deletions config/sshconfig

This file was deleted.

127 changes: 0 additions & 127 deletions config/zshrc

This file was deleted.

59 changes: 34 additions & 25 deletions scripts/configure.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0

DIR="$(dirname $(realpath $(dirname "${0}")))"
source "${DIR}/scripts/aliases.sh"
source "${DIR}/scripts/environment.sh"
source scripts/aliases.sh
source scripts/environment.sh

# dependencies
if [[ -n $(command -v "apt-get") ]]; then
Expand All @@ -14,10 +13,10 @@ if [[ -n $(command -v "apt-get") ]]; then
"zsh"
)

sudo apt-get update -y
for command in "${commands[@]}"; do
if [[ -z $(command -v "${command}") ]]; then
sudo apt-get install -y "${command}"
if ! grep -qa "${command}" <(apt list --installed); then
echo sudo apt-get update -yq
echo sudo apt-get install -y "${command}"
fi
done
fi
Expand All @@ -31,9 +30,18 @@ if [[ -n $(command -v "usermod") ]]; then
"sudo"
)

# note: always set the user to "devcontainer" if it exists
if [[ "devcontainer" == "$(whoami)" ]]; then
USER="devcontainer"
else
USER="$(whoami)"
fi

for g in "${groups[@]}"; do
sudo usermod -aG "${g}" "${USER}" || true
sudo usermod -aG "${g}" "${USER}"
done

id "${USER}"
fi

# environment
Expand All @@ -44,27 +52,28 @@ if [[ ! -d "${HOME}/.oh-my-zsh" ]]; then
fi

ln -sf \
"${DIR}/modules/dotfiles/.bashrc" \
"${DIR}/modules/dotfiles/.zshrc" \
"${DIR}/modules/dotfiles/.editorconfig" \
"${DIR}/modules/dotfiles/.commitlintrc" \
"${DIR}/modules/dotfiles/.idea" \
"${DIR}/modules/dotfiles/.vscode" \
"${DIR}/.trunk/configs/."* \
"${DIR}"
modules/dotfiles/.bashrc \
modules/dotfiles/.zshrc \
modules/dotfiles/.editorconfig \
modules/dotfiles/.commitlintrc \
modules/dotfiles/.idea \
modules/dotfiles/.vscode \
.trunk/configs/.* \
.

for ITEM in $(echo """
${DIR}/modules/dotfiles/.devcontainer
${DIR}/modules/dotfiles/.gitignore
${DIR}/modules/dotfiles/.ssh
${DIR}/modules/dotfiles/.trunk
${DIR}/modules/dotfiles/compose-dev.yaml
"""); do
# copy if not present in "${DIR}"
ls -l $(basename "${ITEM}") > /dev/null 2>&1 || cp -r "${ITEM}" "${DIR}/"
ITEMS=(
"modules/dotfiles/.devcontainer"
"modules/dotfiles/.gitignore"
"modules/dotfiles/.ssh"
"modules/dotfiles/.trunk"
"modules/dotfiles/compose-dev.yaml"
)
for ITEM in "${ITEMS[@]}"; do
# copy if not present in the root directory
ls -l $(basename "${ITEM}") > /dev/null 2>&1 || cp -r "${ITEM}" .
done

sudo chsh -s "$(command -v zsh)" "${USER}"
echo sudo chsh -s "$(command -v zsh)" "${USER}"

# trunk.io
if [[ -n $(command -v "usermod") ]]; then
Expand Down
Loading

0 comments on commit 809a766

Please sign in to comment.