From 0f1df0db903ba576fd17b08197d3066af7a61e5f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 18 Nov 2023 23:23:40 +0100 Subject: A lot of changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 2 + Makefile | 24 +++-- asroot-libpassphrase | 1 + asroot/Makefile | 10 +- asroot/bash-aliases | 4 +- atril-gtk2 | 1 + atril/Makefile | 7 +- audacity/Makefile | 6 +- base-files | 1 + base/Makefile | 59 ++++++---- base/new-c-proj | 222 -------------------------------------- base/profile | 86 --------------- base/profile-North | 5 - base/user-profile | 86 +++++++++++++++ base/user-profile-North | 5 + base/user-profile-Zenith | 4 + base/xinit | 7 ++ bash-completion/Makefile | 8 +- bash/Makefile | 33 +++--- bash/aliases-Zenith | 49 ++++++--- bash/bashrc_prompt | 16 +-- bus/Makefile | 9 +- caja-gtk2 | 1 + caja/Makefile | 15 ++- caja/c | 6 +- caja/c-Zenith | 1 + caja/thunar | 18 ++++ cargo | 1 + cat-nonbackups | 15 +++ check-any-installed | 25 +++++ check-in-path | 3 + check-installed | 20 ++++ check-installed-shebang | 25 +++++ claws-mail/Makefile | 6 +- common.mk | 3 - coreutils/Makefile | 10 +- cvs/Makefile | 6 +- dbus/Makefile | 7 +- dbus/xinit | 4 + dconf-cli | 1 + dconf/Makefile | 8 +- dmenu/Makefile | 18 ++-- dmenu/man | 39 ------- dmenu/plumb | 4 + element-desktop/Makefile | 14 +-- element-desktop/bash-aliases | 46 +++++--- emacs-gtk | 1 + emacs-gtk2 | 1 + emacs-lucid | 1 + emacs-nox | 1 + emacs/Makefile | 27 +++-- emacs/init-gdb.el | 1 + featherweight/Makefile | 6 +- ffmpeg/Makefile | 6 +- filesystem/Makefile | 18 ++-- gcc/Makefile | 4 +- git/.gitignore | 1 + git/Makefile | 16 ++- git/new-c-proj | 222 ++++++++++++++++++++++++++++++++++++++ gnupg/Makefile | 10 +- google-chrome/Makefile | 4 +- gpm/Makefile | 6 +- grep/Makefile | 6 +- gtk3/Makefile | 6 +- java-common | 1 + java-runtime/Makefile | 7 +- kdenlive/Makefile | 4 +- less/Makefile | 6 +- libcontacts/Makefile | 12 +-- libreadline-glibc | 1 + libreadline-musl | 1 + man-db | 1 + man/Makefile | 18 ++++ man/colourised-less-for-man | 22 ++++ man/man | 44 ++++++++ meld-gtk2 | 1 + meld/Makefile | 5 +- moc/Makefile | 6 +- mplayer/Makefile | 8 +- my-scripts/Makefile | 7 +- my-scripts/bash-aliases | 2 + openssh | 1 + openssh/Makefile | 24 ----- openssh/bash-aliases | 9 -- pluma-gtk2 | 1 + pluma/Makefile | 5 +- pony.computer/Makefile | 7 +- pony.computer/bash-aliases | 2 +- ponysay/Makefile | 6 +- ponysay/bash-aliases | 2 +- procps/Makefile | 4 +- pytagomacs/Makefile | 6 +- python/Makefile | 4 +- qt5-style-plugins | 1 + qt5-styleplugins/Makefile | 8 +- qt5-styleplugins/user-profile | 4 +- radharc/Makefile | 11 +- radharc/radharc | 9 +- readline-common | 1 + readline/Makefile | 19 ++-- rotd/Makefile | 4 +- rust/Makefile | 11 +- signal-desktop/Makefile | 14 +-- signal-desktop/bash-aliases | 46 +++++--- ssh | 1 - ssh/.gitignore | 1 + ssh/Makefile | 54 ++++++++++ ssh/bash-aliases | 24 +++++ st/Makefile | 6 +- st/st | 2 + suckless-tools/Makefile | 9 ++ sudo/Makefile | 6 +- texinfo/Makefile | 19 ++-- texlive-base | 1 + texlive-bin/Makefile | 7 +- twm | 1 + vlc/Makefile | 4 +- wget/Makefile | 4 +- wire-desktop/Makefile | 14 +-- wire-desktop/bash-aliases | 46 +++++--- x11-xserver-utils/Makefile | 13 +++ xinit | 1 + xmonad/Makefile | 35 +++--- xmonad/xinit | 32 +++++- xorg-server/Makefile | 34 ++++-- xorg-server/xkbdbind.config.h.gpp | 9 +- xorg-twm/Makefile | 7 +- xorg-twm/twmrc | 2 +- xorg-xinit/Makefile | 30 +++--- xorg-xinit/xinitrc | 6 -- xorg-xrandr/Makefile | 24 +++-- xorg-xrandr/resolution-changed | 20 ++++ xorg-xrandr/xinit | 2 +- xorg-xrdb/Makefile | 9 +- xorg-xset/Makefile | 9 +- xorg-xsetroot/Makefile | 9 +- xpybar/Makefile | 8 +- xrandr | 1 + xrdb | 1 + xserver-xorg-core | 1 + xset | 1 + xsetroot | 1 + xwallpaper/Makefile | 11 +- yaourt/Makefile | 6 +- yt-dlp/Makefile | 11 ++ yt-dlp/bash-aliases | 3 + zathura/Makefile | 4 +- 147 files changed, 1260 insertions(+), 852 deletions(-) create mode 120000 asroot-libpassphrase create mode 120000 atril-gtk2 create mode 120000 base-files delete mode 100755 base/new-c-proj delete mode 100644 base/profile delete mode 100644 base/profile-North create mode 100644 base/user-profile create mode 100644 base/user-profile-North create mode 100644 base/user-profile-Zenith create mode 100644 base/xinit create mode 120000 caja-gtk2 create mode 120000 caja/c-Zenith create mode 100755 caja/thunar create mode 120000 cargo create mode 100755 cat-nonbackups create mode 100755 check-any-installed create mode 100755 check-in-path create mode 100755 check-installed create mode 100755 check-installed-shebang delete mode 100644 common.mk create mode 120000 dconf-cli delete mode 100755 dmenu/man create mode 120000 emacs-gtk create mode 120000 emacs-gtk2 create mode 120000 emacs-lucid create mode 120000 emacs-nox create mode 100644 emacs/init-gdb.el create mode 100644 git/.gitignore create mode 100755 git/new-c-proj create mode 120000 java-common create mode 120000 libreadline-glibc create mode 120000 libreadline-musl create mode 120000 man-db create mode 100644 man/Makefile create mode 100755 man/colourised-less-for-man create mode 100755 man/man create mode 120000 meld-gtk2 create mode 120000 openssh delete mode 100644 openssh/Makefile delete mode 100644 openssh/bash-aliases create mode 120000 pluma-gtk2 create mode 120000 qt5-style-plugins create mode 120000 readline-common delete mode 120000 ssh create mode 100644 ssh/.gitignore create mode 100644 ssh/Makefile create mode 100644 ssh/bash-aliases create mode 100644 suckless-tools/Makefile create mode 120000 texlive-base create mode 120000 twm create mode 100644 x11-xserver-utils/Makefile create mode 120000 xinit create mode 100755 xorg-xrandr/resolution-changed create mode 120000 xrandr create mode 120000 xrdb create mode 120000 xserver-xorg-core create mode 120000 xset create mode 120000 xsetroot create mode 100644 yt-dlp/Makefile create mode 100644 yt-dlp/bash-aliases diff --git a/.gitignore b/.gitignore index 150ed0a..08168cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *\#* *~ +.private/ .secrets/ +.work/ diff --git a/Makefile b/Makefile index d8e10bb..1c80c03 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,22 @@ .POSIX: -CHECK_INSTALLED = pacman -Qq -- /dev/null - update: - @for PKG in *; do \ + +@for PKG in *; do \ if test -d "$${PKG}"; then \ - if $(CHECK_INSTALLED) $${PKG} 2>/dev/null ; then \ - printf -- '\033[1mmake -C %s install\033[m\n' "$${PKG}"; \ - make -C "$${PKG}" CHECK_INSTALLED="$(CHECK_INSTALLED)" install; \ + if ./check-installed "$${PKG}" 2>/dev/null; then \ + if ! ./check-installed "$$(readlink -- "$${PKG}")" 2>/dev/null; then \ + printf -- '\033[1mcd %s && %s install\033[m\n' "$${PKG}" '$(MAKE)'; \ + (cd -- "$${PKG}" && $(MAKE) install); \ + fi; \ else\ - printf -- '\033[1mmake -C %s uninstall\033[m\n' "$${PKG}"; \ - make -C "$${PKG}" CHECK_INSTALLED="$(CHECK_INSTALLED)" uninstall; \ + printf -- '\033[1mcd %s && %s uninstall\033[m\n' "$${PKG}" '$(MAKE)'; \ + (cd -- "$${PKG}" && $(MAKE) uninstall || :); \ fi; \ fi; \ done - -.PHONY: update + +if test -f .private/pkgs/Makefile || test -f .private/pkgs/makefile; then \ + cd -- .private/pkgs && $(MAKE); \ + fi + +if test -f .work/pkgs/Makefile || test -f .work/pkgs/makefile; then \ + cd -- .work/pkgs && $(MAKE); \ + fi diff --git a/asroot-libpassphrase b/asroot-libpassphrase new file mode 120000 index 0000000..53c8660 --- /dev/null +++ b/asroot-libpassphrase @@ -0,0 +1 @@ +asroot \ No newline at end of file diff --git a/asroot/Makefile b/asroot/Makefile index 2970579..4fe44ed 100644 --- a/asroot/Makefile +++ b/asroot/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: - mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/asroot + mkdir -p -- ~/.config/bash/aliases.d/ + test ! -e ~/.config/bash/aliases.d/asroot || test -L ~/.config/bash/aliases.d/asroot ln -sf -- ~/.dotfiles/asroot/bash-aliases ~/.config/bash/aliases.d/asroot uninstall: + +! ../check-installed asroot -unlink -- ~/.config/bash/aliases.d/asroot - -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall + -rmdir -- ~/.config/bash/aliases.d/ diff --git a/asroot/bash-aliases b/asroot/bash-aliases index 6b20486..80100dd 100644 --- a/asroot/bash-aliases +++ b/asroot/bash-aliases @@ -1,4 +1,4 @@ # -*- shell-script -*- -#DESCRIPTION: Run a command under `asroot` -alias _="asroot" +#DESCRIPTION: Run a command under `asroot` for run as user 0 +alias _=asroot diff --git a/atril-gtk2 b/atril-gtk2 new file mode 120000 index 0000000..49b3633 --- /dev/null +++ b/atril-gtk2 @@ -0,0 +1 @@ +atril \ No newline at end of file diff --git a/atril/Makefile b/atril/Makefile index e702482..771c4f4 100644 --- a/atril/Makefile +++ b/atril/Makefile @@ -1,13 +1,12 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/atril - test ! -d ~/.config/atril/atril_toolbar.xml + test ! -e ~/.config/atril/atril_toolbar.xml || test -L ~/.config/atril/atril_toolbar.xml ln -sf -- ~/.dotfiles/atril/atril_toolbar.xml ~/.config/atril/atril_toolbar.xml uninstall: + +! ../check-installed atril + +! ../check-installed atril-gtk2 -unlink -- ~/.config/atril/atril_toolbar.xml -rm -rf -- ~/.config/atril - -.PHONY: install uninstall diff --git a/audacity/Makefile b/audacity/Makefile index 473996c..87359d9 100644 --- a/audacity/Makefile +++ b/audacity/Makefile @@ -1,19 +1,17 @@ .POSIX: -include ../common.mk # Audacity heavily edits audacity.cfg so we make copy it instead of linking it install: mkdir -p -- ~/.var/lib/audacity mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/audacity + test ! -e ~/.config/profile.d/audacity || test -L ~/.config/profile.d/audacity ln -sf -- ~/.dotfiles/audacity/user-profile ~/.config/profile.d/audacity cp -- audacity.cfg ~/.var/lib/audacity/ uninstall: + +! ../check-installed audacity -unlink -- ~/.config/profile.d/audacity -rmdir -- ~/.config/profile.d -rm -rf -- ~/.var/lib/audacity -rm -rf -- /var/tmp/"audacity-$$(whoami)" - -.PHONY: install uninstall diff --git a/base-files b/base-files new file mode 120000 index 0000000..7e352df --- /dev/null +++ b/base-files @@ -0,0 +1 @@ +filesystem \ No newline at end of file diff --git a/base/Makefile b/base/Makefile index 365bde6..9752ef1 100644 --- a/base/Makefile +++ b/base/Makefile @@ -1,20 +1,26 @@ .POSIX: -include ../common.mk FACE = penguin.png +XINITRC_ORDER = 90 + install: mkdir -p -- ~/.config - test ! -d ~/.profile - test ! -d ~/.config/profile - test ! -d ~/.config/profile-North - test ! -d ~/.config/user-dirs.locale - test ! -d ~/.config/face - test ! -d ~/.face - test ! -d ~/.face.icon + test ! -e ~/.profile || test -L ~/.profile + test ! -e ~/.config/user-profile || test -L ~/.config/profile + test ! -e ~/.config/user-profile-North || test -L ~/.config/profile-North + test ! -e ~/.config/user-profile-Zenith || test -L ~/.config/profile-Zenith + test ! -e ~/.config/user-dirs.locale || test -L ~/.config/user-dirs.locale + test ! -e ~/.config/face || test -L ~/.config/face || \ + sha256sum faces/* | cut -d ' ' -f 1 | grep "$(sha256sum -- ~/.config/face | cut -d ' ' -f 1)" > /dev/null + test ! -e ~/.face || test -L ~/.face || \ + sha256sum faces/* | cut -d ' ' -f 1 | grep "$(sha256sum -- ~/.face | cut -d ' ' -f 1)" > /dev/null + test ! -e ~/.face.icon || test -L ~/.face.icon || \ + sha256sum faces/* | cut -d ' ' -f 1 | grep "$(sha256sum -- ~/.face.icon | cut -d ' ' -f 1)" > /dev/null ln -sf -- .config/profile ~/.profile - ln -sf -- ~/.dotfiles/base/profile ~/.config/profile - ln -sf -- ~/.dotfiles/base/profile-North ~/.config/profile-North + ln -sf -- ~/.dotfiles/base/user-profile ~/.config/profile + ln -sf -- ~/.dotfiles/base/user-profile-North ~/.config/profile-North + ln -sf -- ~/.dotfiles/base/user-profile-Zenith ~/.config/profile-Zenith ln -sf -- ~/.dotfiles/base/user-dirs.locale ~/.config/ ln -sf -- ~/.dotfiles/base/faces/$(FACE) ~/.config/face ln -sf -- .config/face ~/.face @@ -25,28 +31,39 @@ install: test ! -e ~/.config/locations && \ ln -s -- ~/.dotfiles/.secrets/locations ~/.config/locations; \ fi - test ! -d ~/.config/geolocation - test ! -d ~/.config/metar + test ! -e ~/.config/geolocation || test -L ~/.config/geolocation + test ! -e ~/.config/metar || test -L ~/.config/metar test -L ~/.config/locations/current || test ! -e ~/.config/locations/current test -L ~/.config/locations/current || ln -sf default ~/.config/locations/current ln -sf locations/current/geolocation ~/.config/geolocation ln -sf locations/current/metar ~/.config/metar mkdir -p -- ~/.local/bin test ! -d ~/.local/bin/iswork - test -x /bin/false - ln -sf -- /bin/false ~/.local/bin/iswork - ln -sf ~/.dotfiles/base/new-c-proj ~/.local/bin/ - test ! -r ../.secrets/bin/Makefile || make -C ../.secrets/bin install + test -x /bin/false && test -x /bin/true + if test -e "../.secrets/workmachine-$$(hostname)"; then \ + ln -sf -- /bin/true ~/.local/bin/iswork; \ + else \ + ln -sf -- /bin/false ~/.local/bin/iswork; \ + fi + test ! -r ../.secrets/bin/Makefile || (cd ../.secrets/bin && $(MAKE) install) + mkdir -p -- ~/.config/X11/xinit/xinitrc.d + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-base || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-base + ln -sf -- ~/.dotfiles/base/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-base uninstall: - -unlink -- ~/.config/profile + +! ../check-installed base + -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-base + -rmdir -- ~/.config/X11/xinit/xinitrc.d + -rmdir -- ~/.config/X11/xinit + -rmdir -- ~/.config/X11 + -unlink -- ~/.config/user-profile + -unlink -- ~/.config/user-profile-North + -unlink -- ~/.config/user-profile-Zenith -unlink -- ~/.config/user-dirs.locale -unlink -- ~/.profile -unlink -- ~/.config/locations -unlink -- ~/.config/geolocation -unlink -- ~/.config/metar -unlink -- ~/.local/bin/iswork - -unlink -- ~/.local/bin/new-c-proj - -test ! -r ../.secrets/bin/Makefile || make -C ../.secrets/bin uninstall - -.PHONY: install uninstall + -test ! -r ../.secrets/bin/Makefile || (cd ../.secrets/bin && $(MAKE) uninstall) diff --git a/base/new-c-proj b/base/new-c-proj deleted file mode 100755 index 48f8d83..0000000 --- a/base/new-c-proj +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/sh - -set -e - -if ! test $# = 1; then - printf 'usage %s: proj-name\n' "$0" >&2 - exit 1 -fi - -if printf '%s\n' "$1" | grep / >/dev/null 2>/dev/null; then - printf 'project name cannot contain a slash\n' "$0" >&2 - exit 1 -fi - -mkdir -- "$1" -cd -- "$1" -git init . - -cat > LICENSE < - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -EOF - -cat > .gitignore <> .git/info/exclude - -if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then - UPPERCASE="$(printf '%s\n' "$1" | tr '[a-z-]' '[A-Z_]')" - LIBNAME="$(printf '%s\n' "$1" | sed 's/^lib//')" - - printf '%s\n' >> "$1".h \ - '/* See LICENSE file for copyright and license details. */' \ - "#ifndef ${UPPERCASE}_H" \ - "#define ${UPPERCASE}_H" \ - '' \ - '#endif' - - mkdir -p -- mk - - cat <<-EOF | sed 's/x\t/\t/g' > Makefile - .POSIX: - - CONFIGFILE = config.mk - include \$(CONFIGFILE) - - OS = linux - # Linux: linux - # Mac OS: macos - # Windows: windows - include mk/\$(OS).mk - - - LIB_MAJOR = 1 - LIB_MINOR = 0 - LIB_VERSION = \$(LIB_MAJOR).\$(LIB_MINOR) - LIB_NAME = ${LIBNAME} - - - OBJ = - - HDR =\\ - x $1.h - - LOBJ = \$(OBJ:.o=.lo) - - - all: $1.a $1.\$(LIBEXT) - \$(OBJ): \$(HDR) - \$(LOBJ): \$(HDR) - - .c.o: - x \$(CC) -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) - - .c.lo: - x \$(CC) -fPIC -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) - - $1.a: \$(OBJ) - x @rm -f -- \$@ - x \$(AR) rc \$@ \$(OBJ) - x \$(AR) ts \$@ > /dev/null - - $1.\$(LIBEXT): \$(LOBJ) - x \$(CC) \$(LIBFLAGS) -o \$@ \$(LOBJ) \$(LDFLAGS) - - install: $1.a $1.\$(LIBEXT) - x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/lib" - x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/include" - x cp -- $1.a "\$(DESTDIR)\$(PREFIX)/lib/" - x cp -- $1.\$(LIBEXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" - x \$(FIX_INSTALL_NAME) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" - x ln -sf -- $1.\$(LIBMINOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" - x ln -sf -- $1.\$(LIBMAJOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBEXT)" - x cp -- $1.h "\$(DESTDIR)\$(PREFIX)/include/" - - uninstall: - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.a" - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBEXT)" - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/include/$1.h" - - clean: - x -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib - x -rm -f -- *.gch *.gcov *.gcno *.gcda *.\$(LIBEXT) - - .SUFFIXES: - .SUFFIXES: .lo .o .c - - .PHONY: all install uninstall clean - EOF - - cat <<-EOF | sed 's/x\t/\t/g' > mk/linux.mk - LIBEXT = so - LIBFLAGS = -shared -Wl,-soname,lib\$(LIB_NAME).\$(LIBEXT).\$(LIB_MAJOR) - LIBMAJOREXT = \$(LIBEXT).\$(LIB_MAJOR) - LIBMINOREXT = \$(LIBEXT).\$(LIB_VERSION) - - FIX_INSTALL_NAME = : - EOF - - cat <<-EOF | sed 's/x\t/\t/g' > mk/macos.mk - LIBEXT = dylib - LIBFLAGS = -dynamiclib -Wl,-compatibility_version,\$(LIB_MAJOR) -Wl,-current_version,\$(LIB_VERSION) - LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT) - LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT) - - FIX_INSTALL_NAME = install_name_tool -id "\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" - EOF - - cat <<-EOF | sed 's/x\t/\t/g' > mk/windows.mk - LIBEXT = dll - LIBFLAGS = -shared - LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT) - LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT) - - FIX_INSTALL_NAME = : - EOF -else - printf '%s\n' "/$1" >> .gitignore - - printf '%s\n' '/* See LICENSE file for copyright and license details. */' >> "$1".c - - cat <<-EOF | sed 's/x\t/\t/g' > Makefile - .POSIX: - - CONFIGFILE = config.mk - include \$(CONFIGFILE) - - OBJ =\\ - x $1.o - - HDR = - - all: $1 - \$(OBJ): \$(HDR) - - .c.o: - x \$(CC) -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) - - $1: \$(OBJ) - x \$(CC) -o \$@ \$(OBJ) \$(LDFLAGS) - - install: $1 - x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/bin" - x mkdir -p -- "\$(DESTDIR)\$(MANPREFIX)/man1/" - x cp -- $1 "\$(DESTDIR)\$(PREFIX)/bin/" - x cp -- $1.1 "\$(DESTDIR)\$(MANPREFIX)/man1/" - - uninstall: - x -rm -f -- "\$(DESTDIR)\$(PREFIX)/bin/$1" - x -rm -f -- "\$(DESTDIR)\$(MANPREFIX)/man1/$1.1" - - clean: - x -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda - x -rm -f -- $1 - - .SUFFIXES: - .SUFFIXES: .o .c - - .PHONY: all install uninstall clean - EOF -fi - -cat > config.mk <<-EOF - PREFIX = /usr - MANPREFIX = \$(PREFIX)/share/man - - CC = cc - - CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_GNU_SOURCE - CFLAGS = -std=c99 -Wall -g - LDFLAGS = -EOF diff --git a/base/profile b/base/profile deleted file mode 100644 index 2206a1f..0000000 --- a/base/profile +++ /dev/null @@ -1,86 +0,0 @@ -# -*- shell-script -*- - -# Set locale -export LOCALE="en_GB.UTF-8" -export LC_ALL="en_GB.UTF-8" -export LANG="en_GB.UTF-8" - -# Set audio interface -export MAIN_ALSA_CARD=0 -export MAIN_ALSA_MIXER=PCM - -# Set man section order -export MANSECT="1p:8p:1:8:2:3p:3:0:5:4:9:6:7:n:l" - -# Ensure ~/.local/bin and ~/.usr/bin are in PATH -if ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.local/bin >/dev/null; then - export PATH="${HOME}/.local/bin:${PATH}" -fi -if ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.usr/bin >/dev/null; then - export PATH="${HOME}/.usr/bin:${PATH}" -fi - -# Maybe set user directories -if test -z "${XDG_CONFIG_HOME}"; then - export XDG_CONFIG_HOME="${HOME}/.config" -fi -if test -z "${XDG_CACHE_HOME}"; then - export XDG_CACHE_HOME="${HOME}/.var/cache" -fi -if test -z "${XDG_SPOOL_HOME}"; then - export XDG_SPOOL_HOME="${HOME}/.var/spool" -fi -if test -z "${XDG_STATE_HOME}"; then - export XDG_STATE_HOME="${HOME}/.var/lib" -fi -if test -z "${XDG_DATA_HOME}"; then - export XDG_DATA_HOME="${HOME}/.local/share" -fi - -# Maybe set system directories -if test -z "${XDG_DATA_DIRS}"; then - export XDG_DATA_DIRS="/usr/local/share:/usr/share" -fi -if test -z "${XDG_CONFIG_DIRS}"; then - export XDG_CONFIG_DIRS="/etc/xgd:/etc" -fi - -# Maybe set directory for temporary files, atleast create it -if test -z "${XDG_RUNTIME_DIR}"; then - export XDG_RUNTIME_DIR='/tmp/.~'"$(whoami)" -fi -mkdir -p -- "${XDG_RUNTIME_DIR}" - -# Set editor -if test -x ~/.local/bin/e; then - export EDITOR=~/.local/bin/e -elif test -x /usr/bin/emacs; then - export EDITOR="emacs -nw" -elif test -x /usr/bin/vis; then - export EDITOR="vis" -elif test -x /usr/bin/nano; then - export EDITOR="nano" -elif test -x /usr/bin/vim; then - export EDITOR="vim" -elif test -x /usr/bin/vi; then - export EDITOR="vi" -fi -export VISUAL="${EDITOR}" - -# Load package specific profiles -for __script in ~/.config/profile.d/*; do - if test -r "${__script}"; then - . "${__script}" - fi -done -unset __script - -# Load machine specific profile -if test -r ~/.config/"profile-$(hostname)"; then - . ~/.config/"profile-$(hostname)" -fi - -# Load work related profile -if test -r ~/work/.config/profile; then - . ~/work/.config/profile -fi diff --git a/base/profile-North b/base/profile-North deleted file mode 100644 index 7a5acc9..0000000 --- a/base/profile-North +++ /dev/null @@ -1,5 +0,0 @@ -# -*- shell-script -*- - -# Set audio interface -export MAIN_ALSA_CARD=1 -export MAIN_ALSA_MIXER=Master diff --git a/base/user-profile b/base/user-profile new file mode 100644 index 0000000..2206a1f --- /dev/null +++ b/base/user-profile @@ -0,0 +1,86 @@ +# -*- shell-script -*- + +# Set locale +export LOCALE="en_GB.UTF-8" +export LC_ALL="en_GB.UTF-8" +export LANG="en_GB.UTF-8" + +# Set audio interface +export MAIN_ALSA_CARD=0 +export MAIN_ALSA_MIXER=PCM + +# Set man section order +export MANSECT="1p:8p:1:8:2:3p:3:0:5:4:9:6:7:n:l" + +# Ensure ~/.local/bin and ~/.usr/bin are in PATH +if ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.local/bin >/dev/null; then + export PATH="${HOME}/.local/bin:${PATH}" +fi +if ( IFS=: ; printf '%s\n' $PATH ) | grep -Fx ~/.usr/bin >/dev/null; then + export PATH="${HOME}/.usr/bin:${PATH}" +fi + +# Maybe set user directories +if test -z "${XDG_CONFIG_HOME}"; then + export XDG_CONFIG_HOME="${HOME}/.config" +fi +if test -z "${XDG_CACHE_HOME}"; then + export XDG_CACHE_HOME="${HOME}/.var/cache" +fi +if test -z "${XDG_SPOOL_HOME}"; then + export XDG_SPOOL_HOME="${HOME}/.var/spool" +fi +if test -z "${XDG_STATE_HOME}"; then + export XDG_STATE_HOME="${HOME}/.var/lib" +fi +if test -z "${XDG_DATA_HOME}"; then + export XDG_DATA_HOME="${HOME}/.local/share" +fi + +# Maybe set system directories +if test -z "${XDG_DATA_DIRS}"; then + export XDG_DATA_DIRS="/usr/local/share:/usr/share" +fi +if test -z "${XDG_CONFIG_DIRS}"; then + export XDG_CONFIG_DIRS="/etc/xgd:/etc" +fi + +# Maybe set directory for temporary files, atleast create it +if test -z "${XDG_RUNTIME_DIR}"; then + export XDG_RUNTIME_DIR='/tmp/.~'"$(whoami)" +fi +mkdir -p -- "${XDG_RUNTIME_DIR}" + +# Set editor +if test -x ~/.local/bin/e; then + export EDITOR=~/.local/bin/e +elif test -x /usr/bin/emacs; then + export EDITOR="emacs -nw" +elif test -x /usr/bin/vis; then + export EDITOR="vis" +elif test -x /usr/bin/nano; then + export EDITOR="nano" +elif test -x /usr/bin/vim; then + export EDITOR="vim" +elif test -x /usr/bin/vi; then + export EDITOR="vi" +fi +export VISUAL="${EDITOR}" + +# Load package specific profiles +for __script in ~/.config/profile.d/*; do + if test -r "${__script}"; then + . "${__script}" + fi +done +unset __script + +# Load machine specific profile +if test -r ~/.config/"profile-$(hostname)"; then + . ~/.config/"profile-$(hostname)" +fi + +# Load work related profile +if test -r ~/work/.config/profile; then + . ~/work/.config/profile +fi diff --git a/base/user-profile-North b/base/user-profile-North new file mode 100644 index 0000000..7a5acc9 --- /dev/null +++ b/base/user-profile-North @@ -0,0 +1,5 @@ +# -*- shell-script -*- + +# Set audio interface +export MAIN_ALSA_CARD=1 +export MAIN_ALSA_MIXER=Master diff --git a/base/user-profile-Zenith b/base/user-profile-Zenith new file mode 100644 index 0000000..97cf492 --- /dev/null +++ b/base/user-profile-Zenith @@ -0,0 +1,4 @@ +# -*- shell-script -*- + +# Set audio interface +export MAIN_ALSA_CARD=2 diff --git a/base/xinit b/base/xinit new file mode 100644 index 0000000..2ef7ed0 --- /dev/null +++ b/base/xinit @@ -0,0 +1,7 @@ +# -*- shell-script -*- + +# Set keyboard settings +setkeys || : + +# Start hotkey daemon +xkbdbind & diff --git a/bash-completion/Makefile b/bash-completion/Makefile index 73f3b78..edf700d 100644 --- a/bash-completion/Makefile +++ b/bash-completion/Makefile @@ -1,18 +1,16 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d mkdir -p -- ~/.config/bash/bashrc.d - test ! -d ~/.config/bash/aliases.d/bash-completion - test ! -d ~/.config/bash/bashrc.d/bash-completion + test ! -e ~/.config/bash/aliases.d/bash-completion || test -L ~/.config/bash/aliases.d/bash-completion + test ! -e ~/.config/bash/bashrc.d/bash-completion || test -L ~/.config/bash/bashrc.d/bash-completion ln -sf -- ~/.dotfiles/bash-completion/bash-aliases ~/.config/bash/aliases.d/bash-completion ln -sf -- ~/.dotfiles/bash-completion/bash-bashrc ~/.config/bash/bashrc.d/bash-completion uninstall: + +! ../check-installed bash-completion -unlink -- ~/.config/bash/aliases.d/bash-completion -unlink -- ~/.config/bash/bashrc.d/bash-completion -rmdir -- ~/.config/bash/aliases.d -rmdir -- ~/.config/bash/bashrc.d - -.PHONY: install uninstall diff --git a/bash/Makefile b/bash/Makefile index 39dd6d3..bb25967 100644 --- a/bash/Makefile +++ b/bash/Makefile @@ -1,21 +1,20 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.var/cache mkdir -p -- ~/.config/bash touch -- ~/.var/cache/bash_history - test ! -d ~/.bash_history - test ! -d ~/.bash_logout - test ! -d ~/.bash_profile - test ! -d ~/.bashrc - test ! -d ~/.config/bash/logout - test ! -d ~/.config/bash/profile - test ! -d ~/.config/bash/bashrc - test ! -d ~/.config/bash/bashrc_palette - test ! -d ~/.config/bash/bashrc_prompt - test ! -d ~/.config/bash/aliases - test ! -d ~/.config/bash/aliases-Zenith + test ! -e ~/.bash_history || test -L ~/.bash_history + test ! -e ~/.bash_logout || test -L ~/.bash_logout + test ! -e ~/.bash_profile || test -L ~/.bash_profile + test ! -e ~/.bashrc || test -L ~/.bashrc + test ! -e ~/.config/bash/logout || test -L ~/.config/bash/logout + test ! -e ~/.config/bash/profile || test -L ~/.config/bash/profile + test ! -e ~/.config/bash/bashrc || test -L ~/.config/bash/bashrc + test ! -e ~/.config/bash/bashrc_palette || test -L ~/.config/bash/bashrc_palette + test ! -e ~/.config/bash/bashrc_prompt || test -L ~/.config/bash/bashrc_prompt + test ! -e ~/.config/bash/aliases || test -L ~/.config/bash/aliases + test ! -e ~/.config/bash/aliases-Zenith || test -L ~/.config/bash/aliases-Zenith ln -sf -- .var/cache/bash_history ~/.bash_history ln -sf -- .config/bash/logout ~/.bash_logout ln -sf -- .config/bash/profile ~/.bash_profile @@ -28,13 +27,15 @@ install: ln -sf -- ~/.dotfiles/bash/aliases ~/.config/bash/aliases if test "$$(hostname | tr '[[:upper:]]' '[[:lower:]]')" = zenith; then \ test "$$(hostname)" = Zenith && \ - $(CHECK_INSTALLED) asroot && \ - $(CHECK_INSTALLED) gnupg && \ - $(CHECK_INSTALLED) cryptsetup && \ + ../check-any-installed asroot asroot-libpassphrase && \ + ../check-installed gnupg && \ + ../check-installed cryptsetup && \ + ../check-installed key2root && \ ln -sf -- ~/.dotfiles/bash/aliases-Zenith ~/.config/bash/aliases-Zenith; \ fi uninstall: + +! ../check-installed bash -unlink -- ~/.bash_history -unlink -- ~/.bash_logout -unlink -- ~/.bash_profile @@ -50,5 +51,3 @@ uninstall: -rmdir -- ~/.config/bash/aliases.d -rmdir -- ~/.config/bash/bashrc.d -rmdir -- ~/.config/bash - -.PHONY: install uninstall diff --git a/bash/aliases-Zenith b/bash/aliases-Zenith index 73db885..e4e7422 100644 --- a/bash/aliases-Zenith +++ b/bash/aliases-Zenith @@ -1,21 +1,44 @@ # -*- shell-script -*- mount-crypt () { - gpg --decrypt /media/Secondary/.crypt/crypt.key | \ - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -ec ' - device="$(losetup --show -f -P /media/Secondary/.crypt/crypt.img)" - printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt" - cryptsetup -d - open "${device}" CryptCrypt - mkdir -p "${CRYPT_DIR}" - mount /dev/mapper/CryptCrypt "${CRYPT_DIR}" - ' + if mountpoint -q -- ~/Crypt; then + printf '%s\n' 'mount-crypt: already mounted' >&2 + elif test -e /dev/mapper/CryptCrypt; then + asroot env CRYPT_DIR=~/Crypt sh -ec \ + 'mount -- /dev/mapper/CryptCrypt "${CRYPT_DIR}"' + else + gpg --decrypt /media/Secondary/.crypt/crypt.key | \ + key2root -k CryptCrypt env \ + CRYPT_IMG=/media/Secondary/.crypt/crypt.img \ + CRYPT_DIR=~/Crypt \ + CRYPT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- /media/Secondary/.crypt/crypt.img)"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${CRYPT_DEV}"; then + CRYPT_DEV="$(losetup --show -f -P "${CRYPT_IMG}")" + fi + cryptsetup -d - open "${CRYPT_DEV}" CryptCrypt + mkdir -p -- "${CRYPT_DIR}" + mount -- /dev/mapper/CryptCrypt "${CRYPT_DIR}" + ' + fi } umount-crypt () { - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -c ' - umount "${CRYPT_DIR}" - rmdir "${CRYPT_DIR}" - cryptsetup close CryptCrypt - losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")" + asroot env \ + CRYPT_DIR=~/Crypt \ + CRYPT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- /media/Secondary/.crypt/crypt.img)"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${CRYPT_DIR}"; then + umount -- "${CRYPT_DIR}" + fi + rmdir -- "${CRYPT_DIR}" || : + if test -e /dev/mapper/CryptCrypt; then + cryptsetup close CryptCrypt + fi + if test -n "${CRYPT_DEV}"; then + losetup -d "${CRYPT_DEV}" + fi ' } diff --git a/bash/bashrc_prompt b/bash/bashrc_prompt index 5463afb..dc0e920 100644 --- a/bash/bashrc_prompt +++ b/bash/bashrc_prompt @@ -153,13 +153,15 @@ git-colour () { __prompt_func_git () { - exec 2>/dev/null - if git status >&2; then - status="$(git status -s -b | head -n 1)" - if [ "$(echo "${status}" | cut -d ' ' -f 3)" = '[ahead' ]; then - echo "${status}" | cut -d ' ' -f 2 + if __prompt_func_git_branch="$(LANG=C git branch --format='%(if)%(HEAD)%(then)%(refname:short)%(end)' 2>/dev/null)"; then + if __prompt_func_git_branch="$(printf '%s\n' "${__prompt_func_git_branch}" | grep -v '^$')"; then + if [ -z "${__prompt_func_git_branch}" ]; then + printf '%s' '(orphan)' + else + printf '%s' "${__prompt_func_git_branch}" | sed 's/^(HEAD detached at .*)$/(detached)/' + fi else - echo "${status}" | cut -d ' ' -f 2 | cut -d . -f 1 + printf '%s' '(orphan)' fi fi } @@ -368,7 +370,7 @@ update-prompt () { fi if [ "${__prompt_git}" = "1" ]; then if [ ! "${PS1}" = "" ]; then - PS1="${PS1}"'$(git status 2>/dev/null >&2 && echo -n : || echo -n "")' + PS1="${PS1}"'$(if git branch 2>/dev/null >&2; then printf ':'; fi)' fi PS1="${PS1}\[\033[${__prompt_git_colour}m\]"'$(__prompt_func_git)'"\[\033[00m\]" fi diff --git a/bus/Makefile b/bus/Makefile index d4e4c5f..f606d0e 100644 --- a/bus/Makefile +++ b/bus/Makefile @@ -1,22 +1,21 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 10 install: mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/bus + test ! -e ~/.config/profile.d/bus || test -L ~/.config/profile.d/bus ln -sf -- ~/.dotfiles/bus/user-profile ~/.config/profile.d/bus mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-bus + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-bus || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-bus ln -sf -- ~/.dotfiles/bus/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-bus uninstall: + +! ../check-installed bus -unlink -- ~/.config/profile.d/bus -rmdir -- ~/.config/profile.d -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-bus -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/caja-gtk2 b/caja-gtk2 new file mode 120000 index 0000000..1e2b3af --- /dev/null +++ b/caja-gtk2 @@ -0,0 +1 @@ +caja \ No newline at end of file diff --git a/caja/Makefile b/caja/Makefile index b0c08a5..3b36437 100644 --- a/caja/Makefile +++ b/caja/Makefile @@ -1,12 +1,17 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) dash + ../check-installed-shebang c mkdir -p -- ~/.local/bin - ln -sf -- ~/.dotfiles/caja/c ~/.local/bin/ + test ! -e ~/.local/bin/c || test -L ~/.local/bin/c + if test -e "c-$$(hostname)"; then \ + ../check-in-path "$$(readlink -- "c-$$(hostname)")" && \ + ln -sf -- ~/.dotfiles/caja/"c-$$(hostname)" ~/.local/bin/c; \ + else \ + ln -sf -- ~/.dotfiles/caja/c ~/.local/bin/c; \ + fi uninstall: + +! ../check-installed caja + +! ../check-installed caja-gtk2 -unlink -- ~/.local/bin/c - -.PHONY: install uninstall diff --git a/caja/c b/caja/c index 88f50b4..fc1f550 100755 --- a/caja/c +++ b/caja/c @@ -1,7 +1,7 @@ #!/bin/dash for i in $(ls /dev/fd/); do - eval "exec $i>&-" + eval "exec $i>&-" done exec 0/dev/null @@ -10,7 +10,7 @@ exec 2>/dev/null if test $# = 0; then exec caja --no-desktop & else - p="$(realpath -- "$*" || printf '%s\n' "$*")" + p="$(realpath -- "$*" || printf '%s\n' "$*")" cd / - exec caja --no-desktop -- "$p" & + exec caja --no-desktop -- "$p" & fi diff --git a/caja/c-Zenith b/caja/c-Zenith new file mode 120000 index 0000000..af8fd0e --- /dev/null +++ b/caja/c-Zenith @@ -0,0 +1 @@ +thunar \ No newline at end of file diff --git a/caja/thunar b/caja/thunar new file mode 100755 index 0000000..b21c2dd --- /dev/null +++ b/caja/thunar @@ -0,0 +1,18 @@ +#!/bin/dash + +for i in $(ls /dev/fd/); do + eval "exec $i>&-" +done +exec 0/dev/null +exec 2>/dev/null + +if test $# = 0; then + #exec caja --no-desktop & + exec thunar & +else + p="$(realpath -- "$*" || printf '%s\n' "$*")" + cd / + #exec caja --no-desktop -- "$p" & + exec thunar -- "$p" & +fi diff --git a/cargo b/cargo new file mode 120000 index 0000000..6ef8575 --- /dev/null +++ b/cargo @@ -0,0 +1 @@ +rust \ No newline at end of file diff --git a/cat-nonbackups b/cat-nonbackups new file mode 100755 index 0000000..387cf7a --- /dev/null +++ b/cat-nonbackups @@ -0,0 +1,15 @@ +#!/bin/sh +set -e +good_filename () { + test -n "$(printf '%s\n' "$1" | grep -v '~$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.swo$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.swp$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.bak$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '^\.#' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '^#' || :)" || return 1 +} +for file; do + if good_filename "$file" >/dev/null 2>/dev/null; then + cat -- "$file" + fi +done diff --git a/check-any-installed b/check-any-installed new file mode 100755 index 0000000..8329769 --- /dev/null +++ b/check-any-installed @@ -0,0 +1,25 @@ +#!/bin/sh + +set -ue + +if test -r /etc/lsb-release; then + . /etc/lsb-release +fi +if test -r ~.dotfiles/.work/distrib-tweak; then + . ~.dotfiles/.work/distrib-tweak +fi + +for pkg; do + if test "${DISTRIB_ID}" = Arch; then + if pacman -Qq -- "$pkg"; then + exit 0; + fi + elif test "${DISTRIB_ID}" = Ubuntu; then + if test "$pkg" = base || dpkg -s -- "$pkg"; then + exit 0; + fi + else + false + fi +done /dev/null 2>/dev/null +exit 1 diff --git a/check-in-path b/check-in-path new file mode 100755 index 0000000..69bbd6c --- /dev/null +++ b/check-in-path @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +for cmd; do which -- "$cmd"; done >/dev/null 2>/dev/null diff --git a/check-installed b/check-installed new file mode 100755 index 0000000..19cc204 --- /dev/null +++ b/check-installed @@ -0,0 +1,20 @@ +#!/bin/sh + +set -ue + +if test -r /etc/lsb-release; then + . /etc/lsb-release +fi +if test -r ~/.dotfiles/.work/distrib-tweak; then + . ~/.dotfiles/.work/distrib-tweak +fi + +for pkg; do + if test "${DISTRIB_ID}" = Arch; then + pacman -Qq -- "$pkg" + elif test "${DISTRIB_ID}" = Ubuntu; then + test "$pkg" = base || dpkg -s -- "$pkg" + else + false + fi +done /dev/null 2>/dev/null diff --git a/check-installed-shebang b/check-installed-shebang new file mode 100755 index 0000000..70bc76e --- /dev/null +++ b/check-installed-shebang @@ -0,0 +1,25 @@ +#!/bin/sh +set -e +for f; do + test -r "$f" + shebang="$(sed 1q < "$f" | \ + tr '\t' ' ' | \ + sed -n 's/#! *\([^ ]\+\)\(\| \+.*\)$/\1\n\2/p' | \ + sed 's/^ *//')" + test -n "$shebang" + path="$(printf '%s\n' "$shebang" | sed -n 1p)" + program="$(printf '%s\n' "$path" | sed 's/^.*\/\([^/]\+\)$/\1/')" + arguments="$(printf '%s\n' "$shebang" | sed -n 2p)" + argument1="$(printf '%s\n' "$arguments" | cut -d ' ' -f 1)" + + if test -z "$path"; then + continue + fi + + test -x "$path" + if test "$program" = env; then + which -- "${arguments}" >/dev/null 2>/dev/null + elif test "$program" = shebang; then + which -- "${argument1}" >/dev/null 2>/dev/null + fi +done diff --git a/claws-mail/Makefile b/claws-mail/Makefile index be61de5..4739d80 100644 --- a/claws-mail/Makefile +++ b/claws-mail/Makefile @@ -1,9 +1,8 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.claws-mail - test ! -d ~/.claws-mail/clawsrc + test ! -e ~/.claws-mail/clawsrc || test -L ~/.claws-mail/clawsrc ln -sf -- ~/.dotfiles/claws-mail/clawsrc ~/.claws-mail/clawsrc if test -L ~/Mail; then \ test "$$(readlink -- ~/Mail)" = .var/mail; \ @@ -21,9 +20,8 @@ install: test -e ~/.hidden && grep '^Mail$$' < ~/.hidden > /dev/null || printf '%s\n' "Mail" >> ~/.hidden uninstall: + +! ../check-installed claws-mail -unlink -- ~/.claws-mail/clawsrc -rmdir -- ~/.claws-mail -unlink -- ~/Mail -test ! -e ~/.hidden || grep -v '^Mail$$' < ~/.hidden | sponge ~/.hidden - -.PHONY: install uninstall diff --git a/common.mk b/common.mk deleted file mode 100644 index f716eaf..0000000 --- a/common.mk +++ /dev/null @@ -1,3 +0,0 @@ -CHECK_INSTALLED = false - -CC = gcc diff --git a/coreutils/Makefile b/coreutils/Makefile index d061ad6..e53c06d 100644 --- a/coreutils/Makefile +++ b/coreutils/Makefile @@ -1,18 +1,16 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d mkdir -p -- ~/.config/bash/bashrc.d - test ! -d ~/.config/bash/aliases.d/coreutils - test ! -d ~/.config/bash/bashrc.d/coreutils + test ! -e ~/.config/bash/aliases.d/coreutils || test -L ~/.config/bash/aliases.d/coreutils + test ! -e ~/.config/bash/bashrc.d/coreutils || test -L ~/.config/bash/bashrc.d/coreutils ln -sf -- ~/.dotfiles/coreutils/bash-aliases ~/.config/bash/aliases.d/coreutils ln -sf -- ~/.dotfiles/coreutils/bash-bashrc ~/.config/bash/bashrc.d/coreutils uninstall: + +! ../check-installed coreutils -unlink -- ~/.config/bash/aliases.d/coreutils - -unlink -- ~/.config/bash/bashrc.d/coreutils -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.config/bash/bashrc.d/coreutils -rmdir -- ~/.config/bash/bashrc.d - -.PHONY: install uninstall diff --git a/cvs/Makefile b/cvs/Makefile index 3ca0b4b..61e0f83 100644 --- a/cvs/Makefile +++ b/cvs/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/cvs + test ! -e ~/.config/profile.d/cvs || test -L ~/.config/profile.d/cvs ln -sf -- ~/.dotfiles/cvs/user-profile ~/.config/profile.d/cvs uninstall: + +! ../check-installed cvs -unlink -- ~/.config/profile.d/cvs -rmdir -- ~/.config/profile.d - -.PHONY: install uninstall diff --git a/dbus/Makefile b/dbus/Makefile index aab1396..80e240b 100644 --- a/dbus/Makefile +++ b/dbus/Makefile @@ -1,15 +1,14 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 50 install: mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dbus + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dbus || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dbus ln -sf -- ~/.dotfiles/dbus/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dbus uninstall: + +! ../check-installed dbus -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dbus -rmdir -- ~/.config/X11/xinit/xinitrc.d - -.PHONY: install uninstall diff --git a/dbus/xinit b/dbus/xinit index 28bb1d1..e5616f8 100644 --- a/dbus/xinit +++ b/dbus/xinit @@ -1,4 +1,8 @@ # -*- shell-script -*- +if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then + eval "$(dbus-launch --sh-syntax)" +fi + # Functional alernative to /etc/X11/xinit/xinitrc.d/50-systemd-user.sh, just skips first part dbus-update-activation-environment DISPLAY XAUTHORITY diff --git a/dconf-cli b/dconf-cli new file mode 120000 index 0000000..69f7f16 --- /dev/null +++ b/dconf-cli @@ -0,0 +1 @@ +dconf \ No newline at end of file diff --git a/dconf/Makefile b/dconf/Makefile index 41b756a..b98a8ae 100644 --- a/dconf/Makefile +++ b/dconf/Makefile @@ -1,17 +1,17 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 10 install: mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dconf + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dconf || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dconf ln -sf -- ~/.dotfiles/dconf/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dconf uninstall: + +! ../check-installed dconf + +! ../check-installed dconf-cli -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-dconf -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/dmenu/Makefile b/dmenu/Makefile index 5ed7d04..d60be4d 100644 --- a/dmenu/Makefile +++ b/dmenu/Makefile @@ -1,23 +1,23 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) dash - $(CHECK_INSTALLED) vis - make -C unicode.d + ../check-installed-shebang dmenu + ../check-installed-shebang ipa + ../check-installed-shebang unicode + ../check-installed-shebang plumb + ../check-in-path vis + cd unicode.d && make mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/dmenu/dmenu ~/.local/bin/ - ln -sf -- ~/.dotfiles/dmenu/man ~/.local/bin/ ln -sf -- ~/.dotfiles/dmenu/ipa ~/.local/bin/ ln -sf -- ~/.dotfiles/dmenu/unicode ~/.local/bin/ ln -sf -- ~/.dotfiles/dmenu/plumb ~/.local/bin/ uninstall: + +! ../check-installed dmenu + +! ../check-installed suckless-tools -unlink -- ~/.local/bin/dmenu - -unlink -- ~/.local/bin/man -unlink -- ~/.local/bin/ipa -unlink -- ~/.local/bin/unicode -unlink -- ~/.local/bin/plumb - -make -C unicode.d reallyclean - -.PHONY: install uninstall + -cd unicode.d && make reallyclean diff --git a/dmenu/man b/dmenu/man deleted file mode 100755 index 1b29656..0000000 --- a/dmenu/man +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/dash - -# Browse with dmenu if no page has been specified -if test $# = 0; then - manpage="$(/usr/bin/man -k '' | dmenu -l 40 | sed 's/^\([^ ]*\) (\([^)]*\)).*$/\2 \1/')" - if test -z "$manpage"; then - exit 1 - fi - set $manpage -fi - - -# Bold -export LESS_TERMCAP_md="$(printf '\033[01;34m')" -export LESS_TERMCAP_me="$(printf '\033[0m')" - -# Italic -export LESS_TERMCAP_us="$(printf '\033[01;04;32m')" -export LESS_TERMCAP_ue="$(printf '\033[0m')" - -# Reverse video -if test "$TERM" = linux; then - export LESS_TERMCAP_so="$(printf '\033[07m')" -else - export LESS_TERMCAP_so="$(printf '\033[07;01m')" -fi -export LESS_TERMCAP_se="$(printf '\033[0m')" - - -# Display, open new terminal if in the background -if isfg; then - exec /usr/bin/man "$@" -elif test -x /usr/bin/terminator; then - exec terminator -e "/usr/bin/man $*" -elif test -x /usr/bin/st; then - exec st -e /usr/bin/man "$@" -else - exec xterm -e /usr/bin/man "$@" -fi diff --git a/dmenu/plumb b/dmenu/plumb index 13cfca8..c0d98f3 100755 --- a/dmenu/plumb +++ b/dmenu/plumb @@ -90,7 +90,11 @@ functions="$functions duckduckgo" duckduckgo () { exec $WEB_BROWSER "https://duckduckgo.com/?q=$sel"; } +# TODO add other search engines +if (( $(printf '%s' "$sel" | wc -m) > 100 )); then + sel='selected text' +fi function="$(printf '%s\n' $functions | dmenu -i -p "Plumb $sel to:" -l 50)" if test -n "$function"; then diff --git a/element-desktop/Makefile b/element-desktop/Makefile index 60a7a78..ce7b6d2 100644 --- a/element-desktop/Makefile +++ b/element-desktop/Makefile @@ -1,20 +1,20 @@ .POSIX: -include ../common.mk install: test -f ~/.var/opt/element/ElementCrypt.img test -f ~/.var/opt/element/ElementCrypt.key mkdir -p -- ~/.var/opt/element/ElementCrypt.d test -e ~/.config/Element || ln -sf -- ../.var/opt/element/ElementCrypt.d/Element ~/.config/Element - $(CHECK_INSTALLED) asroot - $(CHECK_INSTALLED) gnupg - $(CHECK_INSTALLED) cryptsetup + ../check-any-installed asroot asroot-libpassphrase + ../check-installed gnupg + ../check-installed cryptsetup + ../check-installed key2root mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/element-desktop + test ! -e ~/.config/bash/aliases.d/element-desktop || \ + test -L ~/.config/bash/aliases.d/element-desktop ln -sf -- ~/.dotfiles/element-desktop/bash-aliases ~/.config/bash/aliases.d/element-desktop uninstall: + +! ../check-installed element-desktop -unlink -- ~/.config/bash/aliases.d/element-desktop -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/element-desktop/bash-aliases b/element-desktop/bash-aliases index fa8afea..1a5362b 100644 --- a/element-desktop/bash-aliases +++ b/element-desktop/bash-aliases @@ -1,20 +1,42 @@ # -*- shell-script -*- mount-element () { - gpg --decrypt ~/.var/opt/element/ElementCrypt.key | \ - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/opt/element sh -ec ' - device="$(losetup --show -f -P "${ELEMENT_DIR}/ElementCrypt.img")" - printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/ElementCrypt" - cryptsetup -d - open "${device}" ElementCrypt - mount /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d" - ' + if mountpoint -q -- ~/.var/opt/element/ElementCrypt.d; then + printf '%s\n' 'mount-element: already mounted' >&2 + elif test -e /dev/mapper/ElementCrypt; then + asroot env ELEMENT_DIR=~/.var/opt/element sh -ec \ + 'mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d"' + else + gpg --decrypt ~/.var/opt/element/ElementCrypt.key | \ + key2root -k ElementCrypt env \ + ELEMENT_IMG=~/.var/opt/element/ElementCrypt.img \ + ELEMENT_DIR=~/.var/opt/element \ + ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/element/ElementCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${ELEMENT_DEV}"; then + ELEMENT_DEV="$(losetup --show -f -P "${ELEMENT_IMG}")" + fi + cryptsetup -d - open "${ELEMENT_DEV}" ElementCrypt + mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d" + ' + fi } umount-element () { - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/opt/element sh -c ' - umount "${ELEMENT_DIR}/ElementCrypt.d" - cryptsetup close ElementCrypt - losetup -d "$(cat -- "${XDG_RUNTIME_DIR}/ElementCrypt")" - rm -f -- "${XDG_RUNTIME_DIR}/ElementCrypt" + asroot env \ + ELEMENT_DIR=~/.var/opt/element \ + ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/element/ElementCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${ELEMENT_DIR}/ElementCrypt.d"; then + umount -- "${ELEMENT_DIR}/ElementCrypt.d" + fi + if test -e /dev/mapper/ElementCrypt; then + cryptsetup close ElementCrypt + fi + if test -n "${ELEMENT_DEV}"; then + losetup -d "${ELEMENT_DEV}" + fi ' } diff --git a/emacs-gtk b/emacs-gtk new file mode 120000 index 0000000..a7642dd --- /dev/null +++ b/emacs-gtk @@ -0,0 +1 @@ +emacs \ No newline at end of file diff --git a/emacs-gtk2 b/emacs-gtk2 new file mode 120000 index 0000000..a7642dd --- /dev/null +++ b/emacs-gtk2 @@ -0,0 +1 @@ +emacs \ No newline at end of file diff --git a/emacs-lucid b/emacs-lucid new file mode 120000 index 0000000..a7642dd --- /dev/null +++ b/emacs-lucid @@ -0,0 +1 @@ +emacs \ No newline at end of file diff --git a/emacs-nox b/emacs-nox new file mode 120000 index 0000000..a7642dd --- /dev/null +++ b/emacs-nox @@ -0,0 +1 @@ +emacs \ No newline at end of file diff --git a/emacs/Makefile b/emacs/Makefile index c7f8527..9fa5799 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config @@ -8,38 +7,48 @@ install: else \ set -e; \ if test -d ~/.emacs.d; then \ - test ! -e ~/.config/emacs; \ + (test ! -e ~/.config/emacs || test -L ~/.config/emacs); \ mv -- ~/.emacs.d ~/.config/emacs; \ else \ mkdir -p -- ~/.config/emacs; \ fi; \ ln -sf -- .config/emacs ~/.emacs.d; \ fi - printf '; %s\n\n' 'This file is generated by ~/.dotfiles/emacs/Makefile' > ~/.config/emacs/init.el + printf '; %s\n; %s\n\n' > ~/.config/emacs/init.el \ + 'This file is generated by ~/.dotfiles/emacs/Makefile' \ + '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' cat -- init.el >> ~/.config/emacs/init.el - if $(CHECK_INSTALLED) emacs-go-mode 2>/dev/null; then\ + if ../check-installed emacs-go-mode 2>/dev/null; then \ printf '\n' >> ~/.config/emacs/init.el && \ cat -- init-go-mode.el >> ~/.config/emacs/init.el; \ fi - if $(CHECK_INSTALLED) emacs-haskell-mode 2>/dev/null; then\ + if ../check-installed emacs-haskell-mode; then\ printf '\n' >> ~/.config/emacs/init.el && \ cat -- init-haskell-mode.el >> ~/.config/emacs/init.el; \ fi + if ../check-installed gdb; then \ + printf '\n' >> ~/.config/emacs/init.el && \ + cat -- init-gdb.el >> ~/.config/emacs/init.el; \ + fi if grep Ubuntu < /etc/lsb-release >/dev/null 2>/dev/null; then \ mkdir -p -- ~/.config/profile.d && \ - test ! -d ~/.config/profile.d/emacs && \ + (test ! -e ~/.config/profile.d/emacs || \ + test -L ~/.config/profile.d/emacs) && \ ln -sf -- ~/.dotfiles/emacs/user-profile ~/.config/profile.d/emacs; \ fi mkdir -p -- ~/.local/bin - test ! -d ~/.local/bin/e + test ! -e ~/.local/bin/e || test -L ~/.local/bin/e ln -sf -- "$$(which emacs)" ~/.local/bin/e uninstall: + +! ../check-installed emacs + +! ../check-installed emacs-gtk + +! ../check-installed emacs-gtk2 + +! ../check-installed emacs-lucid + +! ../check-installed emacs-nox -unlink -- ~/.config/profile.d/emacs -rmdir -- ~/.config/profile.d -unlink -- ~/.config/emacs/init.el -unlink -- ~/.emacs.d -rmdir -- ~/.config/emacs -unlink -- ~/.local/bin/e - -.PHONY: install uninstall diff --git a/emacs/init-gdb.el b/emacs/init-gdb.el new file mode 100644 index 0000000..51b1a35 --- /dev/null +++ b/emacs/init-gdb.el @@ -0,0 +1 @@ +(setq gdb-many-windows t) diff --git a/featherweight/Makefile b/featherweight/Makefile index 4853556..a36a4ba 100644 --- a/featherweight/Makefile +++ b/featherweight/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/featherweight + test ! -e ~/.config/bash/aliases.d/featherweight || test -L ~/.config/bash/aliases.d/featherweight ln -sf -- ~/.dotfiles/featherweight/bash-aliases ~/.config/bash/aliases.d/featherweight uninstall: + +! ../check-installed featherweight -unlink -- ~/.config/bash/aliases.d/featherweight -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/ffmpeg/Makefile b/ffmpeg/Makefile index 4a4fa53..c60008c 100644 --- a/ffmpeg/Makefile +++ b/ffmpeg/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/ffmpeg + test ! -e ~/.config/bash/aliases.d/ffmpeg || test -L ~/.config/bash/aliases.d/ffmpeg ln -sf -- ~/.dotfiles/ffmpeg/bash-aliases ~/.config/bash/aliases.d/ffmpeg uninstall: + +! ../check-installed ffmpeg -unlink -- ~/.config/bash/aliases.d/ffmpeg -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/filesystem/Makefile b/filesystem/Makefile index c726699..69433f5 100644 --- a/filesystem/Makefile +++ b/filesystem/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk HIDE =\ Templates\ @@ -14,14 +13,20 @@ HIDE =\ password.gpg\ mnt +CACHE_REAL != (mount | sed -n 's|^[^ ]* on \('"$${HOME}"'/.cache\)\(/[^ ]*\)\? .*$$|\1|p' ; printf '%s\n' "$$HOME/.var/cache") | sed 1q +CACHE_LINK != printf '%s\n' "$$HOME/.var/cache" "$$HOME/.cache" | grep -v '$(CACHE_REAL)' +IF_VAR_CACHE_IS_REAL != if ! test "$(CACHE_REAL)" = "$$HOME/.var/cache"; then printf '@: \n'; fi +IF_HOME_CACHE_IS_REAL != if ! test "$(CACHE_REAL)" = "$$HOME/.cache"; then printf '@: \n'; fi + install: mkdir -p -- ~/.config - mkdir -p -- ~/.var/cache/.thumbnails + mkdir -p -- $(CACHE_REAL)/.thumbnails rm -rf -- ~/.config/.cache - rm -rf -- ~/.cache + rm -rf -- $(CACHE_LINK) rm -rf -- ~/.thumbnails ln -sf -- ../.cache ~/.config/.cache - ln -sf -- .var/cache ~/.cache + $(IF_VAR_CACHE_IS_REAL) ln -sf -- .var/cache ~/.cache + $(IF_HOME_CACHE_IS_REAL) ln -sf -- ../.cache ~/.var/cache ln -sf -- .cache/.thumbnails ~/.thumbnails mkdir -p -- ~/.var/opt mkdir -p -- ~/.var/games @@ -76,8 +81,11 @@ install: fi uninstall: + +! ../check-installed filesystem + +! ../check-installed base-files -unlink -- ~/.config/user-dirs.dirs -unlink -- ~/.config/.cache + -unlink -- ~/.var/cache -unlink -- ~/.cache -unlink -- ~/.thumbnails -unlink -- ~/.spool @@ -112,5 +120,3 @@ uninstall: -for f in $(HIDE) cryptokey.gpg; do \ test ! -e ~/.hidden || grep -v '^'"$$f"'$$' < ~/.hidden | sponge ~/.hidden; \ done - -.PHONY: install uninstall diff --git a/gcc/Makefile b/gcc/Makefile index f114403..cb8791e 100644 --- a/gcc/Makefile +++ b/gcc/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/profile.d @@ -12,11 +11,10 @@ install: ln -sf -- ~/.dotfiles/gcc/gcc-less-extreme-not-pedantic ~/.local/bin/ uninstall: + +! ../check-installed gcc -unlink -- ~/.config/profile.d/gcc -rmdir -- ~/.config/profile.d -unlink -- ~/.local/bin/ -unlink -- ~/.local/bin/ -unlink -- ~/.local/bin/ -unlink -- ~/.local/bin/ - -.PHONY: install uninstall diff --git a/git/.gitignore b/git/.gitignore new file mode 100644 index 0000000..7fada2a --- /dev/null +++ b/git/.gitignore @@ -0,0 +1 @@ +/.config diff --git a/git/Makefile b/git/Makefile index 13c3740..4d67fe2 100644 --- a/git/Makefile +++ b/git/Makefile @@ -1,21 +1,27 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/git - cat config ../.secrets/git/config > ~/.config/git/config + test ! -e ~/.config/git/config || test -L ~/.config/git/config + test ! -e ~/.config/git/config || test -f ~/.config/git/config + cat config ../.secrets/git/config >> .config + ln -sf -- ~/.dotfiles/git/.config ~/.config/git/config mkdir -p -- ~/.config/bash/aliases.d test ! -d ~/.config/bash/aliases.d/git ln -sf -- ~/.dotfiles/git/bash-aliases ~/.config/bash/aliases.d/git - $(CHECK_INSTALLED) dash + ../check-installed-shebang ge mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/git/ge ~/.local/bin/ + ln -sf -- ~/.dotfiles/git/new-c-proj ~/.local/bin/ uninstall: + +! ../check-installed git -unlink -- ~/.config/git/config - -rmdir -- ~/.config/git + -rmdir -- ~/.config/git/ -unlink -- ~/.config/bash/aliases.d/git -rmdir -- ~/.config/bash/aliases.d -unlink -- ~/.local/bin/ge + -unlink -- ~/.local/bin/new-c-proj -.PHONY: install uninstall +clean: + -rm -f -- .config diff --git a/git/new-c-proj b/git/new-c-proj new file mode 100755 index 0000000..ce04f39 --- /dev/null +++ b/git/new-c-proj @@ -0,0 +1,222 @@ +#!/bin/sh + +set -e + +if ! test $# = 1; then + printf 'usage %s: proj-name\n' "$0" >&2 + exit 1 +fi + +if printf '%s\n' "$1" | grep / >/dev/null 2>/dev/null; then + printf 'project name cannot contain a slash\n' "$0" >&2 + exit 1 +fi + +mkdir -- "$1" +cd -- "$1" +git init . + +cat > LICENSE < + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +EOF + +cat > .gitignore <> .git/info/exclude + +if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then + UPPERCASE="$(printf '%s\n' "$1" | tr '[a-z-]' '[A-Z_]')" + LIBNAME="$(printf '%s\n' "$1" | sed 's/^lib//')" + + printf '%s\n' >> "$1".h \ + '/* See LICENSE file for copyright and license details. */' \ + "#ifndef ${UPPERCASE}_H" \ + "#define ${UPPERCASE}_H" \ + '' \ + '#endif' + + mkdir -p -- mk + + cat <<-EOF | sed 's/x\t/\t/g' > Makefile + .POSIX: + + CONFIGFILE = config.mk + include \$(CONFIGFILE) + + OS = linux + # Linux: linux + # Mac OS: macos + # Windows: windows + include mk/\$(OS).mk + + + LIB_MAJOR = 1 + LIB_MINOR = 0 + LIB_VERSION = \$(LIB_MAJOR).\$(LIB_MINOR) + LIB_NAME = ${LIBNAME} + + + OBJ = + + HDR =\\ + x $1.h + + LOBJ = \$(OBJ:.o=.lo) + + + all: $1.a $1.\$(LIBEXT) + \$(OBJ): \$(HDR) + \$(LOBJ): \$(HDR) + + .c.o: + x \$(CC) -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) + + .c.lo: + x \$(CC) -fPIC -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) + + $1.a: \$(OBJ) + x @rm -f -- \$@ + x \$(AR) rc \$@ \$(OBJ) + x \$(AR) ts \$@ > /dev/null + + $1.\$(LIBEXT): \$(LOBJ) + x \$(CC) \$(LIBFLAGS) -o \$@ \$(LOBJ) \$(LDFLAGS) + + install: $1.a $1.\$(LIBEXT) + x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/lib" + x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/include" + x cp -- $1.a "\$(DESTDIR)\$(PREFIX)/lib/" + x cp -- $1.\$(LIBEXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" + x \$(FIX_INSTALL_NAME) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" + x ln -sf -- $1.\$(LIBMINOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" + x ln -sf -- $1.\$(LIBMAJOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBEXT)" + x cp -- $1.h "\$(DESTDIR)\$(PREFIX)/include/" + + uninstall: + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.a" + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)" + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBEXT)" + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/include/$1.h" + + clean: + x -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib + x -rm -f -- *.gch *.gcov *.gcno *.gcda *.\$(LIBEXT) + + .SUFFIXES: + .SUFFIXES: .lo .o .c + + .PHONY: all install uninstall clean + EOF + + cat <<-EOF | sed 's/x\t/\t/g' > mk/linux.mk + LIBEXT = so + LIBFLAGS = -shared -Wl,-soname,lib\$(LIB_NAME).\$(LIBEXT).\$(LIB_MAJOR) + LIBMAJOREXT = \$(LIBEXT).\$(LIB_MAJOR) + LIBMINOREXT = \$(LIBEXT).\$(LIB_VERSION) + + FIX_INSTALL_NAME = : + EOF + + cat <<-EOF | sed 's/x\t/\t/g' > mk/macos.mk + LIBEXT = dylib + LIBFLAGS = -dynamiclib -Wl,-compatibility_version,\$(LIB_MAJOR) -Wl,-current_version,\$(LIB_VERSION) + LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT) + LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT) + + FIX_INSTALL_NAME = install_name_tool -id "\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)" + EOF + + cat <<-EOF | sed 's/x\t/\t/g' > mk/windows.mk + LIBEXT = dll + LIBFLAGS = -shared + LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT) + LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT) + + FIX_INSTALL_NAME = : + EOF +else + printf '%s\n' "/$1" >> .gitignore + + printf '%s\n' '/* See LICENSE file for copyright and license details. */' >> "$1".c + + cat <<-EOF | sed 's/x\t/\t/g' > Makefile + .POSIX: + + CONFIGFILE = config.mk + include \$(CONFIGFILE) + + OBJ =\\ + x $1.o + + HDR = + + all: $1 + \$(OBJ): \$(HDR) + + .c.o: + x \$(CC) -c -o \$@ \$< \$(CFLAGS) \$(CPPFLAGS) + + $1: \$(OBJ) + x \$(CC) -o \$@ \$(OBJ) \$(LDFLAGS) + + install: $1 + x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/bin" + x mkdir -p -- "\$(DESTDIR)\$(MANPREFIX)/man1/" + x cp -- $1 "\$(DESTDIR)\$(PREFIX)/bin/" + x cp -- $1.1 "\$(DESTDIR)\$(MANPREFIX)/man1/" + + uninstall: + x -rm -f -- "\$(DESTDIR)\$(PREFIX)/bin/$1" + x -rm -f -- "\$(DESTDIR)\$(MANPREFIX)/man1/$1.1" + + clean: + x -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda + x -rm -f -- $1 + + .SUFFIXES: + .SUFFIXES: .o .c + + .PHONY: all install uninstall clean + EOF +fi + +cat > config.mk <<-EOF + PREFIX = /usr + MANPREFIX = \$(PREFIX)/share/man + + CC = c99 + + CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_GNU_SOURCE + CFLAGS = + LDFLAGS = +EOF diff --git a/gnupg/Makefile b/gnupg/Makefile index 76f83e9..f5e6310 100644 --- a/gnupg/Makefile +++ b/gnupg/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.dotfiles/.secrets/gnupg @@ -11,20 +10,21 @@ install: ln -s -- ~/.dotfiles/.secrets/gnupg ~/.var/lib/gnupg; \ fi mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/gnupg + test ! -e ~/.config/profile.d/gnupg || test -L ~/.config/profile.d/gnupg ln -sf -- ~/.dotfiles/gnupg/user-profile ~/.config/profile.d/gnupg - $(CHECK_INSTALLED) dash + ../check-installed-shebang decrypt + ../check-installed-shebang encrypt + ../check-installed-shebang encrypt-nosign mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/gnupg/decrypt ~/.local/bin/ ln -sf -- ~/.dotfiles/gnupg/encrypt ~/.local/bin/ ln -sf -- ~/.dotfiles/gnupg/encrypt-nosign ~/.local/bin/ uninstall: + +! ../check-installed gnupg -unlink -- ~/.config/profile.d/gnupg -rmdir -- ~/.config/profile.d -unlink -- ~/.var/lib/gnupg -unlink -- ~/.local/bin/decrypt -unlink -- ~/.local/bin/encrypt -unlink -- ~/.local/bin/encrypt-nosign - -.PHONY: install uninstall diff --git a/google-chrome/Makefile b/google-chrome/Makefile index 06af0f6..0e6e807 100644 --- a/google-chrome/Makefile +++ b/google-chrome/Makefile @@ -1,10 +1,8 @@ .POSIX: -include ../common.mk install: @: uninstall: + +! ../check-installed google-chrome -rm -rf -- ~/.config/google-chrome - -.PHONY: install uninstall diff --git a/gpm/Makefile b/gpm/Makefile index da383c9..24e184d 100644 --- a/gpm/Makefile +++ b/gpm/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/gpm + test ! -e ~/.config/bash/aliases.d/gpm || test -L ~/.config/bash/aliases.d/gpm ln -sf -- ~/.dotfiles/gpm/bash-aliases ~/.config/bash/aliases.d/gpm uninstall: + +! ../check-installed gpm -unlink -- ~/.config/bash/aliases.d/gpm -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/grep/Makefile b/grep/Makefile index e3299e4..05b27e7 100644 --- a/grep/Makefile +++ b/grep/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/grep + test ! -e ~/.config/bash/aliases.d/grep || test -L ~/.config/bash/aliases.d/grep ln -sf -- ~/.dotfiles/grep/bash-aliases ~/.config/bash/aliases.d/grep uninstall: + +! ../check-installed grep -unlink -- ~/.config/bash/aliases.d/grep -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/gtk3/Makefile b/gtk3/Makefile index ca0e21b..06911f8 100644 --- a/gtk3/Makefile +++ b/gtk3/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/gtk3 + test ! -e ~/.config/profile.d/gtk3 || test -L ~/.config/profile.d/gtk3 ln -sf -- ~/.dotfiles/gtk3/user-profile ~/.config/profile.d/gtk3 uninstall: + +! ../check-installed gtk3 -unlink -- ~/.config/profile.d/gtk3 -rmdir -- ~/.config/profile.d - -.PHONY: install uninstall diff --git a/java-common b/java-common new file mode 120000 index 0000000..731c624 --- /dev/null +++ b/java-common @@ -0,0 +1 @@ +java-runtime \ No newline at end of file diff --git a/java-runtime/Makefile b/java-runtime/Makefile index 2098676..8cf19ee 100644 --- a/java-runtime/Makefile +++ b/java-runtime/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.var/cache/java @@ -7,13 +6,13 @@ install: test ! -e ~/.java ln -s -- .var/cache/java ~/.java mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/java-runtime + test ! -e ~/.config/profile.d/java-runtime || test -L ~/.config/profile.d/java-runtime ln -sf -- ~/.dotfiles/java-runtime/user-profile ~/.config/profile.d/java-runtime uninstall: + +! ../check-installed java-runtime + +! ../check-installed java-common -unlink -- ~/.config/profile.d/java-runtime -rmdir -- ~/.config/profile.d -rm -rf -- ~/.java -rm -rf -- ~/.var/cache/java - -.PHONY: install uninstall diff --git a/kdenlive/Makefile b/kdenlive/Makefile index 2278478..1ef4e8f 100644 --- a/kdenlive/Makefile +++ b/kdenlive/Makefile @@ -1,10 +1,8 @@ .POSIX: -include ../common.mk install: @: uninstall: + +! ../check-installed kdenlive -rm -f -- ~/.config/kdenliverc - -.PHONY: install uninstall diff --git a/less/Makefile b/less/Makefile index fdfe12c..81d08eb 100644 --- a/less/Makefile +++ b/less/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/less + test ! -e ~/.config/profile.d/less || test -L ~/.config/profile.d/less ln -sf -- ~/.dotfiles/less/user-profile ~/.config/profile.d/less uninstall: + +! ../check-installed less -unlink -- ~/.config/profile.d/less -rmdir -- ~/.config/profile.d - -.PHONY: install uninstall diff --git a/libcontacts/Makefile b/libcontacts/Makefile index 262f283..552e82d 100644 --- a/libcontacts/Makefile +++ b/libcontacts/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: test -d contacts @@ -12,10 +11,7 @@ install: fi uninstall: - -if ! $(CHECK_INSTALLED) libcontacts 2>/dev/null && \ - ! $(CHECK_INSTALLED) libcontacts-glibc 2>/dev/null && \ - ! $(CHECK_INSTALLED) libcontacts-musl 2>/dev/null; then \ - unlink -- ~/.config/contacts; \ - fi - -.PHONY: install uninstall + +! ../check-installed libcontacts + +! ../check-installed libcontacts-glibc + +! ../check-installed libcontacts-musl + -unlink -- ~/.config/contacts diff --git a/libreadline-glibc b/libreadline-glibc new file mode 120000 index 0000000..5238404 --- /dev/null +++ b/libreadline-glibc @@ -0,0 +1 @@ +libreadline \ No newline at end of file diff --git a/libreadline-musl b/libreadline-musl new file mode 120000 index 0000000..5238404 --- /dev/null +++ b/libreadline-musl @@ -0,0 +1 @@ +libreadline \ No newline at end of file diff --git a/man-db b/man-db new file mode 120000 index 0000000..7dfdcf7 --- /dev/null +++ b/man-db @@ -0,0 +1 @@ +man \ No newline at end of file diff --git a/man/Makefile b/man/Makefile new file mode 100644 index 0000000..726047c --- /dev/null +++ b/man/Makefile @@ -0,0 +1,18 @@ +.POSIX: + +install: + ../check-installed-shebang colourised-less-for-man + ../check-installed-shebang man + ../check-in-path dmenu + ../check-in-path sed + ../check-in-path isfg + ../check-in-path less + mkdir -p -- ~/.local/bin + ln -sf -- ~/.dotfiles/man/man ~/.local/bin/ + ln -sf -- ~/.dotfiles/man/colourised-less-for-man ~/.local/bin/ + +uninstall: + +! ../check-installed man + +! ../check-installed man-db + -unlink -- ~/.local/bin/man + -unlink -- ~/.local/bin/colourised-less-for-man diff --git a/man/colourised-less-for-man b/man/colourised-less-for-man new file mode 100755 index 0000000..e57fa18 --- /dev/null +++ b/man/colourised-less-for-man @@ -0,0 +1,22 @@ +#!/bin/dash + +colourise () { + if test -n "$2"; then + from="$(printf "$1"'\n' | sed 's/\[/\\[/g')" + to="$(printf '%s\n' "$2" | sed 's/\[/\\[/g')" + shift 2 + sed "s/$from/$to/g" | "$@" + else + shift 2 + "$@" + fi +} + +sed 's/\x1B\[\(.\)m\x1B\[2\(.\)m/\x1B\[2\2m\x1B\[\1m/g' | \ +colourise "\033[4m" "${LESS_TERMCAP_us}" \ +colourise "\033[24m" "${LESS_TERMCAP_ue}" \ +colourise "\033[1m" "${LESS_TERMCAP_md}" \ +colourise "\033[22m" "${LESS_TERMCAP_me}" \ +colourise "\033[7m" "${LESS_TERMCAP_so}" \ +colourise "\033[27m" "${LESS_TERMCAP_se}" \ +less "$@" diff --git a/man/man b/man/man new file mode 100755 index 0000000..bcd9481 --- /dev/null +++ b/man/man @@ -0,0 +1,44 @@ +#!/bin/dash + +# Browse with dmenu if no page has been specified +if test $# = 0; then + manpage="$(/usr/bin/man -k '' | dmenu -l 40 | sed 's/^\([^ ]*\) (\([^)]*\)).*$/\2 \1/')" + if test -z "$manpage"; then + exit 1 + fi + set $manpage +fi + + +# Bold +export LESS_TERMCAP_md="$(printf '\033[01;34m')" +export LESS_TERMCAP_me="$(printf '\033[0m')" + +# Italic +export LESS_TERMCAP_us="$(printf '\033[01;04;32m')" +export LESS_TERMCAP_ue="$(printf '\033[0m')" + +# Reverse video +if test "$TERM" = linux; then + export LESS_TERMCAP_so="$(printf '\033[07m')" +else + export LESS_TERMCAP_so="$(printf '\033[07;01m')" +fi +export LESS_TERMCAP_se="$(printf '\033[0m')" + +# The above stopped working +if test -z "$MANPAGER"; then + export MANPAGER=colourised-less-for-man +fi + + +# Display, open new terminal if in the background +if isfg; then + exec /usr/bin/man "$@" +elif test -x /usr/bin/terminator; then + exec terminator -e "/usr/bin/man $*" +elif test -x /usr/bin/st; then + exec st -e /usr/bin/man "$@" +else + exec xterm -e /usr/bin/man "$@" +fi diff --git a/meld-gtk2 b/meld-gtk2 new file mode 120000 index 0000000..fed87f8 --- /dev/null +++ b/meld-gtk2 @@ -0,0 +1 @@ +meld \ No newline at end of file diff --git a/meld/Makefile b/meld/Makefile index de0373a..1e12515 100644 --- a/meld/Makefile +++ b/meld/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk # Unfortunely meldrc.ini contains both (for us unless) state and settings, # therefore we are making a copy instead of a link. Otherwise running meld @@ -10,7 +9,7 @@ install: cp -- meldrc.ini ~/.config/meld/ uninstall: + +! ../check-installed meld + +! ../check-installed meld-gtk2 -unlink -- ~/.config/meld/meldrc.ini -rm -rf -- ~/.config/meld - -.PHONY: install uninstall diff --git a/moc/Makefile b/moc/Makefile index 70d4be6..456c431 100644 --- a/moc/Makefile +++ b/moc/Makefile @@ -1,18 +1,16 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.var/lib/moc mkdir -p -- ~/.config/bash/aliases.d rm -rf ~/.moc - test ! -d ~/.config/bash/aliases.d/moc + test ! -e ~/.config/bash/aliases.d/moc || test -L ~/.config/bash/aliases.d/moc ln -sf -- .var/lib/moc ~/.moc ln -sf -- ~/.dotfiles/moc/bash-aliases ~/.config/bash/aliases.d/moc uninstall: + +! ../check-installed moc -unlink -- ~/.moc -unlink -- ~/.config/bash/aliases.d/moc -rmdir -- ~/.config/bash/aliases.d -rm -rf -- ~/.var/lib/moc - -.PHONY: install uninstall diff --git a/mplayer/Makefile b/mplayer/Makefile index 372ea97..3f08050 100644 --- a/mplayer/Makefile +++ b/mplayer/Makefile @@ -1,18 +1,16 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) dash + ../check-installed-shebang mplayer mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/mplayer + test ! -e ~/.config/profile.d/mplayer || test -L ~/.config/profile.d/mplayer ln -sf -- ~/.dotfiles/mplayer/user-profile ~/.config/profile.d/mplayer mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/mplayer/mplayer ~/.local/bin/ uninstall: + +! ../check-installed mplayer -unlink -- ~/.config/profile.d/mplayer -rmdir -- ~/.config/profile.d -rm -rf -- ~/.config/mplayer -unlink -- ~/.local/bin/mplayer - -.PHONY: install uninstall diff --git a/my-scripts/Makefile b/my-scripts/Makefile index 7c4d908..3ed0a44 100644 --- a/my-scripts/Makefile +++ b/my-scripts/Makefile @@ -1,13 +1,12 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/my-scripts + test ! -e ~/.config/bash/aliases.d/my-scripts || \ + test -L ~/.config/bash/aliases.d/my-scripts ln -sf -- ~/.dotfiles/my-scripts/bash-aliases ~/.config/bash/aliases.d/my-scripts uninstall: + +! ../check-installed my-scripts -unlink -- ~/.config/bash/aliases.d/my-scripts -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/my-scripts/bash-aliases b/my-scripts/bash-aliases index 4b3b78b..b4c4dbd 100644 --- a/my-scripts/bash-aliases +++ b/my-scripts/bash-aliases @@ -3,3 +3,5 @@ if test "$TERM" = linux; then alias etty='etty;palette-reset' fi + +alias et=etty diff --git a/openssh b/openssh new file mode 120000 index 0000000..ffd8d03 --- /dev/null +++ b/openssh @@ -0,0 +1 @@ +ssh \ No newline at end of file diff --git a/openssh/Makefile b/openssh/Makefile deleted file mode 100644 index 6ee7512..0000000 --- a/openssh/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -.POSIX: -include ../common.mk - -install: - if test -L ~/.ssh; then \ - test "$$(readlink -- ~/.ssh)" = ~/.dotfiles/.secrets/ssh; \ - else \ - test ! -e ~/.ssh && \ - ln -sf -- ~/.dotfiles/.secrets/ssh ~/.ssh; \ - fi - mkdir -p -- ../.secrets/ssh - mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/openssh - ln -sf -- ~/.dotfiles/openssh/bash-aliases ~/.config/bash/aliases.d/openssh - -uninstall: - -if ! $(CHECK_INSTALLED) ssh 2>/dev/null && \ - ! $(CHECK_INSTALLED) openssh 2>/dev/null; then \ - unlink -- ~/.ssh; \ - unlink -- ~/.config/bash/aliases.d/openssh; \ - rmdir -- ~/.config/bash/aliases.d; \ - fi - -.PHONY: install uninstall diff --git a/openssh/bash-aliases b/openssh/bash-aliases deleted file mode 100644 index 38f7a01..0000000 --- a/openssh/bash-aliases +++ /dev/null @@ -1,9 +0,0 @@ -# -*- shell-script -*- - -if test -n "$DISPLAY"; then - alias sshhome="ssh -YC -p7777 mattias@maandree.ignorelist.com" -else - alias sshhome="ssh -p7777 mattias@maandree.ignorelist.com" -fi -alias sftphome="sftp -P7777 mattias@maandree.ignorelist.com" -alias scphome="scp -P7777" diff --git a/pluma-gtk2 b/pluma-gtk2 new file mode 120000 index 0000000..bbfea97 --- /dev/null +++ b/pluma-gtk2 @@ -0,0 +1 @@ +pluma \ No newline at end of file diff --git a/pluma/Makefile b/pluma/Makefile index 1143d45..49ff8ea 100644 --- a/pluma/Makefile +++ b/pluma/Makefile @@ -1,10 +1,9 @@ .POSIX: -include ../common.mk install: @: uninstall: + +! ../check-installed pluma + +! ../check-installed pluma-gtk2 -rm -rf -- ~/.config/pluma - -.PHONY: install uninstall diff --git a/pony.computer/Makefile b/pony.computer/Makefile index f1bb603..088a16f 100644 --- a/pony.computer/Makefile +++ b/pony.computer/Makefile @@ -1,13 +1,12 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/pony.computer + test ! -e ~/.config/bash/aliases.d/pony.computer || \ + test -L ~/.config/bash/aliases.d/pony.computer ln -sf -- ~/.dotfiles/pony.computer/bash-aliases ~/.config/bash/aliases.d/pony.computer uninstall: + +! ../check-installed pony.computer -unlink -- ~/.config/bash/aliases.d/pony.computer -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/pony.computer/bash-aliases b/pony.computer/bash-aliases index 4a9326d..1a98008 100644 --- a/pony.computer/bash-aliases +++ b/pony.computer/bash-aliases @@ -2,7 +2,7 @@ #DESCRIPTION: Utilise KMS support in ponysay when in a TTY and running pony.computer -if "$TERM" = "linux"; then +if test "$TERM" = "linux"; then pony.computer () { PONYSAY_KMS_PALETTE="$PALETTE" /usr/bin/pony.computer "$@" printf "$PALETTE" diff --git a/ponysay/Makefile b/ponysay/Makefile index 42cff78..7e807d6 100644 --- a/ponysay/Makefile +++ b/ponysay/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/ponysay + test ! -e ~/.config/bash/aliases.d/ponysay || test -L ~/.config/bash/aliases.d/ponysay ln -sf -- ~/.dotfiles/ponysay/bash-aliases ~/.config/bash/aliases.d/ponysay uninstall: + +! ../check-installed ponysay -unlink -- ~/.config/bash/aliases.d/ponysay -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/ponysay/bash-aliases b/ponysay/bash-aliases index 3b9faed..728f10e 100644 --- a/ponysay/bash-aliases +++ b/ponysay/bash-aliases @@ -2,7 +2,7 @@ #DESCRIPTION: Utilise KMS support in ponysay when in a TTY -if test"$TERM" = "linux"; then +if test "$TERM" = "linux"; then ponysay () { PONYSAY_KMS_PALETTE="$PALETTE" /usr/bin/ponysay "$@" printf "$PALETTE" diff --git a/procps/Makefile b/procps/Makefile index 7e245e2..e9a682e 100644 --- a/procps/Makefile +++ b/procps/Makefile @@ -1,10 +1,8 @@ .POSIX: -include ../common.mk install: -rmdir -- ~/.config/procps uninstall: + +! ../check-installed procps -rm -rf -- ~/.config/procps - -.PHONY: install uninstall diff --git a/pytagomacs/Makefile b/pytagomacs/Makefile index 925c591..87479f0 100644 --- a/pytagomacs/Makefile +++ b/pytagomacs/Makefile @@ -1,12 +1,10 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config - test ! -d ~/.config/pytagomacsrc + test ! -e ~/.config/pytagomacsrc || test -L ~/.config/pytagomacsrc ln -sf -- ~/.dotfiles/pytagomacs/pytagomacsrc ~/.config/pytagomacsrc uninstall: + +! ../check-installed pytagomacs -unlink -- ~/.config/pytagomacsrc - -.PHONY: install uninstall diff --git a/python/Makefile b/python/Makefile index 1befb29..f0d75f6 100644 --- a/python/Makefile +++ b/python/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.var/cache @@ -15,11 +14,10 @@ install: fi uninstall: + +! ../check-installed python -unlink -- ~/.config/profile.d/python -rmdir -- ~/.config/profile.d -unlink -- ~/.var/cache/python_history -unlink -- ~/.python_history -unlink -- ~/.config/bash/aliases.d/python -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/qt5-style-plugins b/qt5-style-plugins new file mode 120000 index 0000000..473bc14 --- /dev/null +++ b/qt5-style-plugins @@ -0,0 +1 @@ +qt5-styleplugins \ No newline at end of file diff --git a/qt5-styleplugins/Makefile b/qt5-styleplugins/Makefile index 0583e96..3228afd 100644 --- a/qt5-styleplugins/Makefile +++ b/qt5-styleplugins/Makefile @@ -1,13 +1,13 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/profile.d - test ! -d ~/.config/profile.d/qt5-styleplugins + test ! -e ~/.config/profile.d/qt5-styleplugins || \ + test -L ~/.config/profile.d/qt5-styleplugins ln -sf -- ~/.dotfiles/qt5-styleplugins/user-profile ~/.config/profile.d/qt5-styleplugins uninstall: + +! ../check-installed qt5-styleplugins + +! ../check-installed qt5-style-plugins -unlink -- ~/.config/profile.d/qt5-styleplugins -rmdir -- ~/.config/profile.d - -.PHONY: install uninstall diff --git a/qt5-styleplugins/user-profile b/qt5-styleplugins/user-profile index 1491d3b..f61c205 100644 --- a/qt5-styleplugins/user-profile +++ b/qt5-styleplugins/user-profile @@ -1,3 +1,5 @@ # -*- shell-script -*- -export QT_STYLE_OVERRIDE=GTK2 +if test "$(hostname)" = Zenith; then # TODO + export QT_STYLE_OVERRIDE=GTK2 +fi diff --git a/radharc/Makefile b/radharc/Makefile index 9c94b2a..f68072b 100644 --- a/radharc/Makefile +++ b/radharc/Makefile @@ -1,22 +1,21 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 20 install: - test -x /bin/dash + ../check-installed-shebang radharc mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-radharc + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-radharc || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-radharc ln -sf -- ~/.dotfiles/radharc/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-radharc mkdir -p -- ~/.local/bin - test ! -d ~/.local/bin/radharc + test ! -e ~/.local/bin/radharc || test -L ~/.local/bin/radharc ln -sf -- ~/.dotfiles/radharc/radharc ~/.local/bin/radharc uninstall: + +! ../check-installed radharc -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-radharc -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 -unlink -- ~/.local/bin/radharc - -.PHONY: install uninstall diff --git a/radharc/radharc b/radharc/radharc index b630bc9..6b32699 100755 --- a/radharc/radharc +++ b/radharc/radharc @@ -1,10 +1,13 @@ #!/bin/dash -location= if test -r ~/.config/geolocation; then - location=-L"$(head -n1 ~/.config/geolocation | tr ' ' :)" + location="-L $(head -n1 ~/.config/geolocation | tr ' ' :)" elif test -r /etc/geolocation; then - location=-L"$(head -n1 /etc/geolocation | tr ' ' :)" + location="-L $(head -n1 /etc/geolocation | tr ' ' :)" +elif test $# = 0; then + exec /usr/bin/radharc -t 5500 +else + exec /usr/bin/radharc "$@" fi exec /usr/bin/radharc $location -l3500 -h5500 "$@" diff --git a/readline-common b/readline-common new file mode 120000 index 0000000..47f39c3 --- /dev/null +++ b/readline-common @@ -0,0 +1 @@ +readline \ No newline at end of file diff --git a/readline/Makefile b/readline/Makefile index 288907c..45c47e8 100644 --- a/readline/Makefile +++ b/readline/Makefile @@ -1,18 +1,17 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config - test ! -d ~/.config/inputrc - test ! -d ~/.inputrc + test ! -e ~/.config/inputrc || test -L ~/.config/inputrc + test ! -e ~/.inputrc || test -L ~/.inputrc ln -sf -- ~/.dotfiles/readline/inputrc ~/.config/inputrc ln -sf -- .config/inputrc ~/.inputrc uninstall: - -if ! $(CHECK_INSTALLED) readline 2>/dev/null && \ - ! $(CHECK_INSTALLED) libreadline 2>/dev/null; then \ - unlink -- ~/.config/inputrc; \ - unlink -- ~/.inputrc; \ - fi - -.PHONY: install uninstall + +! ../check-installed readline + +! ../check-installed libreadline + +! ../check-installed libreadline-glibc + +! ../check-installed libreadline-musl + +! ../check-installed readline-common + -unlink -- ~/.config/inputrc + -unlink -- ~/.inputrc diff --git a/rotd/Makefile b/rotd/Makefile index a292658..4669891 100644 --- a/rotd/Makefile +++ b/rotd/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: test -d config @@ -12,6 +11,5 @@ install: fi uninstall: + +! ../check-installed rotd -unlink -- ~/.config/rotd - -.PHONY: install uninstall diff --git a/rust/Makefile b/rust/Makefile index cc81345..05911fb 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -1,21 +1,20 @@ .POSIX: -include ../common.mk install: if test -d ~/.cargo; then \ - test ! -d ~/.var/lib/cargo && \ + (test ! -e ~/.var/lib/cargo || test -L ~/.var/lib/cargo) && \ mkdir -p -- ~/.var/lib && \ mv ~/.cargo ~/.var/lib/cargo; \ else \ mkdir -p -- ~/.var/lib; \ fi - test ! -d ~/.config/profile.d/rust - ln -sf -- ~/.dotfiles/rust/user-profile ~/.config/profile.d/rust + test ! -e ~/.config/profile.d/cargo || test -L ~/.config/profile.d/cargo + ln -sf -- ~/.dotfiles/cargo/user-profile ~/.config/profile.d/cargo uninstall: + +! ../check-installed rust + +! ../check-installed cargo -rm -rf -- ~/.var/cache/cargo -rm -rf -- ~/.cargo -unlink -- ~/.config/profile.d/rust -rmdir -- ~/.config/profile.d - -.PHONY: install uninstall diff --git a/signal-desktop/Makefile b/signal-desktop/Makefile index 2aa0c96..ce08e1d 100644 --- a/signal-desktop/Makefile +++ b/signal-desktop/Makefile @@ -1,20 +1,20 @@ .POSIX: -include ../common.mk install: test -f ~/.var/opt/signal/SignalCrypt.img test -f ~/.var/opt/signal/SignalCrypt.key mkdir -p -- ~/.var/opt/signal/SignalCrypt.d test -e ~/.config/Signal || ln -sf -- ../.var/opt/signal/SignalCrypt.d/Signal ~/.config/Signal - $(CHECK_INSTALLED) asroot - $(CHECK_INSTALLED) gnupg - $(CHECK_INSTALLED) cryptsetup + ../check-any-installed asroot asroot-libpassphrase + ../check-installed gnupg + ../check-installed cryptsetup + ../check-installed key2root mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/signal-desktop + test ! -e ~/.config/bash/aliases.d/signal-desktop || \ + test -L ~/.config/bash/aliases.d/signal-desktop ln -sf -- ~/.dotfiles/signal-desktop/bash-aliases ~/.config/bash/aliases.d/signal-desktop uninstall: + +! ../check-installed signal-desktop -unlink -- ~/.config/bash/aliases.d/signal-desktop -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/signal-desktop/bash-aliases b/signal-desktop/bash-aliases index a2669ab..a50c8f6 100644 --- a/signal-desktop/bash-aliases +++ b/signal-desktop/bash-aliases @@ -1,20 +1,42 @@ # -*- shell-script -*- mount-signal () { - gpg --decrypt ~/.var/opt/signal/SignalCrypt.key | \ - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/opt/signal sh -ec ' - device="$(losetup --show -f -P "${SIGNAL_DIR}/SignalCrypt.img")" - printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/SignalCrypt" - cryptsetup -d - open "${device}" SignalCrypt - mount /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d" - ' + if mountpoint -q -- ~/.var/opt/signal/SignalCrypt.d; then + printf '%s\n' 'mount-signal: already mounted' >&2 + elif test -e /dev/mapper/SignalCrypt; then + asroot env SIGNAL_DIR=~/.var/opt/signal sh -ec \ + 'mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d"' + else + gpg --decrypt ~/.var/opt/signal/SignalCrypt.key | \ + key2root -k SignalCrypt env \ + SIGNAL_IMG=~/.var/opt/signal/SignalCrypt.img \ + SIGNAL_DIR=~/.var/opt/signal \ + SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/signal/SignalCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${SIGNAL_DEV}"; then + SIGNAL_DEV="$(losetup --show -f -P "${SIGNAL_IMG}")" + fi + cryptsetup -d - open "${SIGNAL_DEV}" SignalCrypt + mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d" + ' + fi } umount-signal () { - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/opt/signal sh -c ' - umount "${SIGNAL_DIR}/SignalCrypt.d" - cryptsetup close SignalCrypt - losetup -d "$(cat -- "${XDG_RUNTIME_DIR}/SignalCrypt")" - rm -f -- "${XDG_RUNTIME_DIR}/SignalCrypt" + asroot env \ + SIGNAL_DIR=~/.var/opt/signal \ + SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/signal/SignalCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${SIGNAL_DIR}/SignalCrypt.d"; then + umount -- "${SIGNAL_DIR}/SignalCrypt.d" + fi + if test -e /dev/mapper/SignalCrypt; then + cryptsetup close SignalCrypt + fi + if test -n "${SIGNAL_DEV}"; then + losetup -d "${SIGNAL_DEV}" + fi ' } diff --git a/ssh b/ssh deleted file mode 120000 index dc275a7..0000000 --- a/ssh +++ /dev/null @@ -1 +0,0 @@ -openssh \ No newline at end of file diff --git a/ssh/.gitignore b/ssh/.gitignore new file mode 100644 index 0000000..9942bb7 --- /dev/null +++ b/ssh/.gitignore @@ -0,0 +1 @@ +.ssh-config diff --git a/ssh/Makefile b/ssh/Makefile new file mode 100644 index 0000000..b16f051 --- /dev/null +++ b/ssh/Makefile @@ -0,0 +1,54 @@ +.POSIX: + +install: + -rm -f -- .ssh-config + test ! -e .ssh-config && test ! -L .ssh-config + printf '# %s\n' 'THIS FILE IS GENERATED from ~/.dotfiles/ssh/Makefile' \ + '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' > .ssh-config + printf '\n\n' >> .ssh-config + if test -f config; then \ + cat config >> .ssh-config; \ + fi + set config.d/* && if test -f "$$1"; then \ + ../cat-nonbackups -- "$$@" >> .ssh-config; \ + fi + if test -f ../.secrets/ssh/config; then \ + cat ../.secrets/ssh/config >> .ssh-config; \ + fi + set ../.secrets/ssh/config.d/* && if test -f "$$1"; then \ + ../cat-nonbackups "$$@" >> .ssh-config; \ + fi + if test -f ../.work/ssh/config; then \ + cat ../.work/ssh/config >> .ssh-config; \ + fi + set ../.work/ssh/config.d/* && if test -f "$$1"; then \ + ../cat-nonbackups "$$@" >> .ssh-config; \ + fi + mkdir -p -- ~/.ssh + test ! -e ~/.ssh/config || test -L ~/.ssh/config + test ! -e ~/.ssh/config || test -f ~/.ssh/config + ln -sf -- ~/.dotfiles/ssh/.ssh-config ~/.ssh/config + set ~/.dotfiles/.secrets/ssh/keys/* && if test -f "$$1"; then \ + ln -sf -- "$$@" ~/.ssh/; \ + fi + set ~/.dotfiles/.work/ssh/keys/* && if test -f "$$1"; then \ + ln -sf -- "$$@" ~/.ssh/; \ + fi + mkdir -p -- ~/.config/bash/aliases.d + test ! -e ~/.config/bash/aliases.d/openssh || test -L ~/.config/bash/aliases.d/openssh + ln -sf -- ~/.dotfiles/openssh/bash-aliases ~/.config/bash/aliases.d/openssh + +uninstall: + +! ../check-installed ssh + +! ../check-installed openssh + -unlink -- ~/.ssh/config + -unlink -- ~/.ssh/known_hosts + -unlink -- ~/.ssh/known_hosts.old + -cd ../.work/ssh/keys/ && set * && if test -f "$$1"; then \ + cd ~/.ssh/ && \ + rm -f -- "$$@"; \ + fi + -rmdir -- ~/.ssh + -rm -f -- .ssh-config + -unlink -- ~/.config/bash/aliases.d/openssh + -rmdir -- ~/.config/bash/aliases.d diff --git a/ssh/bash-aliases b/ssh/bash-aliases new file mode 100644 index 0000000..d145aee --- /dev/null +++ b/ssh/bash-aliases @@ -0,0 +1,24 @@ +# -*- shell-script -*- + +__gethomename () { + if ping -c1 -W0.2 zenith >/dev/null 2>/dev/null; then + printf '%s\n' zenith + else + printf '%s\n' home + fi +} + +sshhome () { + if test -n "$DISPLAY"; then + ssh -YC "$(__gethomename)" + else + ssh "$(__gethomename)" + fi +} + +sftphome () { + sftp "$(__gethomename)" +} + +alias sshz=sshhome +alias sftpz=sftphome diff --git a/st/Makefile b/st/Makefile index e9e6f52..f288c78 100644 --- a/st/Makefile +++ b/st/Makefile @@ -1,12 +1,10 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) dash + ../check-installed-shebang st mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/st/st ~/.local/bin/ uninstall: + +! ../check-installed st -unlink -- ~/.local/bin/st - -.PHONY: install uninstall diff --git a/st/st b/st/st index 79422c5..ae7ad89 100755 --- a/st/st +++ b/st/st @@ -1,9 +1,11 @@ #!/bin/dash +# TODO #font="schumacher clean-11" #font="DejaVu Sans Mono-10" #font="Mono-9:autohint=true" font="vectorfixed:pixelsize=11:antialias=false:autohint=false" +#font="Dina TTF Normal-8" #font="-misc-fixed-medium-r-normal-*-14-*-*-*-c-*-utf-8" if test -x /usr/local/bin/st; then diff --git a/suckless-tools/Makefile b/suckless-tools/Makefile new file mode 100644 index 0000000..f3d790b --- /dev/null +++ b/suckless-tools/Makefile @@ -0,0 +1,9 @@ +.POSIX: + +install uninstall: + +if test -d ../dmenu; then cd ../dmenu && $(MAKE) "$@"; fi + +if test -d ../st; then cd ../st && $(MAKE) "$@"; fi + +.DEFAULT: + +if test -d ../dmenu; then cd ../dmenu && $(MAKE) "$@"; fi + +if test -d ../st; then cd ../st && $(MAKE) "$@"; fi diff --git a/sudo/Makefile b/sudo/Makefile index 6a510bf..44631f2 100644 --- a/sudo/Makefile +++ b/sudo/Makefile @@ -1,13 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/sudo + test ! -e ~/.config/bash/aliases.d/sudo || test -L ~/.config/bash/aliases.d/sudo ln -sf -- ~/.dotfiles/sudo/bash-aliases ~/.config/bash/aliases.d/sudo uninstall: + +! ../check-installed sudo -unlink -- ~/.config/bash/aliases.d/sudo -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/texinfo/Makefile b/texinfo/Makefile index beaa9d7..8ea0ad7 100644 --- a/texinfo/Makefile +++ b/texinfo/Makefile @@ -1,20 +1,17 @@ .POSIX: -include ../common.mk install: - if test -x /usr/bin/info; then \ + if ../check-in-path info; then \ mkdir -p -- ~/.config/bash/aliases.d && \ - test ! -d ~/.config/bash/aliases.d/texinfo && \ + (test ! -e ~/.config/bash/aliases.d/texinfo || \ + test -L ~/.config/bash/aliases.d/texinfo) && \ ln -sf -- ~/.dotfiles/texinfo/bash-aliases ~/.config/bash/aliases.d/texinfo; \ else \ - make uninstall; \ + $(MAKE) uninstall; \ fi uninstall: - -if ! $(CHECK_INSTALLED) info 2>/dev/null && \ - ! $(CHECK_INSTALLED) texinfo 2>/dev/null; then \ - unlink -- ~/.config/bash/aliases.d/texinfo; \ - rmdir -- ~/.config/bash/aliases.d; \ - fi - -.PHONY: install uninstall + +! ../check-installed info + +! ../check-installed texinfo + unlink -- ~/.config/bash/aliases.d/texinfo + rmdir -- ~/.config/bash/aliases.d diff --git a/texlive-base b/texlive-base new file mode 120000 index 0000000..a867498 --- /dev/null +++ b/texlive-base @@ -0,0 +1 @@ +texlive-bin \ No newline at end of file diff --git a/texlive-bin/Makefile b/texlive-bin/Makefile index bd4f7e9..18bac65 100644 --- a/texlive-bin/Makefile +++ b/texlive-bin/Makefile @@ -1,5 +1,4 @@ .POSIX: -include ../common.mk install: if test -L ~/.texlive; then \ @@ -9,7 +8,7 @@ install: if test -d ~/.texlive; then \ test ! -d ~/.var/cache/texlive && \ mkdir -p -- ~/.var/cache && \ - mv ~/.texlive ~/.var/cache/texlive; \ + mv -- ~/.texlive ~/.var/cache/texlive; \ else \ mkdir -p -- ~/.var/cache/texlive; \ fi; \ @@ -17,7 +16,7 @@ install: fi uninstall: + +! ../check-installed texlive-bin + +! ../check-installed texlive-base -rm -rf -- ~/.var/cache/texlive -rm -rf -- ~/.texlive - -.PHONY: install uninstall diff --git a/twm b/twm new file mode 120000 index 0000000..f5af040 --- /dev/null +++ b/twm @@ -0,0 +1 @@ +xorg-twm \ No newline at end of file diff --git a/vlc/Makefile b/vlc/Makefile index b411fbc..8207292 100644 --- a/vlc/Makefile +++ b/vlc/Makefile @@ -1,10 +1,8 @@ .POSIX: -include ../common.mk install: @: uninstall: + +! ../check-installed vlc -rm -rf -- ~/.config/vlc - -.PHONY: install uninstall diff --git a/wget/Makefile b/wget/Makefile index 92361f0..3334065 100644 --- a/wget/Makefile +++ b/wget/Makefile @@ -1,11 +1,9 @@ .POSIX: -include ../common.mk install: test ! -d ~/.wget-hsts ln -sf -- /dev/null ~/.wget-hsts uninstall: + +! ../check-installed wget -unlink -- ~/.wget-hsts - -.PHONY: install uninstall diff --git a/wire-desktop/Makefile b/wire-desktop/Makefile index 41e4b5a..60a1b18 100644 --- a/wire-desktop/Makefile +++ b/wire-desktop/Makefile @@ -1,20 +1,20 @@ .POSIX: -include ../common.mk install: test -f ~/.var/opt/wire/WireCrypt.img test -f ~/.var/opt/wire/WireCrypt.key mkdir -p -- ~/.var/opt/wire/WireCrypt.d test -e ~/.config/Wire || ln -sf -- ../.var/opt/wire/WireCrypt.d/Wire ~/.config/Wire - $(CHECK_INSTALLED) asroot - $(CHECK_INSTALLED) gnupg - $(CHECK_INSTALLED) cryptsetup + ../check-any-installed asroot asroot-libpassphrase + ../check-installed gnupg + ../check-installed cryptsetup + ../check-installed key2root mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/wire-desktop + test ! -e ~/.config/bash/aliases.d/wire-desktop || \ + test -L ~/.config/bash/aliases.d/wire-desktop ln -sf -- ~/.dotfiles/wire-desktop/bash-aliases ~/.config/bash/aliases.d/wire-desktop uninstall: + +! ../check-installed wire-desktop -unlink -- ~/.config/bash/aliases.d/wire-desktop -rmdir -- ~/.config/bash/aliases.d - -.PHONY: install uninstall diff --git a/wire-desktop/bash-aliases b/wire-desktop/bash-aliases index 0fe1b9e..dfc0d2b 100644 --- a/wire-desktop/bash-aliases +++ b/wire-desktop/bash-aliases @@ -1,20 +1,42 @@ # -*- shell-script -*- mount-wire () { - gpg --decrypt ~/.var/opt/wire/WireCrypt.key | \ - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" WIRE_DIR=~/.var/opt/wire sh -ec ' - device="$(losetup --show -f -P "${WIRE_DIR}/WireCrypt.img")" - printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/WireCrypt" - cryptsetup -d - open "${device}" WireCrypt - mount /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d" - ' + if mountpoint -q -- ~/.var/opt/wire/WireCrypt.d; then + printf '%s\n' 'mount-wire: already mounted' >&2 + elif test -e /dev/mapper/WireCrypt; then + asroot env WIRE_DIR=~/.var/opt/wire sh -ec \ + 'mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d"' + else + gpg --decrypt ~/.var/opt/wire/WireCrypt.key | \ + key2root -k WireCrypt env \ + WIRE_IMG=~/.var/opt/wire/WireCrypt.img \ + WIRE_DIR=~/.var/opt/wire \ + WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/wire/WireCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${WIRE_DEV}"; then + WIRE_DEV="$(losetup --show -f -P "${WIRE_IMG}")" + fi + cryptsetup -d - open "${WIRE_DEV}" WireCrypt + mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d" + ' + fi } umount-wire () { - asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" WIRE_DIR=~/.var/opt/wire sh -c ' - umount "${WIRE_DIR}/WireCrypt.d" - cryptsetup close WireCrypt - losetup -d "$(cat -- "${XDG_RUNTIME_DIR}/WireCrypt")" - rm -f -- "${XDG_RUNTIME_DIR}/WireCrypt" + asroot env \ + WIRE_DIR=~/.var/opt/wire \ + WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/wire/WireCrypt.img)"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${WIRE_DIR}/WireCrypt.d"; then + umount -- "${WIRE_DIR}/WireCrypt.d" + fi + if test -e /dev/mapper/WireCrypt; then + cryptsetup close WireCrypt + fi + if test -n "${WIRE_DEV}"; then + losetup -d "${WIRE_DEV}" + fi ' } diff --git a/x11-xserver-utils/Makefile b/x11-xserver-utils/Makefile new file mode 100644 index 0000000..1cfaa36 --- /dev/null +++ b/x11-xserver-utils/Makefile @@ -0,0 +1,13 @@ +.POSIX: + +install uninstall: + +if test -d ../xorg-xset; then cd ../xorg-xset && $(MAKE) "$@"; fi + +if test -d ../xorg-xrandr; then cd ../xorg-xrandr && $(MAKE) "$@"; fi + +if test -d ../xorg-xrdb; then cd ../xorg-xrdb && $(MAKE) "$@"; fi + +if test -d ../xorg-xsetroot; then cd ../xorg-xsetroot && $(MAKE) "$@"; fi + +.DEFAULT: + +if test -d ../xorg-xset; then cd ../xorg-xset && $(MAKE) "$@"; fi + +if test -d ../xorg-xrandr; then cd ../xorg-xrandr && $(MAKE) "$@"; fi + +if test -d ../xorg-xrdb; then cd ../xorg-xrdb && $(MAKE) "$@"; fi + +if test -d ../xorg-xsetroot; then cd ../xorg-xsetroot && $(MAKE) "$@"; fi diff --git a/xinit b/xinit new file mode 120000 index 0000000..a3919d4 --- /dev/null +++ b/xinit @@ -0,0 +1 @@ +xorg-xinit \ No newline at end of file diff --git a/xmonad/Makefile b/xmonad/Makefile index 2265823..527b602 100644 --- a/xmonad/Makefile +++ b/xmonad/Makefile @@ -1,25 +1,31 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 80 +CC = gcc + install: xmonad-autofocus-output - $(CHECK_INSTALLED) xwallpaper - $(CHECK_INSTALLED) xcman - $(CHECK_INSTALLED) pdeath - $(CHECK_INSTALLED) mate-panel - -$(CHECK_INSTALLED) mate-settings-daemon + ../check-in-path xwallpaper + ../check-in-path xcman + ../check-in-path pdeath + ../check-in-path mate-panel + -../check-installed mate-settings-daemon mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad ln -sf -- ~/.dotfiles/xmonad/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad - $(CHECK_INSTALLED) general-preprocessor - $(CHECK_INSTALLED) xpybar + ../check-installed general-preprocessor + ../check-in-path xpybar mkdir -p -- ~/.xmonad - test ! -d ~/.xmonad/xmonad.hs + test ! -e ~/.xmonad/xmonad.hs || test -L ~/.xmonad/xmonad.hs ln -sf -- ~/.dotfiles/xmonad/xmonad.hs ~/.xmonad/xmonad.hs - make xmonad.hs + $(MAKE) xmonad.hs mkdir -p ~/.local/bin - ln -sf -- ~/.dotfiles/xmonad/xmonad-autofocus-output ~/.local/bin + test ! -e ~/.local/bin/xmonad-autofocus-output || \ + test -L ~/.local/bin/xmonad-autofocus-output + ln -sf -- ~/.dotfiles/xmonad/xmonad-autofocus-output ~/.local/bin/xmonad-autofocus-output + test ! -e ~/.xmonad/xmonad-session-rc || test -L ~/.xmonad/xmonad-session-rc + ln -sf -- ~/.dotfiles/xmonad/xmonad-session-rc ~/.xmonad/xmonad-session-rc xmonad-autofocus-output: xmonad-autofocus-output.c $(CC) -o $@ $@.c -Wall -s -lX11 -lXtst @@ -27,14 +33,13 @@ xmonad-autofocus-output: xmonad-autofocus-output.c include xmonad.mk uninstall: + +! ../check-installed xmonad -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 -rm -rf -- ~/.xmonad - -make clean + -+$(MAKE) clean clean: -rm -f xmonad.hs xmonad-autofocus-output - -.PHONY: install uninstall clean diff --git a/xmonad/xinit b/xmonad/xinit index bbb15f1..008f3f2 100644 --- a/xmonad/xinit +++ b/xmonad/xinit @@ -6,13 +6,27 @@ if test "${SESSION}" = xmonad; then # Tell Java if we are using a non-reparenting window manager export _JAVA_AWT_WM_NONREPARENTING=1 + # Use GTK2 theming in Qt applications + export QT_QPA_PLATFORMTHEME=gtk2 + # Start GTK2 settings daemon - if test ! "${NO_MATE}" = y && test -x /usr/lib/mate-settings-daemon/mate-settings-daemon; then - /usr/lib/mate-settings-daemon/mate-settings-daemon & - sleep 0.5 + if test ! "${NO_MATE}" = y; then + if test -x /usr/lib/mate-settings-daemon/mate-settings-daemon; then + /usr/lib/mate-settings-daemon/mate-settings-daemon & + sleep 0.5 + elif test -x /usr/bin/mate-settings-daemon; then + /usr/bin/mate-settings-daemon & + sleep 0.5 + elif test -x /usr/libexec/mate-settings-daemon; then + /usr/libexec/mate-settings-daemon & + sleep 0.5 + elif test -x /usr/libexec/mate-settings-daemon/mate-settings-daemon; then + /usr/libexec/mate-settings-daemon/mate-settings-daemon & + sleep 0.5 + fi fi - # Automatically focus output when mouse is moving in root window + # Automatically focus output when mouse is moving in root window pdeath HUP xmonad-autofocus-output & # Start composition manager @@ -21,6 +35,16 @@ if test "${SESSION}" = xmonad; then # Start application panel mate-panel & + # Start screensaver daemon work computers ## TODO not if in virtual machine or at home + if iswork; then + mate-screensaver & + fi + + # Start network manager applet if computer has WiFi + if test ! $(ifconfig | grep '^w' | wc -l) = 0; then + nm-applet & + fi + # Remove old session if test -f ~/.xmonad/xmonad.state; then rm -f -- ~/.xmonad/xmonad.state diff --git a/xorg-server/Makefile b/xorg-server/Makefile index 72de69f..a4b433b 100644 --- a/xorg-server/Makefile +++ b/xorg-server/Makefile @@ -1,5 +1,6 @@ .POSIX: -include ../common.mk + +XKBDBIND_GIT_HASH = 2ab5473fc48d91ecce1f11c49e5decdcf821e3d4 install: if test -L ~/.config/backgrounds; then \ @@ -12,21 +13,36 @@ install: if test ! -L ~/.config/background && test ! -e ~/.config/background; then \ ln -s backgrounds/default ~/.config/background; \ fi - $(CHECK_INSTALLED) asroot - $(CHECK_INSTALLED) xorg-setxkbmap - $(CHECK_INSTALLED) xorg-xmodmap + ../check-installed-shebang setkeys + ../check-in-path sponge + ../check-any-installed asroot asroot-libpassphrase + ../check-any-installed xorg-setxkbmap x11-xkb-utils + ../check-any-installed xorg-xmodmap x11-xserver-utils mkdir -p -- ~/.local/bin - ln -sf -- ~/.dotfiles/xorg-server/setkeys ~/.local/bin/ - test -d xkbdbind || git clone 'git://git.maandree.se/xkbdbind' + test ! -e ~/.local/bin/setkeys || test -L ~/.local/bin/setkeys + ln -sf -- ~/.dotfiles/xorg-server/setkeys ~/.local/bin/setkeys + if test -d xkbdbind; then \ + if test -d xkbdbind/.git; then \ + if ! git log '--format=format:%H' | grep '^$(XKBDBIND_GIT_HASH)$$' >/dev/null; then \ + (cd -- xkbdbind && git pull) || :; \ + fi; \ + fi; \ + else \ + git clone 'git://git.maandree.se/xkbdbind' || cp -r /usr/src/xkbdbind/ .; \ + fi gpp -s '%%' < xkbdbind.config.h.gpp > xkbdbind/config.h - make -C xkbdbind - ln -sf -- ~/.dotfiles/xorg-server/xkbdbind/xkbdbind ~/.local/bin/ + cd xkbdbind && $(MAKE) + test ! -e ~/.local/bin/xkbdbind || test -L ~/.local/bin/xkbdbind + ln -sf -- ~/.dotfiles/xorg-server/xkbdbind/xkbdbind ~/.local/bin/xkbdbind uninstall: + +! ../check-installed xorg-server + +! ../check-installed xserver-xorg-core -unlink -- ~/.config/backgrounds -unlink -- ~/.config/background -unlink -- ~/.local/bin/setkeys -unlink -- ~/.local/bin/xkdbind -rm -rf -- xkbdbind -.PHONY: install uninstall +clean: + -rm -rf -- xkbdbind diff --git a/xorg-server/xkbdbind.config.h.gpp b/xorg-server/xkbdbind.config.h.gpp index 5e1d71c..4162b43 100644 --- a/xorg-server/xkbdbind.config.h.gpp +++ b/xorg-server/xkbdbind.config.h.gpp @@ -14,15 +14,13 @@ static struct hotkey hotkeys[] = { {XK_F10, MOD | S, 1, CMD("sh", "-c", "amixer -c \"${MAIN_ALSA_CARD}\" -- set \"${MAIN_ALSA_MIXER}\" 5%-")}, {XK_F11, MOD | S, 1, CMD("sh", "-c", "amixer -c \"${MAIN_ALSA_CARD}\" -- set \"${MAIN_ALSA_MIXER}\" 5%+")}, {XK_F12, MOD | S, 0, CMD("sh", "-c", "amixer -c \"${MAIN_ALSA_CARD}\" -- set \"${MAIN_ALSA_MIXER}\" 100%")}, -%%>if test -x /usr/bin/dmenu; then {XK_u, MOD, 0, CMD("unicode")}, {XK_i, MOD, 0, CMD("ipa")}, {XK_p, MOD, 0, CMD("dmenu_run")}, {XK_p, MOD | C, 0, CMD("plumb")}, -%%>fi -%%>if test -x /usr/bin/terminator; then +%%>if ../check-in-path terminator; then {XK_Return, MOD | S, 0, CMD("terminator")}, -%%>elif test -x /usr/bin/st; then +%%>elif ../check-in-path st; then {XK_Return, MOD | S, 0, CMD("st")}, %%>else {XK_Return, MOD | S, 0, CMD("xterm")}, @@ -31,11 +29,10 @@ static struct hotkey hotkeys[] = { {XK_g, H, 0, CMD("setkeys", "greek")}, {XK_s, H, 0, CMD("setkeys", "swedish")}, {XK_t, H, 0, CMD("setkeys", "toggle")}, -%%>if test -x /usr/bin/mocp; then {XK_b, MOD, 0, CMD("mocp", "--next")}, {XK_b, MOD | S, 0, CMD("mocp", "--previous")}, {XK_o, MOD | S, 0, CMD("mocp", "--toggle-pause")}, -%%>fi + {XK_Escape, MOD, 0, CMD("mate-screensaver-command", "-l")}, }; #undef MOD diff --git a/xorg-twm/Makefile b/xorg-twm/Makefile index 77baed4..1e9af59 100644 --- a/xorg-twm/Makefile +++ b/xorg-twm/Makefile @@ -1,12 +1,11 @@ .POSIX: -include ../common.mk install: mkdir -p -- ~/.config - test ! -d ~/.config/twmrc + test ! -e ~/.config/twmrc || test -L ~/.config/twmrc ln -sf -- ~/.dotfiles/xorg-twm/twmrc ~/.config/twmrc uninstall: + +! ../check-installed xorg-twm + +! ../check-installed twm -unlink -- ~/.config/twmrc - -.PHONY: install uninstall diff --git a/xorg-twm/twmrc b/xorg-twm/twmrc index 91869e1..b362651 100644 --- a/xorg-twm/twmrc +++ b/xorg-twm/twmrc @@ -82,7 +82,7 @@ menu "defops" "" f.nop "Terminator" f.exec "exec terminator &" "Xterm" f.exec "exec xterm &" -"Firefox" f.exec "exec firefox &" +"Brave" f.exec "exec brave &" "Caja" f.exec "exec c &" "" f.nop "Kill" f.destroy diff --git a/xorg-xinit/Makefile b/xorg-xinit/Makefile index 6c314bd..0183895 100644 --- a/xorg-xinit/Makefile +++ b/xorg-xinit/Makefile @@ -1,28 +1,28 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 50 # Testing that xmonad is installed because it is the default sessions # Testing that asroot, xorg-setxkbmap, and xorg-xmodmap are installed because setkeys uses them install: - $(CHECK_INSTALLED) asroot - $(CHECK_INSTALLED) dconf - $(CHECK_INSTALLED) xmonad - $(CHECK_INSTALLED) xorg-setxkbmap - $(CHECK_INSTALLED) xorg-xmodmap - $(CHECK_INSTALLED) xorg-xrandr - $(CHECK_INSTALLED) xorg-xrdb - $(CHECK_INSTALLED) xorg-xset - $(CHECK_INSTALLED) xorg-xsetroot + ../check-any-installed asroot asroot-libpassphrase + ../check-any-installed dconf dconf-cli + ../check-installed xmonad + ../check-any-installed xorg-setxkbmap x11-xkb-utils + ../check-any-installed xorg-xmodmap x11-xserver-utils + ../check-any-installed xorg-xrandr x11-xserver-utils + ../check-any-installed xorg-xrdb x11-xserver-utils + ../check-any-installed xorg-xset x11-xserver-utils + ../check-any-installed xorg-xsetroot x11-xserver-utils mkdir -p -- ~/.config/bash/aliases.d - test ! -d ~/.config/bash/aliases.d/xorg-xinit + test ! -e ~/.config/bash/aliases.d/xorg-xinit || test -L ~/.config/bash/aliases.d/xorg-xinit ln -sf -- ~/.dotfiles/xorg-xinit/bash-aliases ~/.config/bash/aliases.d/xorg-xinit mkdir -p -- ~/.config/X11/xinit - test ! -d ~/.config/X11/xinit/xinitrc + test ! -e ~/.config/X11/xinit/xinitrc || test -L ~/.config/X11/xinit/xinitrc ln -sf -- ~/.dotfiles/xorg-xinit/xinitrc ~/.config/X11/xinit/xinitrc mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xinit + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xinit || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xinit ln -sf -- ~/.dotfiles/xorg-xinit/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xinit if test -x /usr/bin/orphan-reaper; then \ mkdir -p -- ~/.local/bin && \ @@ -30,6 +30,8 @@ install: fi uninstall: + +! ../check-installed xorg-xinit + +! ../check-installed xinit -unlink -- ~/.config/bash/aliases.d/xorg-xinit -rmdir -- ~/.config/bash/aliases.d -unlink -- ~/.config/X11/xinit/xinitrc @@ -38,5 +40,3 @@ uninstall: -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 -unlink -- ~/.local/bin/startx - -.PHONY: install uninstall diff --git a/xorg-xinit/xinitrc b/xorg-xinit/xinitrc index 23aa433..b781186 100644 --- a/xorg-xinit/xinitrc +++ b/xorg-xinit/xinitrc @@ -21,11 +21,5 @@ for f in ~/.config/X11/xinit/xinitrc.d/*; do fi done -# Set keyboard settings -setkeys - -# Start hotkey daemon -xkbdbind & - # Start session exec ${SESSION_WRAPPER} "$SESSION" diff --git a/xorg-xrandr/Makefile b/xorg-xrandr/Makefile index d135e27..0968b2a 100644 --- a/xorg-xrandr/Makefile +++ b/xorg-xrandr/Makefile @@ -1,26 +1,32 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 15 # Testing that xwallpaper is installed because setres calls it # Testing that python3 is installed because setres is written in it install: - $(CHECK_INSTALLED) xwallpaper - $(CHECK_INSTALLED) python3 + ../check-in-path xwallpaper + ../check-in-path python3 + ../check-installed-shebang resolution-changed mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr ln -sf -- ~/.dotfiles/xorg-xrandr/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr mkdir -p -- ~/.local/bin - make -C setres - ln -sf -- ~/.dotfiles/xorg-xrandr/setres/setres ~/.local/bin + cd setres && $(MAKE) + test ! -e ~/.local/bin/setres || test -L ~/.local/bin/setres + ln -sf -- ~/.dotfiles/xorg-xrandr/setres/setres ~/.local/bin/setres + test ! -e ~/.config/resolution-changed || test -L ~/.config/resolution-changed + ln -sf -- ~/.dotfiles/xorg-xrandr/resolution-changed ~/.config/resolution-changed uninstall: + +! ../check-installed xorg-xrandr + +! ../check-installed xrandr + +! ../check-installed x11-xserver-utils -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 + -unlink -- ~/.config/resolution-changed -rmdir -- ~/.local/bin/setres - -make -C setres reallyclean - -.PHONY: install uninstall + +cd setres && $(MAKE) reallyclean diff --git a/xorg-xrandr/resolution-changed b/xorg-xrandr/resolution-changed new file mode 100755 index 0000000..a53c7b6 --- /dev/null +++ b/xorg-xrandr/resolution-changed @@ -0,0 +1,20 @@ +#!/bin/dash + +# Reset rat size in case DPI change modified scaling +xsetroot -cursor_name left_ptr || : + +# Reset rat speed in case DPI changed +if test "${DESKTOP_SESSION}" = xmonad && test ! "${NO_MATE}" = y; then + (exec mate-settings-daemon --replace &) || : +fi + +# Reset background in case resolution change damaged it +for file in ~/.config/background.${SESSION_} \ + ~/.config/background.${SESSION} \ + ~/.config/background.${DESKTOP_SESSION} \ + ~/.config/background; do + if test -r "$file"; then + xwallpaper --zoom "$file" + (sleep 2 ; xwallpaper --zoom "$file") & # Again, with delay, in case mate-settings-daemon changes it + fi +done diff --git a/xorg-xrandr/xinit b/xorg-xrandr/xinit index 1185a86..2f6e033 100644 --- a/xorg-xrandr/xinit +++ b/xorg-xrandr/xinit @@ -1,4 +1,4 @@ # -*- shell-script -*- # Set screen layout, resolution and calibration -setres || true +setres || : diff --git a/xorg-xrdb/Makefile b/xorg-xrdb/Makefile index baae09f..5e15bee 100644 --- a/xorg-xrdb/Makefile +++ b/xorg-xrdb/Makefile @@ -1,17 +1,18 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 20 install: mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrdb + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrdb || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrdb ln -sf -- ~/.dotfiles/xorg-xrdb/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrdb uninstall: + +! ../check-installed xorg-xrdb + +! ../check-installed xrdb + +! ../check-installed x11-xserver-utils -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrdb -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/xorg-xset/Makefile b/xorg-xset/Makefile index 4d38941..a029f8d 100644 --- a/xorg-xset/Makefile +++ b/xorg-xset/Makefile @@ -1,17 +1,18 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 20 install: mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xset + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xset || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xset ln -sf -- ~/.dotfiles/xorg-xset/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xset uninstall: + +! ../check-installed xorg-xset + +! ../check-installed xset + +! ../check-installed x11-xserver-utils -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xset -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/xorg-xsetroot/Makefile b/xorg-xsetroot/Makefile index d58490d..a3b57d9 100644 --- a/xorg-xsetroot/Makefile +++ b/xorg-xsetroot/Makefile @@ -1,17 +1,18 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 85 install: mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xsetroot + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xsetroot || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xsetroot ln -sf -- ~/.dotfiles/xorg-xsetroot/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xsetroot uninstall: + +! ../check-installed xorg-xsetroot + +! ../check-installed xsetroot + +! ../check-installed x11-xserver-utils -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xsetroot -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/xpybar/Makefile b/xpybar/Makefile index 6d0d753..da65a68 100644 --- a/xpybar/Makefile +++ b/xpybar/Makefile @@ -1,9 +1,8 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) general-preprocessor - make -C config + ../check-installed general-preprocessor + cd config && $(MAKE) mkdir -p -- ~/.config if test -L ~/.config/xpybar; then \ test "$$(readlink -- ~/.config/xpybar)" = ~/.dotfiles/xpybar/config; \ @@ -13,6 +12,5 @@ install: fi uninstall: + +! ../check-installed xpybar -unlink -- ~/.config/xpybar - -.PHONY: install uninstall diff --git a/xrandr b/xrandr new file mode 120000 index 0000000..bd6e70d --- /dev/null +++ b/xrandr @@ -0,0 +1 @@ +xorg-xrandr \ No newline at end of file diff --git a/xrdb b/xrdb new file mode 120000 index 0000000..576803b --- /dev/null +++ b/xrdb @@ -0,0 +1 @@ +xorg-xrdb \ No newline at end of file diff --git a/xserver-xorg-core b/xserver-xorg-core new file mode 120000 index 0000000..0e680f2 --- /dev/null +++ b/xserver-xorg-core @@ -0,0 +1 @@ +xorg-server \ No newline at end of file diff --git a/xset b/xset new file mode 120000 index 0000000..79e0d23 --- /dev/null +++ b/xset @@ -0,0 +1 @@ +xorg-xset \ No newline at end of file diff --git a/xsetroot b/xsetroot new file mode 120000 index 0000000..1bdacba --- /dev/null +++ b/xsetroot @@ -0,0 +1 @@ +xorg-xsetroot \ No newline at end of file diff --git a/xwallpaper/Makefile b/xwallpaper/Makefile index 739ab7c..fe200a8 100644 --- a/xwallpaper/Makefile +++ b/xwallpaper/Makefile @@ -1,21 +1,16 @@ .POSIX: -include ../common.mk XINITRC_ORDER = 20 install: - $(CHECK_INSTALLED) xcman - $(CHECK_INSTALLED) pdeath - $(CHECK_INSTALLED) mate-panel - -$(CHECK_INSTALLED) mate-settings-daemon mkdir -p -- ~/.config/X11/xinit/xinitrc.d - test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xwallpaper + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xwallpaper || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xwallpaper ln -sf -- ~/.dotfiles/xwallpaper/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xwallpaper uninstall: + +! ../check-installed xwallpaper -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xwallpaper -rmdir -- ~/.config/X11/xinit/xinitrc.d -rmdir -- ~/.config/X11/xinit -rmdir -- ~/.config/X11 - -.PHONY: install uninstall diff --git a/yaourt/Makefile b/yaourt/Makefile index 4042cb4..44f6496 100644 --- a/yaourt/Makefile +++ b/yaourt/Makefile @@ -1,12 +1,10 @@ .POSIX: -include ../common.mk install: - $(CHECK_INSTALLED) dash + ../check-installed-shebang aur mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/yaourt/aur ~/.local/bin/ uninstall: + +! ../check-installed yaourt -unlink -- ~/.local/bin/aur - -.PHONY: install uninstall diff --git a/yt-dlp/Makefile b/yt-dlp/Makefile new file mode 100644 index 0000000..4ba60ab --- /dev/null +++ b/yt-dlp/Makefile @@ -0,0 +1,11 @@ +.POSIX: + +install: + mkdir -p -- ~/.config/bash/aliases.d/ + test ! -e ~/.config/bash/aliases.d/yt-dlp || test -L ~/.config/bash/aliases.d/yt-dlp + ln -sf -- ~/.dotfiles/yt-dlp/bash-aliases ~/.config/bash/aliases.d/yt-dlp + +uninstall: + +! ../check-installed yt-dlp + -unlink -- ~/.config/bash/aliases.d/yt-dlp + -rmdir -- ~/.config/bash/aliases.d/ diff --git a/yt-dlp/bash-aliases b/yt-dlp/bash-aliases new file mode 100644 index 0000000..a4724a4 --- /dev/null +++ b/yt-dlp/bash-aliases @@ -0,0 +1,3 @@ +# -*- shell-script -*- + +alias yt-dlp='yt-dlp --compat-options filename-sanitization' diff --git a/zathura/Makefile b/zathura/Makefile index 761bb6b..86fa7ff 100644 --- a/zathura/Makefile +++ b/zathura/Makefile @@ -1,10 +1,8 @@ .POSIX: -include ../common.mk install: -rmdir -- ~/.config/zathura uninstall: + +! ../check-installed zathura -rm -rf -- ~/.config/zathura - -.PHONY: install uninstall -- cgit v1.2.3-70-g09d2