feat: Adds mail as a submodule, updates dev-env script to also install / update email config.

This commit is contained in:
2025-11-08 20:25:03 -05:00
parent 0045e6149c
commit 10987bd255
3 changed files with 81 additions and 64 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "mail"]
path = mail
url = ssh://git@git.housh.dev:2222/michael/mail.git

141
dev-env
View File

@@ -7,98 +7,108 @@
dry_run="0" dry_run="0"
if [ -z "$XDG_CONFIG_HOME" ]; then if [ -z "$XDG_CONFIG_HOME" ]; then
echo "no xdg config home" echo "no xdg config home"
echo "using ~/.config" echo "using ~/.config"
XDG_CONFIG_HOME=$HOME/.config XDG_CONFIG_HOME=$HOME/.config
fi fi
if [ -z "$XDG_DATA_HOME" ]; then if [ -z "$XDG_DATA_HOME" ]; then
echo "no xdg data home" echo "no xdg data home"
echo "using ~/.local/share" echo "using ~/.local/share"
XDG_DATA_HOME=$HOME/.local/share XDG_DATA_HOME=$HOME/.local/share
fi fi
if [ -z "$DEV_ENV" ]; then if [ -z "$DEV_ENV" ]; then
echo "env var DEV_ENV needs to be present" echo "env var DEV_ENV needs to be present"
exit 1 exit 1
fi fi
if [[ $1 =~ ^--dry ]]; then if [[ $1 =~ ^--dry ]]; then
dry_run="1" dry_run="1"
fi fi
log() { log() {
if [[ $dry_run == "1" ]]; then if [[ $dry_run == "1" ]]; then
echo "[DRY_RUN]: $1" echo "[DRY_RUN]: $1"
else else
echo "$1" echo "$1"
fi fi
} }
log "env: $DEV_ENV" log "env: $DEV_ENV"
# Removes a destination directory and copies all files to the destination. # Removes a destination directory and copies all files to the destination.
update_dirs() { update_dirs() {
log "copying over files from: $1" log "copying over files from: $1"
pushd $1 &>/dev/null pushd $1 &>/dev/null
( (
# Copy everything except systemd, share, and zsh folders, they need treated differently. # Copy everything except systemd, share, and zsh folders, they need treated differently.
configs=$( configs=$(
find . -mindepth 1 -maxdepth 1 -type d \ find . -mindepth 1 -maxdepth 1 -type d \
\( -name "systemd" -o -name "zsh" -o -name "share" -o -name "scripts" -o -name "kanata" \) \ \( -name "systemd" -o -name "zsh" -o -name "share" -o -name "scripts" -o -name "kanata" \) \
-prune -o -type d -print -prune -o -type d -print
) )
for c in $configs; do for c in $configs; do
directory=${2%/}/${c#./} directory=${2%/}/${c#./}
log " removing: rm -rf $directory" log " removing: rm -rf $directory"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
rm -rf $directory rm -rf $directory
fi fi
log " copying env: cp $c $2" log " copying env: cp $c $2"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
cp -r ./$c $2 cp -r ./$c $2
fi fi
done done
) )
popd &>/dev/null popd &>/dev/null
} }
# Removes a destination file and copies a single file to the destination. # Removes a destination file and copies a single file to the destination.
copy() { copy() {
log "removing: $2" log "removing: $2"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
rm $2 &>/dev/null rm $2 &>/dev/null
fi fi
log "copying: $1 to $2" log "copying: $1 to $2"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
cp $1 $2 cp $1 $2
fi fi
} }
# Copy all files from a directory into another directory. # Copy all files from a directory into another directory.
copy_files() { copy_files() {
log "copying over files from: $1" log "copying over files from: $1"
pushd "$1" &>/dev/null || exit 1 pushd "$1" &>/dev/null || exit 1
( (
for f in $(find . -mindepth 1 -maxdepth 1 -type f); do for f in $(find . -mindepth 1 -maxdepth 1 -type f); do
declare dest declare dest
dest="$2/$(basename "$f")" dest="$2/$(basename "$f")"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
rm -rf $dest >/dev/null 2>&1 rm -rf $dest >/dev/null 2>&1
fi fi
log " copying env: cp $f $dest" log " copying env: cp $f $dest"
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
cp $f $dest cp $f $dest
fi fi
done done
) )
popd &>/dev/null || exit 1 popd &>/dev/null || exit 1
}
email() {
if command -v mailctl; then
log "Updating using mailctl..."
[[ $dry_run == "0" ]] && mailctl update && mailctl config
else
log "Installing mailctl..."
[[ $dry_run == "0" ]] && . "$DEV_ENV/mail/install"
fi
} }
############################## MAIN ############################## ############################## MAIN ##############################
@@ -154,9 +164,12 @@ copy_files $DEV_ENV/env/.local/share/applications/icons $XDG_DATA_HOME/applicati
mkdir $HOME/pkgbuilds mkdir $HOME/pkgbuilds
update_dirs $DEV_ENV/env/pkgbuilds $HOME/pkgbuilds update_dirs $DEV_ENV/env/pkgbuilds $HOME/pkgbuilds
# Email.
email
if [[ $dry_run == "0" ]]; then if [[ $dry_run == "0" ]]; then
systemctl --user daemon-reload systemctl --user daemon-reload
hyprctl reload hyprctl reload
espanso service restart espanso service restart
exec zsh -l exec zsh -l
fi fi

1
mail Submodule

Submodule mail added at 013f3c7c18