mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 14:42:37 +00:00
Compare commits
3 Commits
af7b46efa5
...
e972dd331c
| Author | SHA1 | Date | |
|---|---|---|---|
|
e972dd331c
|
|||
|
9c007c9434
|
|||
|
381a0450e5
|
104
run
104
run
@@ -2,81 +2,59 @@
|
||||
|
||||
# Adapted from https://github.com/ThePrimeagen/dev/blob/master/run
|
||||
#
|
||||
# Runs scripts in the `./runs` directory, which will install or uninstall
|
||||
# packages. It either runs a single script given an argument (filename in runs)
|
||||
# or all scripts in the runs directory.
|
||||
# Installs packages declared in the 'runs' directory, will run scripts matching the
|
||||
# file name in the 'runs/before' and 'runs/after', respectively, to handle setting up or
|
||||
# tearing down based on the run mode.
|
||||
#
|
||||
set -e
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$DEV_ENV" ]; then
|
||||
echo "env var DEV_ENV needs to be present"
|
||||
THIS_FILE=${BASH_SOURCE[0]}
|
||||
LOG_LABEL=$(basename $THIS_FILE)
|
||||
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
|
||||
|
||||
declare dry_run grepstr mode
|
||||
|
||||
log() {
|
||||
logging log --source "$THIS_FILE" --echo "$@"
|
||||
} && export -f log
|
||||
|
||||
############################## MAIN ##############################
|
||||
|
||||
# Setup logging file and label.
|
||||
source "$SCRIPTS/hypr/logging"
|
||||
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||
|
||||
[ -z "$DEV_ENV" ] &&
|
||||
log --error "env var DEV_ENV needs to be present" &&
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if i just did DEV_ENV=$(pwd) ./run then this is needed for the rest of the
|
||||
# scripts
|
||||
export DEV_ENV="$DEV_ENV"
|
||||
|
||||
grep=""
|
||||
grepstr=""
|
||||
dry_run="0"
|
||||
uninstall="0"
|
||||
mode="install"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
echo "ARG: \"$1\""
|
||||
|
||||
# Handle a --dry or --dry-run argument
|
||||
if [[ "$1" =~ ^--dry ]]; then
|
||||
dry_run="1"
|
||||
# Handle an --uninstall argument
|
||||
elif [[ "$1" =~ ^--u ]]; then
|
||||
uninstall="1"
|
||||
# Handle an --install argument (default)
|
||||
elif [[ ! "$1" =~ ^--i ]]; then
|
||||
grep="$1"
|
||||
elif [[ "$1" == "uninstall" ]]; then
|
||||
mode="uninstall"
|
||||
yayflags=("-Rns")
|
||||
elif [[ ! "$1" == "install" ]]; then
|
||||
grepstr="$1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
log() {
|
||||
if [[ $dry_run == "1" ]]; then
|
||||
echo "[DRY_RUN]: $1"
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
export DEV_ENV="$DEV_ENV"
|
||||
export LOG_ENABLE_DRY_RUN="$dry_run"
|
||||
export RUN_GREP_STR="$grepstr"
|
||||
export RUN_MODE="$mode"
|
||||
|
||||
run() {
|
||||
local script=$1
|
||||
local flag=$2
|
||||
log "running script: $script $flag"
|
||||
log "RUN: -- grep: '$grepstr'"
|
||||
|
||||
local actual_flags="-S --noconfirm"
|
||||
|
||||
if [[ $flag == "--uninstall" ]]; then
|
||||
actual_flags="-Rns"
|
||||
fi
|
||||
log "ok, here's the actual script:: $s $actual_flags"
|
||||
|
||||
if [[ $dry_run == "0" ]]; then
|
||||
$script $actual_flags
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
############################## MAIN ##############################
|
||||
|
||||
log "RUN: env: $env -- grep: $grep"
|
||||
|
||||
runs_dir=$(find $DEV_ENV/runs -mindepth 1 -maxdepth 1 -executable)
|
||||
|
||||
for s in $runs_dir; do
|
||||
if basename $s | grep -vq "$grep"; then
|
||||
log "grep \"$grep\" filtered out $s"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ $uninstall == "1" ]]; then
|
||||
run $s --uninstall
|
||||
else
|
||||
run $s --install
|
||||
fi
|
||||
done
|
||||
find "$DEV_ENV/runs" \
|
||||
-mindepth 1 \
|
||||
-maxdepth 1 \
|
||||
-type f \
|
||||
-exec bash -xc "$DEV_ENV/runs/utils/run-handler {}" \;
|
||||
|
||||
18
runs/after/clipse
Executable file
18
runs/after/clipse
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
|
||||
install() {
|
||||
log " Ensure clipse data directory exists, and start clipse."
|
||||
mkdir -p "$XDG_DATA_HOME/clipse" &>/dev/null
|
||||
setsid uwsm app -- clipse -listen
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
log " Removing clipse data directory."
|
||||
rm -rf "$XDG_DATA_HOME/clipse"
|
||||
}
|
||||
|
||||
arg=${1:-""}
|
||||
[[ $arg == "install" ]] && install && exit $?
|
||||
[[ $arg == "uninstall" ]] && uninstall && exit $?
|
||||
23
runs/after/dev
Executable file
23
runs/after/dev
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
install() {
|
||||
# TODO: Handle install / uninstall.
|
||||
bob install nightly &&
|
||||
bob install stable &&
|
||||
bob use nightly
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
echo "FIX ME!"
|
||||
}
|
||||
|
||||
arg=${1:-""}
|
||||
|
||||
if [[ $arg == "install" ]]; then
|
||||
install && exit $?
|
||||
elif [[ $arg == "uninstall" ]]; then
|
||||
uninstall && exit $?
|
||||
else
|
||||
# TODO: Using logging.
|
||||
echo "Error, invalid option" && exit 1
|
||||
fi
|
||||
15
runs/audio
Executable file → Normal file
15
runs/audio
Executable file → Normal file
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} pipewire \
|
||||
pavucontrol \
|
||||
wireplumber \
|
||||
pipewire-jack \
|
||||
pipewire-pulse \
|
||||
blueberry-wayland
|
||||
# Packages to install / uninstall with this run.
|
||||
pipewire
|
||||
pavucontrol
|
||||
wireplumber
|
||||
pipewire-jack
|
||||
pipewire-pulse
|
||||
blueberry-wayland
|
||||
|
||||
4
runs/before/dev
Executable file
4
runs/before/dev
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# yay -S --noconfirm --needed rustup
|
||||
# rustup default stable
|
||||
9
runs/before/yay
Executable file
9
runs/before/yay
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! command -v yay >/dev/null 2>&1; then
|
||||
sudo pacman -S --noconfirm --needed git base-devel
|
||||
git clone https://aur.archlinux.org/yay.git ~/yay
|
||||
cd ~/yay
|
||||
makepkg -si
|
||||
rm -rf ~/yay
|
||||
fi
|
||||
5
runs/brave
Executable file → Normal file
5
runs/brave
Executable file → Normal file
@@ -1,3 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} brave-bin
|
||||
# Packages to install / uninstall with this run.
|
||||
brave-bin
|
||||
|
||||
7
runs/clipse
Executable file → Normal file
7
runs/clipse
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} clipse
|
||||
# Packages to install / uninstall with this run.
|
||||
#
|
||||
# Clipse manages clipboard history.
|
||||
clipse
|
||||
|
||||
56
runs/dev
Executable file → Normal file
56
runs/dev
Executable file → Normal file
@@ -1,36 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! command -v yay >/dev/null 2>&1; then
|
||||
sudo pacman -S --noconfirm --needed git base-devel
|
||||
git clone https://aur.archlinux.org/yay.git ~/yay
|
||||
cd ~/yay
|
||||
makepkg -si
|
||||
rm -rf ~/yay
|
||||
fi
|
||||
|
||||
# Packages
|
||||
yay -S --noconfirm --needed \
|
||||
bat \
|
||||
bob \
|
||||
eza \
|
||||
fastfetch \
|
||||
fzf \
|
||||
git-lfs \
|
||||
gum \
|
||||
jq \
|
||||
neovim \
|
||||
nodejs \
|
||||
npm \
|
||||
pcre2 \
|
||||
ripgrep \
|
||||
starship \
|
||||
tldr \
|
||||
tmux \
|
||||
tree-sitter-cli \
|
||||
zoxide
|
||||
|
||||
bat
|
||||
bob
|
||||
eza
|
||||
fastfetch
|
||||
fzf
|
||||
git-lfs
|
||||
gum
|
||||
jq
|
||||
neovim
|
||||
nodejs
|
||||
npm
|
||||
pcre2
|
||||
ripgrep
|
||||
starship
|
||||
tldr
|
||||
tmux
|
||||
tree-sitter-cli
|
||||
yazi
|
||||
zoxide
|
||||
# Fonts
|
||||
yay -S --noconfirm \
|
||||
ttf-jetbrains-mono-nerd \
|
||||
ttf-firacode \
|
||||
ttf-inconsolata-nerd
|
||||
ttf-jetbrains-mono-nerd
|
||||
ttf-firacode
|
||||
ttf-inconsolata-ne
|
||||
|
||||
5
runs/espanso
Executable file → Normal file
5
runs/espanso
Executable file → Normal file
@@ -1,3 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} espanso-wayland-git
|
||||
# Packages to install / uninstall with this run.
|
||||
espanso-wayland-git
|
||||
|
||||
8
runs/ghostty
Executable file → Normal file
8
runs/ghostty
Executable file → Normal file
@@ -1,6 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Flags get passed in from the run script, but if
|
||||
# ran directly the default is going to be to install.
|
||||
|
||||
yay "${1:-"-S --noconfirm --needed"}" ghostty
|
||||
# Packages to install / uninstall with this run.
|
||||
ghostty-git
|
||||
|
||||
6
runs/gopass
Executable file → Normal file
6
runs/gopass
Executable file → Normal file
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm --needed"} gopass-git git-credential-gopass
|
||||
# Packages to install / uninstall with this run.
|
||||
gopass-git
|
||||
git-credential-gopass
|
||||
|
||||
18
runs/hyprland
Executable file → Normal file
18
runs/hyprland
Executable file → Normal file
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} hyprland-git \
|
||||
hyprpaper-git \
|
||||
hypridle-git \
|
||||
hyprlock-git \
|
||||
hyprlauncher-git \
|
||||
xdg-desktop-portal-hyprland-git \
|
||||
bc # used for some scripts.
|
||||
# Packages to install / uninstall with this run.
|
||||
hyprland-git
|
||||
hyprpaper-git
|
||||
hypridle-git
|
||||
hyprlock-git
|
||||
hyprlauncher-git
|
||||
xdg-desktop-portal-hyprland-git
|
||||
bc # used for some scripts.
|
||||
waybar
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} rustup
|
||||
|
||||
$DEV_ENV/env/.local/scripts/kanatactl bootstrap
|
||||
5
runs/localsend
Executable file → Normal file
5
runs/localsend
Executable file → Normal file
@@ -1,3 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} localsend-bin
|
||||
# Packages to install / uninstall with this run.
|
||||
localsend-bin
|
||||
|
||||
7
runs/nautilus
Executable file → Normal file
7
runs/nautilus
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} nautilus nautilus-share gvfs-smb
|
||||
# Packages to install / uninstall with this run.
|
||||
nautilus
|
||||
nautilus-share
|
||||
gvfs-smb
|
||||
|
||||
32
runs/neomutt
Executable file → Normal file
32
runs/neomutt
Executable file → Normal file
@@ -1,17 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Packages to install / uninstall with this run.
|
||||
|
||||
yay ${1:-"-S --noconfirm"} neomutt \
|
||||
abook \
|
||||
mutt-wizard \
|
||||
goimapnotify \
|
||||
lynx \
|
||||
notmuch \
|
||||
urlview \
|
||||
cronie \
|
||||
protonmail-bridge \
|
||||
isync \
|
||||
msmtp \
|
||||
pass \
|
||||
ca-certificates \
|
||||
gettext \
|
||||
cyrus-sasl-xoauth2-git
|
||||
neomutt
|
||||
abook
|
||||
mutt-wizard
|
||||
goimapnotify
|
||||
lynx
|
||||
notmuch
|
||||
urlview
|
||||
cronie
|
||||
protonmail-bridge
|
||||
isync
|
||||
msmtp
|
||||
pass
|
||||
ca-certificates
|
||||
gettext
|
||||
cyrus-sasl-xoauth2-git
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Needs installed from AUR.
|
||||
if [[ ! $(yay -Q libajantv2 2>/dev/null) ]]; then
|
||||
yay -S libajantv2
|
||||
fi
|
||||
|
||||
cd $HOME/pkgbuilds/obs-studio-arm && makepkg -si
|
||||
7
runs/podman
Executable file → Normal file
7
runs/podman
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} podman podman-docker podman-compose
|
||||
# Packages to install / uninstall with this run.
|
||||
podman
|
||||
podman-docker
|
||||
podman-compose
|
||||
|
||||
24
runs/system
Executable file → Normal file
24
runs/system
Executable file → Normal file
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} catppuccin-gtk-theme-mocha \
|
||||
nwg-look \
|
||||
wl-clipboard \
|
||||
pam-u2f \
|
||||
pcsc-tools \
|
||||
swaync \
|
||||
yubikey-manager \
|
||||
nfs-utils \
|
||||
firewalld \
|
||||
zsh
|
||||
# Packages to install / uninstall with this run
|
||||
catppuccin-gtk-theme-mocha
|
||||
kanata
|
||||
nwg-look
|
||||
wl-clipboard
|
||||
pam-u2f
|
||||
pcsc-tools
|
||||
swaync
|
||||
yubikey-manager
|
||||
nfs-utils
|
||||
firewalld
|
||||
zsh
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} thunderbird
|
||||
85
runs/utils/run-handler
Executable file
85
runs/utils/run-handler
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
declare file
|
||||
declare -a yayflags
|
||||
|
||||
THIS_FILE=${BASH_SOURCE[0]}
|
||||
LOG_LABEL=${LOG_LABEL:-$(basename $THIS_FILE)}
|
||||
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
|
||||
DEV_ENV=${DEV_ENV:-""}
|
||||
|
||||
MODE=${RUN_MODE:-"install"}
|
||||
DRY_RUN=${LOG_ENABLE_DRY_RUN:-"0"}
|
||||
GREP_STR=${RUN_GREP_STR:-""}
|
||||
|
||||
log() {
|
||||
logging log --source "$THIS_FILE" --echo "$@"
|
||||
} && export -f log
|
||||
|
||||
run_before_or_after() {
|
||||
local dir file run
|
||||
dir=${1:-""}
|
||||
run=${2:-""}
|
||||
|
||||
file=$(find "$dir" -mindepth 1 -maxdepth 1 -executable -name "$(basename "$run")" | head -1)
|
||||
if [[ -n "$file" ]]; then
|
||||
log " running $(basename "$dir") script: '$file'"
|
||||
[[ $DRY_RUN == "0" ]] && source "$file" "$mode"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local line pkg
|
||||
|
||||
log "RUN: file: $file"
|
||||
|
||||
if [[ -z $GREP_STR ]] || [[ $file =~ $GREP_STR ]]; then
|
||||
|
||||
log "${MODE}ing packages from: $file"
|
||||
|
||||
run_before_or_after "$DEV_ENV/runs/before" "$file"
|
||||
|
||||
# Loop over lines in the file and install the packages.
|
||||
while IFS= read -r line; do
|
||||
# Skip lines that begin with '#' (comments)
|
||||
if [[ ! $line =~ ^# ]]; then
|
||||
# Remove any inline comments.
|
||||
pkg=${line%% \#*}
|
||||
if [[ -n $pkg ]]; then
|
||||
log " pkg: '$pkg'"
|
||||
[[ $DRY_RUN == "0" ]] && yay "${yayflags[@]}" "$pkg"
|
||||
fi
|
||||
fi
|
||||
done <"$file"
|
||||
|
||||
run_before_or_after "$DEV_ENV/runs/after" "$file"
|
||||
else
|
||||
log "Grep filtered out: '$file'"
|
||||
fi
|
||||
}
|
||||
|
||||
############################## MAIN ##############################
|
||||
|
||||
# Setup logging file and label.
|
||||
source "$SCRIPTS/hypr/logging"
|
||||
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||
|
||||
file=${1:-""}
|
||||
yayflags=("-S" "--noconfirm" "--needed")
|
||||
|
||||
[[ -z "$DEV_ENV" ]] &&
|
||||
log --error "env var DEV_ENV needs to be present" && exit 1
|
||||
[[ ! -r $file ]] &&
|
||||
log --error "File not readable." && exit 1
|
||||
|
||||
# Change yay flags if mode is 'uninstall'
|
||||
[[ $MODE == "uninstall" ]] && yayflags=("-Rns")
|
||||
|
||||
# Ensure yay is installed before proceeding.
|
||||
[[ $DRY_RUN == "0" ]] && . "$DEV_ENV/runs/before/yay"
|
||||
|
||||
main
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yay ${1:-"-S --noconfirm"} waybar
|
||||
Reference in New Issue
Block a user