Skip to content

Commit

Permalink
Add Shellcheck support via GitHub Actions. Fixes all violations.
Browse files Browse the repository at this point in the history
  • Loading branch information
anavarre committed Jun 12, 2024
1 parent 6512cde commit cfda931
Show file tree
Hide file tree
Showing 67 changed files with 230 additions and 61 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run ShellCheck

on:
push:
branches:
- '*' # Run on all branches
pull_request:
branches:
- '*' # Run on all branches

jobs:
shellcheck:
name: Run ShellCheck
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install ShellCheck
run: sudo apt-get install -y shellcheck

- name: Run ShellCheck
run: |
# Find all shell scripts and run shellcheck
find . -name "*.sh" -print0 | xargs -0 shellcheck
2 changes: 2 additions & 0 deletions ascii.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

ascii_art='
________ __ ___.
\_____ \ _____ _____ | | ____ _\_ |__
Expand Down
5 changes: 4 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Exit immediately if a command exits with a non-zero status
set -e

Expand All @@ -10,7 +12,8 @@ gsettings set org.gnome.desktop.screensaver lock-enabled false
gsettings set org.gnome.desktop.session idle-delay 0

# Run installers
for script in ~/.local/share/omakub/install/*.sh; do source $script; done
# shellcheck disable=SC1090
for script in "$HOME"/.local/share/omakub/install/*.sh; do source "$script"; done

# Upgrade everything that might ask for a reboot last
sudo apt upgrade -y
Expand Down
13 changes: 8 additions & 5 deletions install/a-shell.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[ -f "~/.bashrc" ] && mv ~/.bashrc ~/.bashrc.bak
cp ~/.local/share/omakub/configs/bashrc ~/.bashrc
source ~/.local/share/omakub/defaults/bash/shell
#!/usr/bin/env bash

[ -f "~/.inputrc" ] && mv ~/.inputrc ~/.inputrc.bak
cp ~/.local/share/omakub/configs/inputrc ~/.inputrc
[ -f "$HOME/.bashrc" ] && mv ~/.bashrc ~/.bashrc.bak
cp "$HOME/.local/share/omakub/configs/bashrc" ~/.bashrc
# shellcheck disable=SC1091
source "$HOME/.local/share/omakub/defaults/bash/shell"

[ -f "$HOME/.inputrc" ] && mv ~/.inputrc ~/.inputrc.bak
cp "$HOME/.local/share/omakub/configs/inputrc" "$HOME/.inputrc"
2 changes: 2 additions & 0 deletions install/app-alacritty.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

sudo apt install -y alacritty
mkdir -p ~/.config/alacritty
cp ~/.local/share/omakub/configs/alacritty.toml ~/.config/alacritty/alacritty.toml
Expand Down
6 changes: 4 additions & 2 deletions install/app-chrome.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cd /tmp
#!/usr/bin/env bash

cd ~/Downloads || exit
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
cd -
cd - || exit
2 changes: 2 additions & 0 deletions install/app-fastfetch.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
sudo apt update
sudo apt install -y fastfetch
2 changes: 2 additions & 0 deletions install/app-flameshot.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash

# Flameshot is a nice step-up over the default Gnome screenshot tool
sudo apt install -y flameshot
2 changes: 2 additions & 0 deletions install/app-github-cli.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg &&
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
Expand Down
2 changes: 2 additions & 0 deletions install/app-gnome-tweak-tool.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#!/usr/bin/env bash

sudo apt install -y gnome-tweak-tool
6 changes: 4 additions & 2 deletions install/app-gum.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash

# Gum is used for the Omakub commands for tailoring Omakub after the initial install
cd /tmp
cd /tmp || exit
GUM_VERSION="0.14.1" # Use known good version
wget -O gum.deb "https://github.com/charmbracelet/gum/releases/latest/download/gum_${GUM_VERSION}_amd64.deb"
sudo apt install -y ./gum.deb
rm gum.deb
cd -
cd - || exit
6 changes: 4 additions & 2 deletions install/app-lazydocker.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -sLo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
tar -xf lazydocker.tar.gz lazydocker
sudo install lazydocker /usr/local/bin
rm lazydocker.tar.gz lazydocker
cd -
cd - || exit
6 changes: 4 additions & 2 deletions install/app-lazygit.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -sLo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar -xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
rm lazygit.tar.gz lazygit
cd -
cd - || exit
6 changes: 4 additions & 2 deletions install/app-localsend.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
LOCALSEND_VERSION=$(curl -s "https://api.github.com/repos/localsend/localsend/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
wget -O localsend.deb "https://github.com/localsend/localsend/releases/latest/download/LocalSend-${LOCALSEND_VERSION}-linux-x86-64.deb"
sudo apt install -y ./localsend.deb
rm localsend.deb
cd -
cd - || exit
8 changes: 5 additions & 3 deletions install/app-neovim.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

sudo apt install -y neovim

if [ ! -d "$HOME/.config/nvim" ]; then
git clone https://github.com/LazyVim/starter ~/.config/nvim
mkdir -p ~/.config/nvim/plugin/after
cp ~/.local/share/omakub/configs/neovim/transparency.lua ~/.config/nvim/plugin/after/
cp ~/.local/share/omakub/themes/neovim/tokyo-night.lua ~/.config/nvim/lua/plugins/theme.lua
cp "$HOME/.local/share/omakub/configs/neovim/transparency.lua" "$HOME/.config/nvim/plugin/after/"
cp "$HOME/.local/share/omakub/themes/neovim/tokyo-night.lua" "$HOME/.config/nvim/lua/plugins/theme.lua"

# Enable default extras
cp ~/.local/share/omakub/configs/neovim/lazyvim.json ~/.config/nvim/lazyvim.json
cp "$HOME/.local/share/omakub/configs/neovim/lazyvim.json" "$HOME/.config/nvim/lazyvim.json"
fi
2 changes: 2 additions & 0 deletions install/app-pinta.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash

# FIXME: Get this out of snap
sudo snap install pinta
3 changes: 3 additions & 0 deletions install/app-signal.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

wget -qO- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor >signal-desktop-keyring.gpg
# shellcheck disable=SC2002
cat signal-desktop-keyring.gpg | sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg >/dev/null
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |
sudo tee /etc/apt/sources.list.d/signal-xenial.list
Expand Down
2 changes: 2 additions & 0 deletions install/app-typora.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

wget -qO - https://typora.io/linux/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/typora.asc
sudo add-apt-repository -y 'deb https://typora.io/linux ./'
sudo apt update
Expand Down
2 changes: 2 additions & 0 deletions install/app-vlc.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#!/usr/bin/env bash

sudo apt install -y vlc
10 changes: 6 additions & 4 deletions install/app-vscode.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
wget -O code.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'
sudo apt install -y ./code.deb
rm code.deb
cd -
cd - || exit

mkdir -p ~/.config/Code/User
cp ~/.local/share/omakub/configs/vscode.json ~/.config/Code/User/settings.json
mkdir -p "$HOME/.config/Code/User"
cp "$HOME/.local/share/omakub/configs/vscode.json" "$HOME/.config/Code/User/settings.json"

# Install default supported themes
code --install-extension enkia.tokyo-night
Expand Down
2 changes: 2 additions & 0 deletions install/app-xournalpp.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#!/usr/bin/env bash

sudo apt install -y xournalpp
12 changes: 7 additions & 5 deletions install/app-zellij.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
wget -O zellij.tar.gz "https://github.com/zellij-org/zellij/releases/latest/download/zellij-x86_64-unknown-linux-musl.tar.gz"
tar -xf zellij.tar.gz zellij
sudo install zellij /usr/local/bin
rm zellij.tar.gz zellij
cd -
cd - || exit

mkdir -p ~/.config/zellij/
[ ! -f "$HOME/.config/zellij/config.kdl" ] && cp ~/.local/share/omakub/configs/zellij.kdl ~/.config/zellij/config.kdl
[ ! -L "$HOME/.config/zellij/themes" ] && ln -s ~/.local/share/omakub/themes/zellij ~/.config/zellij/themes
mkdir -p "$HOME/.config/zellij/"
[ ! -f "$HOME/.config/zellij/config.kdl" ] && cp "$HOME/.local/share/omakub/configs/zellij.kdl" "$HOME/.config/zellij/config.kdl"
[ ! -L "$HOME/.config/zellij/themes" ] && ln -s "$HOME/.local/share/omakub/themes/zellij" "$HOME/.config/zellij/themes"
2 changes: 2 additions & 0 deletions install/apps-terminal.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#!/usr/bin/env bash

sudo apt install -y fzf ripgrep bat eza zoxide plocate btop apache2-utils
5 changes: 4 additions & 1 deletion install/apps-web.sh
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
for script in ~/.local/share/omakub/web-apps/*.sh; do source $script; done
#!/usr/bin/env bash

# shellcheck disable=SC1090
for script in ~/.local/share/omakub/web-apps/*.sh; do source "$script"; done
5 changes: 4 additions & 1 deletion install/docker.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/bin/env bash

# Add the official Docker repo
sudo install -m 0755 -d /etc/apt/keyrings
sudo wget -qO /etc/apt/keyrings/docker.asc https://download.docker.com/linux/ubuntu/gpg
sudo chmod a+r /etc/apt/keyrings/docker.asc
# shellcheck disable=SC1091
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update

# Install Docker engine and standard plugins
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

# Give this user privileged Docker access
sudo usermod -aG docker ${USER}
sudo usermod -aG docker "${USER}"

# Use local logging driver - it's more efficient and uses compression by default.
echo '{"log-driver":"local","log-opts":{"max-size":"10m","max-file":"5"}}' | sudo tee /etc/docker/daemon.json > /dev/null
10 changes: 6 additions & 4 deletions install/fonts.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
mkdir -p ~/.local/share/fonts
#!/usr/bin/env bash

cd /tmp
mkdir -p "$HOME/.local/share/fonts"

cd /tmp || exit
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/CascadiaMono.zip
unzip CascadiaMono.zip -d CascadiaFont
cp CascadiaFont/*.ttf ~/.local/share/fonts
rm -rf CascadiaMono.zip CascadiaFont

wget -O iafonts.zip https://github.com/iaolo/iA-Fonts/archive/refs/heads/master.zip
unzip iafonts.zip -d iaFonts
cp iaFonts/iA-Fonts-master/iA\ Writer\ Mono/Static/iAWriterMonoS-*.ttf ~/.local/share/fonts
cp iaFonts/iA-Fonts-master/iA\ Writer\ Mono/Static/iAWriterMonoS-*.ttf "$HOME/.local/share/fonts"
rm -rf iafonts.zip iaFonts

fc-cache
cd -
cd - || exit
2 changes: 2 additions & 0 deletions install/libraries.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

sudo apt install -y \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
Expand Down
2 changes: 2 additions & 0 deletions install/mise.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Install mise for managing multiple versions of languages. See https://mise.jdx.dev/
sudo apt update -y && sudo apt install -y gpg sudo wget curl
sudo install -dm 755 /etc/apt/keyrings
Expand Down
6 changes: 4 additions & 2 deletions install/optional/app-1password.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
wget https://downloads.1password.com/linux/debian/amd64/stable/1password-latest.deb
sudo apt install -y ./1password-latest.deb
rm 1password-latest.deb
cd -
cd - || exit
2 changes: 2 additions & 0 deletions install/optional/app-dropbox.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash

sudo apt install -y nautilus-dropbox
gtk-launch dropbox.desktop
2 changes: 2 additions & 0 deletions install/optional/app-spotify.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg
echo "deb [signed-by=/etc/apt/trusted.gpg.d/spotify.gpg] http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt update
Expand Down
4 changes: 3 additions & 1 deletion install/optional/app-virtualbox.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

# Virtualbox allows you to run VMs for other flavors of Linux or even Windows
# See https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox#1-overview
# for a guide on how to run Ubuntu inside it.
sudo apt install -y virtualbox virtualbox-ext-pack
sudo usermod -aG vboxusers ${USER}
sudo usermod -aG vboxusers "${USER}"
6 changes: 4 additions & 2 deletions install/optional/app-zoom.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cd /tmp
#!/usr/bin/env bash

cd /tmp || exit
wget https://zoom.us/client/latest/zoom_amd64.deb
sudo apt install -y ./zoom_amd64.deb
rm zoom_amd64.deb
cd -
cd - || exit
4 changes: 4 additions & 0 deletions install/select-dev-env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

# Install default programming languages
# shellcheck disable=SC2140
languages=$(gum choose "Ruby" "Node.js" "Go" "Python" "Java" --no-limit --selected "Ruby","Node.js" --height 7 --header "Select programming languages")

for language in $languages; do
Expand All @@ -22,6 +25,7 @@ for language in $languages; do
done

# Install default databases
# shellcheck disable=SC2140
dbs=$(gum choose "MySQL" "Redis" "PostgreSQL" --no-limit --selected "MySQL","Redis" --height 5 --header "Select databases (runs in Docker)")

for db in $dbs; do
Expand Down
4 changes: 4 additions & 0 deletions install/select-optional-apps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash

# Install optional apps
# shellcheck disable=SC2140
apps=$(gum choose "1password" "Spotify" "Zoom" "Dropbox" "VirtualBox" --no-limit --selected "1password","Spotify","Zoom" --height 7 --header "Select commercial apps")

for app in $apps; do
# shellcheck disable=SC1090
source "$OMAKUB_PATH/install/optional/app-${app,,}.sh"
done
2 changes: 2 additions & 0 deletions install/set-dock.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Favorite apps for dock
apps=(
"google-chrome.desktop"
Expand Down
4 changes: 3 additions & 1 deletion install/set-emojis.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cp ~/.local/share/omakub/configs/xcompose ~/.XCompose
#!/usr/bin/env bash

cp "$HOME/.local/share/omakub/configs/xcompose" ~/.XCompose
ibus restart
gsettings set org.gnome.desktop.input-sources xkb-options "['compose:caps']"
3 changes: 3 additions & 0 deletions install/set-framework-text-scaling.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

COMPUTER_MAKER=$(sudo dmidecode -t system | grep 'Manufacturer:' | awk '{print $2}')
# shellcheck disable=SC2063
SCREEN_RESOLUTION=$(xrandr | grep '*+' | awk '{print $1}')

if [ "$COMPUTER_MAKER" == "Framework" ] && [ "$SCREEN_RESOLUTION" == "2256x1504" ]; then
Expand Down
2 changes: 2 additions & 0 deletions install/set-git.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Set common git aliases
git config --global alias.co checkout
git config --global alias.br branch
Expand Down
Loading

0 comments on commit cfda931

Please sign in to comment.