diff options
Diffstat (limited to '')
-rw-r--r-- | brave/Makefile | 2 | ||||
-rw-r--r-- | cryptsetup/Makefile | 15 | ||||
-rwxr-xr-x | cryptsetup/mount-devices | 35 | ||||
-rw-r--r-- | emacs-go-mode/Makefile | 11 | ||||
-rw-r--r-- | emacs-go-mode/init-go-mode.el (renamed from emacs/init-go-mode.el) | 0 | ||||
-rw-r--r-- | emacs-haskell-mode/Makefile | 11 | ||||
-rw-r--r-- | emacs-haskell-mode/init-haskell-mode.el (renamed from emacs/init-haskell-mode.el) | 0 | ||||
-rw-r--r-- | emacs/Makefile | 19 | ||||
-rw-r--r-- | emacs/init.el | 52 | ||||
-rw-r--r-- | ffmpeg/Makefile | 5 | ||||
-rw-r--r-- | ffmpeg/bash-aliases | 25 | ||||
-rwxr-xr-x | ffmpeg/resize-and-transcode | 2 | ||||
-rw-r--r-- | gdb/Makefile | 11 | ||||
-rw-r--r-- | gdb/init-gdb.el (renamed from emacs/init-gdb.el) | 0 | ||||
-rwxr-xr-x | git/new-c-proj | 4 | ||||
-rw-r--r-- | java-runtime/user-profile | 2 | ||||
-rw-r--r-- | ssh/Makefile | 4 | ||||
-rwxr-xr-x | ssh/ssh-archiso | 5 | ||||
-rw-r--r-- | sshexec/Makefile | 10 | ||||
-rwxr-xr-x | sshexec/sshexec-archiso | 5 | ||||
-rw-r--r-- | xwallpaper/xinit | 14 | ||||
-rw-r--r-- | yt-dlp/bash-aliases | 2 |
22 files changed, 166 insertions, 68 deletions
diff --git a/brave/Makefile b/brave/Makefile index dc5f0c2..b70f3b8 100644 --- a/brave/Makefile +++ b/brave/Makefile @@ -1,7 +1,5 @@ .POSIX: -XINITRC_ORDER = 20 - install: ../check-installed-shebang brave mkdir -p -- ~/.local/bin diff --git a/cryptsetup/Makefile b/cryptsetup/Makefile new file mode 100644 index 0000000..0666bc6 --- /dev/null +++ b/cryptsetup/Makefile @@ -0,0 +1,15 @@ +.POSIX: + +install: + ../check-installed-shebang mount-devices + ../check-in-path test + ../check-in-path mountpoint + ../check-in-path cryptsetup + ../check-in-path mount + mkdir -p -- ~/.local/bin + test ! -e ~/.local/bin/mount-devices || test -L ~/.local/bin/mount-devices + ln -sf -- ~/.dotfiles/cryptsetup/mount-devices ~/.local/bin/mount-devices + +uninstall: + +! ../check-installed cryptsetup + -unlink -- ~/.local/bin/mount-devices diff --git a/cryptsetup/mount-devices b/cryptsetup/mount-devices new file mode 100755 index 0000000..a26fd1c --- /dev/null +++ b/cryptsetup/mount-devices @@ -0,0 +1,35 @@ +#!/bin/sh + +# Although the name doesn't indicate it, this is only for encrypted +# partitions, and it exists only because systemd is absolutely +# terrible at mounting encrypted filesystems. Thanks you, Lennart +# and all the idiots that thought your craps smelled good. + +cd /devices + +for f in *; do + # Make sure the symlink points to an available device + if ! test -e "$f"; then + continue + fi + + # Make sure that the device should be mounted in /media/ + if ! test -d "/media/$f"; then + continue; + fi + + # Make sure the device is not already mounted + if mountpoint -q "/media/$f"; then + continue; + fi + + # If the device has not been decrypted already, attempt to decrypt it + if ! test -e "/dev/mapper/$f"; then + if ! cryptsetup open "/devices/$f" "$f"; then + continue + fi + fi + + # And of course, mount the decrypted device + mount "/dev/mapper/$f" "/media/$f" +done diff --git a/emacs-go-mode/Makefile b/emacs-go-mode/Makefile new file mode 100644 index 0000000..ea3f8be --- /dev/null +++ b/emacs-go-mode/Makefile @@ -0,0 +1,11 @@ +.POSIX: + +install: + mkdir -p -- ~/.config/emacs + test -L ~/.config/emacs/init-go-mode.el || test ! -e ~/.config/emacs/init-go-mode.el + ln -sf -- ~/.dotfiles/emacs-go-mode/init-go-mode.el ~/.config/emacs/ + +uninstall: + +! ../check-installed emacs-go-mode + -unlink -- ~/.config/emacs/init-go-mode.el + -rmdir -- ~/.config/emacs diff --git a/emacs/init-go-mode.el b/emacs-go-mode/init-go-mode.el index 56e3c16..56e3c16 100644 --- a/emacs/init-go-mode.el +++ b/emacs-go-mode/init-go-mode.el diff --git a/emacs-haskell-mode/Makefile b/emacs-haskell-mode/Makefile new file mode 100644 index 0000000..3605590 --- /dev/null +++ b/emacs-haskell-mode/Makefile @@ -0,0 +1,11 @@ +.POSIX: + +install: + mkdir -p -- ~/.config/emacs + test -L ~/.config/emacs/init-haskell-mode.el || test ! -e ~/.config/emacs/init-haskell-mode.el + ln -sf -- ~/.dotfiles/emacs-haskell-mode/init-haskell-mode.el ~/.config/emacs/ + +uninstall: + +! ../check-installed emacs-haskell-mode + -unlink -- ~/.config/emacs/init-haskell-mode.el + -rmdir -- ~/.config/emacs diff --git a/emacs/init-haskell-mode.el b/emacs-haskell-mode/init-haskell-mode.el index 6fe75c2..6fe75c2 100644 --- a/emacs/init-haskell-mode.el +++ b/emacs-haskell-mode/init-haskell-mode.el diff --git a/emacs/Makefile b/emacs/Makefile index 9fa5799..665bde5 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -14,22 +14,8 @@ install: fi; \ ln -sf -- .config/emacs ~/.emacs.d; \ fi - 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 \ - printf '\n' >> ~/.config/emacs/init.el && \ - cat -- init-go-mode.el >> ~/.config/emacs/init.el; \ - fi - 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 + test -L ~/.config/emacs/init.el || test ! -e ~/.config/emacs/init.el + ln -sf -- ~/.dotfiles/emacs/init.el ~/.config/emacs/init.el if grep Ubuntu < /etc/lsb-release >/dev/null 2>/dev/null; then \ mkdir -p -- ~/.config/profile.d && \ (test ! -e ~/.config/profile.d/emacs || \ @@ -52,3 +38,4 @@ uninstall: -unlink -- ~/.emacs.d -rmdir -- ~/.config/emacs -unlink -- ~/.local/bin/e + test ! -d ../.work/emacs || (cd ../.work/emacs && $(MAKE) uninstall) diff --git a/emacs/init.el b/emacs/init.el index a807fa7..432b772 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -4,21 +4,25 @@ ;; You may delete these explanatory comments. (package-initialize) + +;; Enable the upcase-region function which is disabled by default (put 'upcase-region 'disabled nil) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(inhibit-startup-screen t)) -(setq display-time-string-forms - '((propertize (concat " " 24-hours ":" minutes " ") - ))) +;; Never show the startup screen (go to scratch if there is no file specified) +(custom-set-variables '(inhibit-startup-screen t)) + + +;; Display column number after line number (column-number-mode) + + +;; Configure and display clock +(setq display-time-string-forms + '((propertize (concat " " 24-hours ":" minutes " ") ))) (display-time-mode) + ; (set-default-font "-misc-fixed-medium-r-normal--13-*-75-75-c-70-iso8859-1") ;; TODO set-default-font stopped working @@ -34,16 +38,34 @@ (set-face-foreground 'font-lock-comment-face "red") + +;; Fix up C mode +;;;; disable electric mode (add-hook 'after-change-major-mode-hook (lambda() (electric-indent-mode -1))) (add-hook 'c-mode-hook (lambda () (electric-indent-local-mode))) - +;;;; use tab as indentation (defvaralias 'c-basic-offset 'tab-width) +;; TODO trailing whitespaces are removed even where I want them + + +;; TODO I can probably remove these, do not remember why they were added (global-set-key (kbd "DEL") 'backward-delete-char) (setq c-backspace-function 'backward-delete-char) -(setq vc-follow-symlinks nil) -(setq vc-handled-backends nil) -(add-to-list 'auto-mode-alist '("/PKGBUILD$" . shell-script-mode)) -(add-to-list 'auto-mode-alist '("/APKBUILD$" . shell-script-mode)) -(setq auto-mode-alist (cons '("\.cl$" . c-mode) auto-mode-alist)) +;; Version control configurations +(setq vc-follow-symlinks nil) ; Do not follow symlinks in version control +(setq vc-handled-backends nil) ; Do not use version control features + + +;; Addition rules for major mode selection +(add-to-list 'auto-mode-alist '("/PKGBUILD$" . shell-script-mode)) ; arch linux build scripts +(add-to-list 'auto-mode-alist '("/APKBUILD$" . shell-script-mode)) ; alpine linux build scripts +(setq auto-mode-alist (cons '("\.cl$" . c-mode) auto-mode-alist)) ; OpenCL source files + + + +;; Load configurations from installed for other packages +((lambda () + (dolist (file (directory-files (expand-file-name "~/.config/emacs/") t "^init-.*\\.el$")) + (load-file file)))) diff --git a/ffmpeg/Makefile b/ffmpeg/Makefile index 2c472b0..c9f54c0 100644 --- a/ffmpeg/Makefile +++ b/ffmpeg/Makefile @@ -8,13 +8,8 @@ install: mkdir -p -- ~/.local/bin ln -sf -- ~/.dotfiles/ffmpeg/resize-and-transcode ~/.local/bin/ ln -sf -- ~/.dotfiles/ffmpeg/resize-and-transcode-recursively ~/.local/bin/ - mkdir -p -- ~/.config/bash/aliases.d - 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 -unlink -- ~/.local/bin/resize-and-transcode -unlink -- ~/.local/bin/resize-and-transcode-recursively diff --git a/ffmpeg/bash-aliases b/ffmpeg/bash-aliases deleted file mode 100644 index 41846c8..0000000 --- a/ffmpeg/bash-aliases +++ /dev/null @@ -1,25 +0,0 @@ -# -*- shell-script -*- - -remove-video-on-all () ( - for ext in opus aac mp3 m4a; do - for f in *.{mkv,mp4,webm}; do - if ffmpeg -i "$f" -map 0:a -codec copy -y -- "$f.$ext"; then - rm -- "$f" - else - rm -- "$f.$ext" - fi - done - done -) - -remove-video-on-all-1 () ( - for ext in opus aac mp3 m4a; do - for f in *."$1"; do - if ffmpeg -i "$f" -map 0:a -codec copy -y -- "$f.$ext"; then - rm -- "$f" - else - rm -- "$f.$ext" - fi - done - done -) diff --git a/ffmpeg/resize-and-transcode b/ffmpeg/resize-and-transcode index cecad85..c247b3e 100755 --- a/ffmpeg/resize-and-transcode +++ b/ffmpeg/resize-and-transcode @@ -100,7 +100,7 @@ if test -z "$scale" && test "$codec" = '-c:v copy'; then fi ttysetting="$(stty -g)" -ffmpeg -i "$input" $scale $codec -c:a copy -- "$output" +ffmpeg -i file:"$input" $scale $codec -c:a copy -- file:"$output" ret=$? stty "$ttysetting" diff --git a/gdb/Makefile b/gdb/Makefile new file mode 100644 index 0000000..874d896 --- /dev/null +++ b/gdb/Makefile @@ -0,0 +1,11 @@ +.POSIX: + +install: + mkdir -p -- ~/.config/emacs + test -L ~/.config/emacs/init-gdb.el || test ! -e ~/.config/emacs/init-gdb.el + ln -sf -- ~/.dotfiles/gdb/init-gdb.el ~/.config/emacs/ + +uninstall: + +! ../check-installed gdb + -unlink -- ~/.config/emacs/init-gdb.el + -rmdir -- ~/.config/emacs diff --git a/emacs/init-gdb.el b/gdb/init-gdb.el index 51b1a35..51b1a35 100644 --- a/emacs/init-gdb.el +++ b/gdb/init-gdb.el diff --git a/git/new-c-proj b/git/new-c-proj index 7676e9f..dfd00f9 100755 --- a/git/new-c-proj +++ b/git/new-c-proj @@ -19,7 +19,7 @@ git init . cat > LICENSE <<EOF ISC License -© $(date +%Y) Mattias Andrée <maandree@kth.se> +© $(date +%Y) Mattias Andrée <m@maandree.se> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -52,7 +52,7 @@ cat > .gitignore <<EOF EOF mkdir -p -- .git/info -printf '%s\n' '_*' '.hidden' '.makeenv' >> .git/info/exclude +printf '%s\n' '_*' '._*' '.hidden' '.makeenv' >> .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_]')" diff --git a/java-runtime/user-profile b/java-runtime/user-profile index 9b60457..f20b9a4 100644 --- a/java-runtime/user-profile +++ b/java-runtime/user-profile @@ -1,3 +1,3 @@ # -*- shell-script -*- -export _JAVA_OPTIONS='-Djdk.gtk.version=2.2' +export _JAVA_OPTIONS='-Djdk.gtk.version=2.2 -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' diff --git a/ssh/Makefile b/ssh/Makefile index be4b0d5..4a3dba4 100644 --- a/ssh/Makefile +++ b/ssh/Makefile @@ -55,6 +55,9 @@ install: 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 + mkdir -p -- ~/.local/bin + test ! -e ~/.local/bin/ssh-archiso || test -L ~/.local/bin/ssh-archiso + ln -sf -- ~/.dotfiles/openssh/ssh-archiso ~/.local/bin/ssh-archiso uninstall: +! ../check-installed ssh @@ -70,3 +73,4 @@ uninstall: -rm -f -- .ssh-config -unlink -- ~/.config/bash/aliases.d/openssh -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.local/bin/ssh-archiso diff --git a/ssh/ssh-archiso b/ssh/ssh-archiso new file mode 100755 index 0000000..f3b7fc7 --- /dev/null +++ b/ssh/ssh-archiso @@ -0,0 +1,5 @@ +#!/bin/sh + +printf '\033[1m%s\033[m\n\n' 'The password is simply "arch"' >&2 + +exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@archiso "$@" diff --git a/sshexec/Makefile b/sshexec/Makefile new file mode 100644 index 0000000..c2be226 --- /dev/null +++ b/sshexec/Makefile @@ -0,0 +1,10 @@ +.POSIX: + +install: + mkdir -p -- ~/.local/bin + test ! -e ~/.local/bin/sshexec-archiso || test -L ~/.local/bin/sshexec-archiso + ln -sf -- ~/.dotfiles/sshexec/sshexec-archiso ~/.local/bin/sshexec-archiso + +uninstall: + +! ../check-installed sshexec + -unlink -- ~/.local/bin/sshexec-archiso diff --git a/sshexec/sshexec-archiso b/sshexec/sshexec-archiso new file mode 100755 index 0000000..303726c --- /dev/null +++ b/sshexec/sshexec-archiso @@ -0,0 +1,5 @@ +#!/bin/sh + +printf '\033[1m%s\033[m\n\n' 'The password is simply "arch"' >&2 + +exec sshexec -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@archiso "$@" diff --git a/xwallpaper/xinit b/xwallpaper/xinit index 9080e46..7648dd2 100644 --- a/xwallpaper/xinit +++ b/xwallpaper/xinit @@ -1,5 +1,19 @@ # -*- shell-script -*- +# Set default background +target="$(readlink -- ~/.config/background)" +if test "${target}" = backgrounds/default || test "${target}" = backgrounds/default-travel || test "${target}" = backgrounds/default-nontravel; then + if where="$(where)" 2>/dev/null; then + if test "${where}" = travelling && test -f ~/.config/backgrounds/default-travel; then + ln -sf -- backgrounds/default-travel ~/.config/background + elif test -f ~/.config/backgrounds/default-nontravel; then + ln -sf -- backgrounds/default-nontravel ~/.config/background + else + ln -sf -- backgrounds/default ~/.config/background + fi + fi +fi + # Set background if test -f ~/.config/background."${SESSION_}"; then xwallpaper --zoom ~/.config/background."${SESSION_}" diff --git a/yt-dlp/bash-aliases b/yt-dlp/bash-aliases index a4724a4..2200bea 100644 --- a/yt-dlp/bash-aliases +++ b/yt-dlp/bash-aliases @@ -1,3 +1,3 @@ # -*- shell-script -*- -alias yt-dlp='yt-dlp --compat-options filename-sanitization' +alias yt-dlp='yt-dlp --compat-options filename-sanitization --cookies-from-browser brave' |