Skip to content

Instantly share code, notes, and snippets.

@stpettersens
Created June 8, 2026 20:59
Show Gist options
  • Select an option

  • Save stpettersens/ee79be58b2a8be06367a288fac3d0a6d to your computer and use it in GitHub Desktop.

Select an option

Save stpettersens/ee79be58b2a8be06367a288fac3d0a6d to your computer and use it in GitHub Desktop.
Set up DWM on Armbian
#!/usr/bin/env bash
# This script installs packages necessary for a dwm environment on Armbian Linux.
# Written by Sam Saint-Pettersen <s dot stpettersen at pm dot me>
#
# wget -q https://playbooks.stpettersen.xyz/armbian/setup-dwm-armbian
# bash setup-dwm-armbian
apt_pkgs=(
"build-essential"
"libpam0g-dev"
"libxcb-xkb-dev"
"bind9"
"bind9-dnsutils"
"btop"
"htop"
"eza"
"7zip"
"xorg"
"xinit"
"iw"
"vim"
"mousepad"
"git"
"gcc"
"tcc"
"ldc"
"clang"
"valgrind"
"upx-ucl"
"make"
"libx11-dev"
"libx11-6"
"libxinerama-dev"
"libxinerama1"
"libx11-xcb-dev"
"libxcb-res0-dev"
"xcb"
"libxft-dev"
"libfreetype-dev"
"feh"
"alacritty"
"flameshot"
"wget"
"curl"
"jq"
"xz-utils"
"tealdeer"
"fastfetch"
"patch"
"keychain"
"keepassxc"
"thunar"
"opendoas"
"pulseaudio"
"pulseaudio-utils"
"libpulse-dev"
"pipewire"
"pipewire-pulse"
"dunst"
"docker.io"
)
git_urls=(
"https://github.com/stpettersens/neofetch"
"https://github.com/dylanaraps/pfetch"
"https://github.com/swindlesmccoop/dmenu"
"https://github.com/stpettersens/dwm"
"https://github.com/stpettersens/dwmblocks"
"https://github.com/falconindy/ponymix"
)
git_pkgs=(
"neofetch"
"pfetch"
"dmenu"
"dwm"
"dwmblocks"
"ponymix"
)
deb_urls=(
"https://github.com/Ulauncher/Ulauncher/releases/download/5.15.7/ulauncher_5.15.7_all.deb"
"https://github.com/sharkdp/bat/releases/download/v0.25.0/bat_0.25.0_amd64.deb"
"https://github.com/sharkdp/bat/releases/download/v0.25.0/bat_0.25.0_arm64.deb"
)
deb_pkgs=(
"ulauncher*all.deb"
"bat*amd64.deb"
"bat*arm64.deb"
)
check_armbian_system() {
cat /etc/os-release | grep Armbian
is_armbian=$?
if [[ $is_armbian == 1 ]] then
echo "This is not an Armbian system."
echo "Aborting..."
exit -1
fi
clear
}
update_packages() {
sudo apt-get update -y
sudo apt-get upgrade -y
}
install_apt_pkgs() {
for pkg in "${apt_pkgs[@]}"
do
sudo apt-get install -y $pkg
done
}
install_deb_pkg() {
grep $1 pkg.txt > /dev/null
pkg_match=$?8
if [ $pkg_match -eq 0 ]; then
wget $3
sudo dpkg -i $2
sudo apt-get install -f -y
fi
}
install_deb_pkgs() {
cd ~/BuildFromSrc
# Get machine architecture.
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="amd64"
elif [ $arch == "aarch64" ]; then
arch="arm64"
fi
i=0
for pkg in "${deb_pkgs[@]}"
do
# Dump package name for later check against machine architecture.
echo $pkg > pkg.txt
# Install package matching machine architecture (e.g. "amd64" in pkg name).
install_deb_pkg $arch $pkg ${deb_urls[$i]}
# Install package matching for all archiectures (e.g. "all" in pkg name).
install_deb_pkg "all" $pkg ${deb_urls[$i]}
i=$((i+1))
done
if [ -f "pkg.txt" ]; then
rm -f pkg.txt
fi
cd ~
}
install_git_pkgs() {
i=0
for pkg in "${git_pkgs[@]}"
do
cd ~/BuildFromSrc
git clone ${git_urls[$i]}
cd $pkg
# Apply patch to package's program if it exists.
if [ -f "$pkg.diff" ]; then
patch $pkg < $pkg.diff
fi
if { [ -f "brave.diff" ] && [ $pkg == "dwm" ]; }; then
patch config.h < brave.diff
fi
if [ -f "configure" ]; then
sh configure
fi
make all
sudo make install
cd ~
i=$((i+1))
done
}
install_brave() {
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt-get update -y
sudo apt-get install -y brave-browser
sudo ln -sf /usr/bin/brave /usr/bin/brave-browser
}
tealdeer_update_cache() {
tldr --update
}
log_source_pkgs() {
mkdir -p ~/.s
for pkg in "${git_pkgs[@]}"
do
touch ~/.s/$pkg
done
}
create_doas_file() {
echo "permit nopass :sudo" | sudo tee /etc/doas.conf
}
create_xinitrc_file() {
cat << EOF > ~/.xinitrc
#!/bin/sh
# startx
# start picom, dwmblocks, set wallpaper and run dwm:
set_wallpaper & dwmblocks & start-ulauncher &
exec dwm
EOF
}
start_pulseaudio_services() {
systemctl --user --now enable pipewire pipewire-pulse
}
init_dir() {
cd ~
mkdir -p ~/BuildFromSrc
}
finish() {
echo "Installed all, done."
}
install_all() {
check_armbian_system
update_packages
init_dir
install_apt_pkgs
install_deb_pkgs
install_git_pkgs
install_brave
tealdeer_update_cache
log_source_pkgs
create_doas_file
create_xinitrc_file
start_pulseaudio_services
finish
}
install_all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment