Skip to content

Commit

Permalink
Some small changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardolm committed Nov 24, 2023
1 parent 3108c32 commit a9e94f6
Show file tree
Hide file tree
Showing 65 changed files with 2,360 additions and 329 deletions.
6 changes: 5 additions & 1 deletion .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
pushInsteadOf = "github:"

[core]
pager = less -R
editor = code --wait
untrackedCache = true
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
Expand Down Expand Up @@ -67,5 +68,8 @@
[branch]
sort = -committerdate

[gpg]
format = ssh

[include]
path = ~/sync/git/.gitconfig_private
path = ~/sync/git/.gitconfig
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
FROM ubuntu:jammy

ARG DEBIAN_FRONTEND=noninteractive
ENV NO_COLOR=0
ARG GIDH=999
ARG UIDH=999
ARG USER=bot
ENV TERM=xterm-256color
WORKDIR /opt/dotfiles

RUN apt-get update
RUN apt-get update && \
apt-get --no-install-recommends --yes install \
sudo locales apt-utils dialog

# to turn tests fast
RUN apt-get --yes upgrade
RUN apt-get install --yes \
curl \
fontconfig \
gconf2 \
git \
gnome-shell-extensions \
libglib2.0-bin \
make \
python3-pip \
sudo \
ttf-mscorefonts-installer
RUN apt-get --no-install-recommends --yes install \
git
# to turn tests fast

RUN groupadd -g ${GIDH} ${USER} && \
useradd --create-home -u ${UIDH} -g ${GIDH} ${USER} && \
usermod -a -G sudo,${USER} ${USER} && \
echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

ENTRYPOINT [ "make", "setup" ]
ENTRYPOINT [ "./install-pristine" ]
73 changes: 38 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,51 @@

MAKEFLAGS += --silent
PWD=$(shell pwd)
DOTBOT_CMD="DOTBOT_DIR=./git/modules/dotbot ./install -vv"

default: reset
@echo "starting docker to test first steps ubuntu"
@docker build --progress tty -t=dotfiles:test .
@docker run --rm -it \
-e DOTFILES=/opt/dotfiles \
-e SYNC_DOTFILES=/opt/sync \
-v /var/lib/apt/lists:/var/lib/apt/lists \
-v ${PWD}:/opt/dotfiles \
-v ${HOME}/sync:/opt/sync \
-w /opt/dotfiles \
DOTBOT_CMD="./install"

test: reset
echo "building docker image to test first steps ubuntu"
docker build \
--build-arg="UIDH=$(shell id -u)" \
--build-arg="USER=${USER}" \
--build-arg="GIDH=$(shell grep ${USER} /etc/passwd | cut -d: -f4)" \
--progress=plain \
-t=dotfiles:test \
.
echo "starting docker container"
docker run --rm -it \
--user ${USER} \
-e DOTFILES=/home/${USER}/dotfiles \
-e SYNC_DOTFILES=/home/${USER}/sync \
-e USER=${USER} \
-v /etc/apt/sources.list:/etc/apt/sources.list:ro \
-v ${HOME}/Dropbox:/home/${USER}/Dropbox:ro \
-v ${PWD}:/home/${USER}/dotfiles:ro \
-v ${PWD}/.git:/home/${USER}/dotfiles/.git \
-v ${PWD}/git/modules:/home/${USER}/dotfiles/git/modules \
-w /home/${USER}/dotfiles \
dotfiles:test

reset:
@reset
reset

pre:
sudo ${PWD}/pre-install
sudo ${PWD}/pre-setup

base:
eval ${DOTBOT_CMD} -c dotbot/base.yaml
# golang:
# eval ${DOTBOT_CMD} -c dotbot/go.yaml \
# --except go

apt:
eval ${DOTBOT_CMD} -c dotbot/apt.yaml \
-p git/modules/dotbot-sudo/sudo.py \
--except apt,apt_esm
# pip:
# eval ${DOTBOT_CMD} -c dotbot/pip.yaml \
# -p git/modules/dotbot-pip/pip.py

golang:
eval ${DOTBOT_CMD} -c dotbot/go.yaml \
--except go
# snap:
# eval ${DOTBOT_CMD} -c dotbot/snap.yaml \
# -p git/modules/dotbot-snap/snap.py

pip:
eval ${DOTBOT_CMD} -c dotbot/pip.yaml \
-p git/modules/dotbot-pip/pip.py
# post:
# eval ${DOTBOT_CMD} -c dotbot/post.yaml \
# -p git/modules/dotbot-sudo/sudo.py

snap:
eval ${DOTBOT_CMD} -c dotbot/snap.yaml \
-p git/modules/dotbot-snap/snap.py

post:
eval ${DOTBOT_CMD} -c dotbot/post.yaml \
-p git/modules/dotbot-sudo/sudo.py

setup: reset pre base apt pip snap golang post
# setup: reset pre base apt pip snap golang post
34 changes: 16 additions & 18 deletions aliases
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
# alias frm='/bin/rm -rf'
alias ack='ag && ag || ack'
alias chmod-octal='chmod -R 0664 '
alias dclsa='docker container ls -a --format "table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Ports}}"'
alias disk-usage='baobab'
alias drm='docker_container_remove'
alias dropbox-status='watch -n1 dropbox.py status'
alias figlet-fonts='ls /usr/share/figlet/ | grep flf | xargs -t -n1 -i figlet Hello-World! -f /usr/share/figlet/{}'
alias fonts-list='fc-list | cut -f2 -d: | sort -u'
alias fonts-update='fc-cache -f -v'
alias frm='gio trash -rf'
alias frm='/bin/rm -rf'
alias gcloud-prod='gcloud container clusters get-credentials production --zone us-east1-b --project $GCLOUD_ORG_PROJECT_ID'
alias gcloud-stg='gcloud container clusters get-credentials staging --zone us-east4-b --project $GCLOUD_ORG_PROJECT_ID'
alias gd="git diff --indent-heuristic --minimal --numstat"
alias gfp='git fetch --prune'
alias go-test='goimports -w ./.. && go clean -testcache && go test ./...'
alias gofix='goimports-here && gofmt-here && go mod tidy'
alias gofmt-here='find . -type f -name "*.go" -not -path "./vendor*" | tr -s "\n" " " | xargs gofmt -s -w'
alias goimports-here='find . -type f -name "*.go" -not -path "./vendor*" | tr -s "\n" " " | xargs goimports -w'
alias gotop='gotop-cjbassi'
alias go-fix='goimports -w ./..'
alias go-test='go-fix ; go clean -testcache ; go test ./...'
alias go-upgrade='bash -c "sudo $WORKSPACE_USER/update-golang/update-golang.sh"'
alias gofix='goimports-here ; gofmt-here ; go mod tidy'
alias gsl='git stash list'
alias gst="git status --branch --show-stash --untracked-files=all --ignore-submodules=untracked --column=always --renames --find-renames=70%"
alias gt='go test ./...'
alias less='cless && cless || less'
alias ls='ls_2_exa '
alias lsa='ls -lah'
alias ls='ls_2_exa'
alias lsa='exa -lhFa --group-directories-first --icons --no-time'
alias n='nautilus .'
alias nano="nano --tabstospaces --trimblanks --tabsize=4 --atblanks --breaklonglines --constantshow --rebinddelete --emptyline --showcursor --autoindent --linenumbers --mouse --indicator --saveonexit --minibar"
alias nautilus-speed-up='sudo rm -rf $HOME/.local/share/gvfs-metadata && sudo pkill gvfsd-metadata'
alias nautilus-speed-up='sudo rm -rf $HOME/.local/share/gvfs-metadata ; sudo pkill gvfsd-metadata'
alias new-guid='uuidgen | tr "[A-Z]" "[a-z]"'
alias path='echo -e ${PATH//:/\\n}'
alias python='python3'
alias register-python-argcomplete='register-python-argcomplete3'
alias reload='exec ${SHELL} -l'
alias remove-x='chmod -R -x+X .'
alias rm='gio trash'
alias rm='trash'
alias s='screen'
alias sai='sudo apt-get install'
alias sapar='sudo apt-get --purge --yes autoremove'
alias sau='sudo apt-get update'
alias sauu='sudo apt-get update; sudo apt-get upgrade --yes; sudo apt-get --purge --yes autoremove'
alias sauu='sudo apt-get update ; sudo apt-get upgrade --yes ; sudo apt-get --purge --yes autoremove'
alias sl='screen -list'
alias sr='screen -r'
alias td='todo_zsh'
Expand All @@ -47,7 +48,4 @@ alias update-pip='/usr/bin/python3 -m pip install -U pip --upgrade --user'
alias vsdot='DONT_PROMPT_WSL_INSTALL=true /snap/bin/code "${SYNC_DOTFILES}/vscode/dotfiles.code-workspace"'
alias watch-docker-all='watch -d -c -n 1 -x docker ps --all --format "table {{.Names}}\t{{.Ports}}\t{{.Image}}\t{{.Status}}"'
alias wget-force='wget -c --tries=100'
alias zhs='. $DOTFILES/zsh/zsh_history.zsh; zsh_history_sanitize'
alias zhsd='. $DOTFILES/zsh/zsh_history.zsh; zsh_history_sanitize'
alias zinit-purge='/bin/rm -rf ~/.zinit ~/.local/share/zinit'
alias zud='zinit self-update && zinit update --parallel'
alias zud='zinit self-update ; zinit update --parallel'
38 changes: 38 additions & 0 deletions alpine/usercfg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@


##############
# Testing!!! #
##############


arm_boost=0
audio_pwm_mode=1
camera_auto_detect=0
disable_audio_dither=1
disable_camera_led=1
disable_poe_fan=1
disable_splash=1
disable_touchscreen=1
display_auto_detect=1
dtparam=audio=off
dtparam=i2c_arm=off
dtparam=i2s=off
dtparam=spi=off
enable_tvout=0
enable_uart=1
hdmi_enable_4kp60=0
ignore_lcd=1






# [output:HDMI-A-1]
# mode = 1920x1080@60
# transform = 270 # not required



# check voltage
# vcgencmd pmic_read_adc EXT5V_V
2 changes: 1 addition & 1 deletion antigen/functions/antigen_purge
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env zsh

function antigen_purge() {
log_info "antigen_purge"
log info "antigen_purge"

find "$HOME" -maxdepth 1 -name '*.zcompdump*' -delete -true # completion cache
find "$HOME" -maxdepth 5 -name '*.zwc' -delete -true
Expand Down
14 changes: 7 additions & 7 deletions antigen/functions/antigen_setup
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
#!/usr/bin/env zsh

function antigen_setup() {
log_info "antigen_setup"
log info "antigen_setup"

# shellcheck source=/dev/null
# . "${DOTFILES}/zsh/functions/shell.zsh"

antigen_start

log_debug "antigen use oh-my-zsh"
log debug "antigen use oh-my-zsh"
antigen use oh-my-zsh

local plugins
plugins=$(file_lines_2_inline "${DOTFILES}/zsh/plugins.txt")
log_info "zsh plugins: $plugins"
log info "zsh plugins: $plugins"
antigen bundle "$plugins"

local plugins
plugins=$(file_lines_2_inline "${DOTFILES}/ohmyzsh/plugins.txt")
log_info "ohmyzsh plugins: $plugins"
log info "ohmyzsh plugins: $plugins"
antigen bundle "$plugins"

log_debug "antigen theme robbyrussell"
log debug "antigen theme robbyrussell"
antigen theme robbyrussell

log_debug "antigen apply"
log debug "antigen apply"
antigen apply

log_debug "antigen cache-gen"
log debug "antigen cache-gen"
antigen cache-gen
}
2 changes: 1 addition & 1 deletion antigen/functions/antigen_start
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env zsh

function antigen_start() {
log_info "antigen_start"
log info "antigen_start"
. "$ANTIGEN_PATH"
}
2 changes: 0 additions & 2 deletions antigen/start
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env zsh

fpath=( "${DOTFILES}/antigen/functions" "${fpath[@]}" )

export ANTIGEN_PATH="$USER_TMP/antigen.zsh"

$SHELL_DEBUG && antigen_purge
Expand Down
4 changes: 2 additions & 2 deletions apt/functions/apt_keys_recovery
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env zsh

function apt_keys_recovery() {
current_shell_debug=$SHELL_DEBUG
# shell_debug_relay=$SHELL_DEBUG
# SHELL_DEBUG=true

log start "recovering gpg keys absent"
Expand Down Expand Up @@ -76,5 +76,5 @@ function apt_keys_recovery() {

log finish "gpg keys absent recovered"

SHELL_DEBUG=$current_shell_debug
# SHELL_DEBUG=$shell_debug_relay
}
45 changes: 45 additions & 0 deletions apt/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

# shellcheck source=/dev/null
# . "${DOTFILES}/zsh/functions/log"

log start "setup apt packages"

log info "install base apt packages"

sudo apt-get install --no-install-recommends --yes \
$(cat apt/base.yaml | grep -v '\s+#' | yq '.[2].apt_in')

log info "purge base apt packages"

sudo apt-get purge --yes \
$(cat apt/base.yaml | grep -v '\s+#' | yq '.[3].apt_out')

# shellcheck source=/dev/null
. "${DOTFILES}/apt/setup-sources"

log info "install 3rd party apt packages"

sudo apt-get install --no-install-recommends --yes \
$(cat apt/3rd_party.yaml | grep -v '\s+#' | yq '.[2].apt')

log info "fixing broken apt packages"

sudo apt-get install --no-install-recommends --yes -f

log info "install pro apt packages"

sudo apt-get install --no-install-recommends --yes \
$(cat apt/pro.yaml | grep -v '\s+#' | yq '.[2].apt')

log info "install other apt packages"

sudo apt-get install --no-install-recommends --yes \
ttf-mscorefonts-installer

log info "remove hold apt packages"

sudo dpkg --get-selections | \
grep hold | xargs -x sudo apt-get autoremove

log finish "setup apt packages"
13 changes: 13 additions & 0 deletions apt/pre-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# shellcheck source=/dev/null
# . "${DOTFILES}/zsh/functions/log"

log start "pre setup apt"

sudo apt-get update
sudo apt-get --yes upgrade

command -v git &>/dev/null || sudo apt-get --yes install git

log finish "pre setup apt"
Loading

0 comments on commit a9e94f6

Please sign in to comment.