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 --- 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 ++ 8 files changed, 140 insertions(+), 334 deletions(-) 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 (limited to 'base') 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 & -- cgit v1.2.3-70-g09d2