aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2024-04-12 16:06:30 -0500
committerMatt Singleton <matt@xcolour.net>2024-04-12 16:06:30 -0500
commit4008fa4f12d6688c580a78980e4722899a84498c (patch)
tree8f200c8118fa7c87d5b270741f659cf6b4d818ae
parentf2dfde23f8157da1532a2b2e236af529fed47713 (diff)
Update Makefile to manage fedora/sway-de config
-rw-r--r--.gitignore5
-rw-r--r--Makefile68
-rw-r--r--README.md33
-rwxr-xr-xcleanup.sh32
-rw-r--r--local/duplicity-config4
-rw-r--r--local/duplicity-excludes5
-rw-r--r--local/vimrc-local0
-rwxr-xr-xstow/duplicity/.local/bin/backup27
-rw-r--r--stow/duplicity/.local/share/systemd/user/backup.service7
-rw-r--r--stow/duplicity/.local/share/systemd/user/backup.timer9
-rwxr-xr-xsway-de/install.sh85
-rw-r--r--sway-de/udiskie/.config/systemd/user/udiskie.service (renamed from sway-de/udiskie/.local/share/systemd/user/udiskie.service)0
-rw-r--r--sway-de/xdg-names/.config/systemd/user/xdg-names.service (renamed from sway-de/xdg-names/.local/share/systemd/user/xdg-names.service)0
13 files changed, 84 insertions, 191 deletions
diff --git a/.gitignore b/.gitignore
index fd22466..de63cc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-stow/zsh/.config/zsh/00-local.zsh
stow/git/.config/git/config-local
-stow/duplicity/.config/duplicity/config
-stow/duplicity/.config/duplicity/excludes
+stow/vim/.vimrc-local
+stow/zsh/.config/zsh/00-local.zsh
diff --git a/Makefile b/Makefile
index bbdaf73..6f6fc48 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,66 @@
REPO_CHANGES := $(shell git status --porcelain | wc -l)
+DEV_MODE := 0
+IS_FEDORA := $(shell command -v dnf > /dev/null && test -f /etc/fedora-release; echo $$?)
.PHONY: .initialize
.initialize:
ifneq ($(REPO_CHANGES),0)
- $(error cannot run with a dirty repo. stash or commit changes.)
+ifeq ($(DEV_MODE),0)
+ $(error will not run with a dirty repo. stash or commit changes, or re-run with DEV_MODE=1.)
+endif
endif
git submodule update --init --recursive
-
-.PHONY: .local
-.local:
- mkdir -p stow/duplicity/.config/duplicity
- cp --update=none local/duplicity-config stow/duplicity/.config/duplicity/config
- cp --update=none local/duplicity-excludes stow/duplicity/.config/duplicity/excludes
+ cp --update=none local/vimrc-local stow/vim/.vimrc-local
cp --update=none local/gitconfig-local stow/git/.config/git/config-local
cp --update=none local/local.zsh stow/zsh/.config/zsh/00-local.zsh
.PHONY: console
-console: .initialize .local
- stow --adopt --dir=stow --target=${HOME} console-utils
- stow --adopt --dir=stow --target=${HOME} dircolors
- stow --adopt --dir=stow --target=${HOME} git
- stow --adopt --dir=stow --target=${HOME} vim
- stow --adopt --dir=stow --target=${HOME} zsh
- stow --adopt --dir=stow --target=${HOME} duplicity
+console: .initialize
+ stow --adopt --dir=stow --target=$(HOME) console-utils
+ stow --adopt --dir=stow --target=$(HOME) dircolors
+ stow --adopt --dir=stow --target=$(HOME) git
+ stow --adopt --dir=stow --target=$(HOME) vim
+ stow --adopt --dir=stow --target=$(HOME) zsh
+
+.PHONY: fedora-packages
+fedora-packages:
+ifneq ($(IS_FEDORA),0)
+ $(warning not fedora workstation, skipping.)
+else
+ sudo dnf install \
+ "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(shell rpm -E %fedora).noarch.rpm" \
+ "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(shell rpm -E %fedora).noarch.rpm"
+ sudo dnf install \
+ sway waybar rofi-wayland foot mako intel-one-mono-fonts \
+ udiskie libappindicator-gtk3 python3-b2sdk pass passmenu \
+ vlc unzip vim wget git zsh stow dnf-automatic \
+ grimshot pulseaudio-utils thunar pavucontrol-qt \
+ network-manager-applet
+endif
+
+.PHONY: fedora
+fedora: console
+ifneq ($(IS_FEDORA),0)
+ $(warning not fedora workstation, skipping.)
+else
+ stow --adopt --dir=sway-de --target=$(HOME) foot
+ stow --adopt --dir=sway-de --target=$(HOME) mako
+ stow --adopt --dir=sway-de --target=$(HOME) rofi
+ stow --adopt --dir=sway-de --target=$(HOME) sway
+ stow --adopt --dir=sway-de --target=$(HOME) swaylock
+ stow --adopt --dir=sway-de --target=$(HOME) udiskie
+ stow --adopt --dir=sway-de --target=$(HOME) waybar
+ stow --adopt --dir=sway-de --target=$(HOME) xdg-names
+ifeq ($(shell systemctl --user is-active sway-session.target),active)
+ systemctl --user enable --now udiskie.service
+ systemctl --user enable --now xdg-names.service
+else
+ systemctl --user enable udiskie.service
+ systemctl --user enable xdg-names.service
+endif
+ sudo systemctl enable --now dnf-automatic-install.timer
+endif
+.PHONY: restore
restore:
- git restore .
+ git restore stow sway-de
diff --git a/README.md b/README.md
index 0c8d64f..f6b672b 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,14 @@
-Install dotfiles with the deploy script:
-
- $ sh deploy.sh
-
-Tries to follow the [XDG base directory
-spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
-as much as possible.
-
-The script does the following:
-
- * Clear out `$PWD/dotfiles-backup/`.
- * Symlink everything under `config` into `$XDG_CONFIG_HOME`. Moves everything
- that already exists to `$PWD/dotfiles-backup/` first.
- * Symlink everything under `home` into `$HOME`. Again back up existing files to
- `$PWD/dotfiles-backup`.
- * Clone Vundle into `~/.vim/bundle/vundle/` and run `BundleInstall`.
- * Copy files under `local` into the appropriate locations only if they don't
- already exist. These are for handling local configuration that shouldn't or
- can't be version controlled.
+Manages dotfiles with stow and make.
+
+Make targets:
+ * `console`: configs for os-independent cli tools
+ * `fedora-packages`: install rpmfusion and fedora packages (standalone, should
+ only need to be run once unless new packages or repos are added)
+ * `fedora`: configs for fedora-specific gui tools (depends on `console`)
+ * `restore`: restore committed versions of files in `stow\` and `sway-de/`
+
+Note: stow is run with the `--adopt` option, which will overwrite files in the
+stow directory with the version that would be replaced with a symlink. You can
+do a `git diff` to see the differences and if you don't care about them you can
+quickly revert to the committed versions with `make restore`. Makefile will do
+it's best to abort if there are uncommitted changes in the repo.
diff --git a/cleanup.sh b/cleanup.sh
index a0d6944..7061e55 100755
--- a/cleanup.sh
+++ b/cleanup.sh
@@ -9,21 +9,19 @@
set -euo pipefail
-to_delete="
-.local/bin/color_test
-.local/bin/utf8_demo
-.config/dircolors.conf
-.config/git
-.vim/autoload
-.vim/plugged
-.vimrc
-.config/zsh
-.zshenv
-.local/bin/backup
-.local/share/systemd/user/backup.service
-.local/share/systemd/user/backup.timer
-"
+# symlinks
+rm -f "$HOME/.config/dircolors.conf"
+rm -f "$HOME/.config/git"
+rm -f "$HOME/.config/zsh"
+rm -f "$HOME/.local/bin/backup"
+rm -f "$HOME/.local/bin/color_test"
+rm -f "$HOME/.local/bin/utf8_demo"
+rm -f "$HOME/.local/share/systemd/user/backup.service"
+rm -f "$HOME/.local/share/systemd/user/backup.timer"
+rm -f "$HOME/.vimrc"
+rm -f "$HOME/.zshenv"
-for i in $to_delete; do
- rm -rf "$HOME/${i:?}"
-done
+# directories
+rm -rf "$HOME/.vim/autoload"
+rm -rf "$HOME/.vim/bundle"
+rm -rf "$HOME/.vim/plugged"
diff --git a/local/duplicity-config b/local/duplicity-config
deleted file mode 100644
index f9607b0..0000000
--- a/local/duplicity-config
+++ /dev/null
@@ -1,4 +0,0 @@
-PASSPHRASE=
-FTP_PASSWORD=
-B2_KEY_ID=
-B2_BUCKET=
diff --git a/local/duplicity-excludes b/local/duplicity-excludes
deleted file mode 100644
index 122b565..0000000
--- a/local/duplicity-excludes
+++ /dev/null
@@ -1,5 +0,0 @@
-/home/matt/Downloads
-/home/matt/.local
-/home/matt/.cache
-/home/matt/.mozilla
-/home/matt/.wine
diff --git a/local/vimrc-local b/local/vimrc-local
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/local/vimrc-local
diff --git a/stow/duplicity/.local/bin/backup b/stow/duplicity/.local/bin/backup
deleted file mode 100755
index 6324c05..0000000
--- a/stow/duplicity/.local/bin/backup
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-set -euo pipefail
-
-set -o allexport
-# shellcheck source=../../.config/duplicity/config
-source ~/.config/duplicity/config
-set +o allexport
-
-source_directory=~
-excludes=~/.config/duplicity/excludes
-target_url=b2://"$B2_KEY_ID"@"$B2_BUCKET"
-
-# take a new full backup every month, incremental otherwise
-duplicity backup --full-if-older-than 1M --exclude-filelist "$excludes" "$source_directory" "$target_url"
-
-# keep 12 months of full backups
-duplicity remove-all-but-n-full 12 --force "$target_url"
-
-# keep 3 months of incremental backups
-duplicity remove-all-inc-of-but-n-full 3 --force "$target_url"
-
-# cleanup
-duplicity cleanup --force "$target_url"
-
-# show collection status
-duplicity collection-status "$target_url"
diff --git a/stow/duplicity/.local/share/systemd/user/backup.service b/stow/duplicity/.local/share/systemd/user/backup.service
deleted file mode 100644
index c1adfde..0000000
--- a/stow/duplicity/.local/share/systemd/user/backup.service
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-Description=Backup with duplicity
-After=network.target
-
-[Service]
-Type=oneshot
-ExecStart=bash ${HOME}/.local/bin/backup
diff --git a/stow/duplicity/.local/share/systemd/user/backup.timer b/stow/duplicity/.local/share/systemd/user/backup.timer
deleted file mode 100644
index b7815d6..0000000
--- a/stow/duplicity/.local/share/systemd/user/backup.timer
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Run backup every four hours
-
-[Timer]
-OnCalendar=*-*-* 0/4:15
-Persistent=true
-
-[Install]
-WantedBy=timers.target
diff --git a/sway-de/install.sh b/sway-de/install.sh
deleted file mode 100755
index ccef98f..0000000
--- a/sway-de/install.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-#
-# Designed for Fedora Workstation
-#
-# Installs and configures sway and related tools to provide a richer
-# "desktop environment" style session. Relies on systemd for running
-# services as much as possible.
-
-set -euo pipefail
-
-script_path="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-if [ ! "$(pwd)" = "$script_path" ]; then
- echo "expects to be run from the root sway-de directory"
- exit 1
-fi
-
-if ! command -v dnf > /dev/null !! [ ! -f /etc/fedora-release ]; then
- echo "doesn't seem to be fedora workstation"
- exit 1
-fi
-
-
-# give the option to skip installing packages since dnf can be slow
-skip_packages=""
-while [[ $# -gt 0 ]]; do
- case $1 in
- --skip-packages)
- skip_packages=1
- shift
- ;;
- *)
- shift
- ;;
- esac
-done
-
-if [ -z "$skip_packages" ]; then
-
- # install rpmfusion if it's not already installed
- repos_installed="$(dnf --cacheonly repolist | tail -n+2 | cut -f1 -d' ' | awk '/(^rpmfusion-free$)|(^rpmfusion-nonfree$)/' | wc -l)"
- if [ "$repos_installed" -lt "2" ]; then
- sudo dnf install \
- "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" \
- "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
- fi
-
- # install packages
- sudo dnf install \
- sway waybar rofi-wayland foot mako \
- udiskie libappindicator-gtk3 duplicity python3-b2sdk pass passmenu \
- vlc unzip vim wget git zsh stow dnf-automatic \
- grimshot pulseaudio-utils thunar pavucontrol-qt \
- network-manager-applet
-
-fi
-
-# make sure stow is installed.
-# it should be at this point, so if it's not, die with a message
-# to re-run without skipping the package install step.
-STOWCMD=""
-if command -v stow > /dev/null; then
- STOWCMD="stow"
-fi
-if [ -z "$STOWCMD" ]; then
- echo "requires 'stow'. run without '--skip-packages' to install."
- exit 1
-fi
-
-# use stow to install config files
-$STOWCMD \
- --dir "$(pwd)" \
- --target "$HOME" \
- foot mako rofi sway swaylock udiskie waybar xdg-names
-
-# enable new systemd units and start them if sway is running
-for unit in udiskie.service xdg-names.service; do
- if systemctl --user is-active sway-session.target; then
- systemctl --user enable --now "$(basename "$unit")"
- else
- systemctl --user enable "$(basename "$unit")"
- fi
-done
-
-# enable dnf automatic updates
-sudo systemctl enable --now dnf-automatic-install.timer
diff --git a/sway-de/udiskie/.local/share/systemd/user/udiskie.service b/sway-de/udiskie/.config/systemd/user/udiskie.service
index ba7e7f0..ba7e7f0 100644
--- a/sway-de/udiskie/.local/share/systemd/user/udiskie.service
+++ b/sway-de/udiskie/.config/systemd/user/udiskie.service
diff --git a/sway-de/xdg-names/.local/share/systemd/user/xdg-names.service b/sway-de/xdg-names/.config/systemd/user/xdg-names.service
index 799431b..799431b 100644
--- a/sway-de/xdg-names/.local/share/systemd/user/xdg-names.service
+++ b/sway-de/xdg-names/.config/systemd/user/xdg-names.service