diff options
author | Mattias Andrée <maandree@kth.se> | 2021-06-25 14:33:06 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-06-25 14:33:06 +0200 |
commit | 564263512e6425ae68ef431350edcfde8a3f1075 (patch) | |
tree | 2e483266b85a032d7425ec838dd7ac0283dd19c5 | |
parent | First commit (diff) | |
download | dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.gz dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.bz2 dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.xz |
Use asroot instead of sudo and add emacs configs
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | bash/Makefile | 8 | ||||
-rw-r--r-- | bash/aliases-Zenith | 23 | ||||
-rw-r--r-- | emacs/Makefile | 28 | ||||
-rw-r--r-- | emacs/init-go-mode.el | 3 | ||||
-rw-r--r-- | emacs/init-haskell-mode.el | 7 | ||||
-rw-r--r-- | emacs/init.el | 46 | ||||
-rw-r--r-- | signal-desktop/Makefile | 3 | ||||
-rw-r--r-- | signal-desktop/bash-aliases | 19 |
8 files changed, 118 insertions, 19 deletions
diff --git a/bash/Makefile b/bash/Makefile index 7ea782a..e1e62ae 100644 --- a/bash/Makefile +++ b/bash/Makefile @@ -25,7 +25,13 @@ install: ln -sf -- ~/.dotfiles/bash/bashrc_palette ~/.config/bash/bashrc_palette ln -sf -- ~/.dotfiles/bash/bashrc_prompt ~/.config/bash/bashrc_prompt ln -sf -- ~/.dotfiles/bash/aliases ~/.config/bash/aliases - ln -sf -- ~/.dotfiles/bash/aliases-Zenith ~/.config/bash/aliases-Zenith + if test "$$(hostname | tr '[[:upper:]]' '[[:lower:]]')" = zenith; then \ + test "$$(hostname)" = Zenith && \ + pacman -Qq -- asroot </dev/null >/dev/null && \ + pacman -Qq -- gnupg </dev/null >/dev/null && \ + pacman -Qq -- cryptsetup </dev/null >/dev/null && \ + ln -sf -- ~/.dotfiles/bash/aliases-Zenith ~/.config/bash/aliases-Zenith; \ + fi uninstall: -unlink -- ~/.bash_history diff --git a/bash/aliases-Zenith b/bash/aliases-Zenith index ac794c9..419de1d 100644 --- a/bash/aliases-Zenith +++ b/bash/aliases-Zenith @@ -1,17 +1,20 @@ # -*- shell-script -*- mount-crypt () { - sudo printf '' && \ - device="$(sudo losetup --show -f -P /media/Secondary/.crypt/crypt.img)" && \ - printf '%s\n' "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt" && \ - gpg --decrypt /media/Secondary/.crypt/crypt.key | sudo cryptsetup -d - open "${device}" CryptCrypt && \ - mkdir -p ~/Crypt && \ - sudo mount /dev/mapper/CryptCrypt ~/Crypt + 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" + gpg --decrypt /media/Secondary/.crypt/crypt.key | cryptsetup -d - open "${device}" CryptCrypt + mkdir -p "${CRYPT_DIR}" + mount /dev/mapper/CryptCrypt "${CRYPT_DIR}" + ' } umount-crypt () { - sudo umount ~/Crypt - rmdir ~/Crypt - sudo cryptsetup close CryptCrypt - sudo losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")" + 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")" + ' } diff --git a/emacs/Makefile b/emacs/Makefile new file mode 100644 index 0000000..3a5a47d --- /dev/null +++ b/emacs/Makefile @@ -0,0 +1,28 @@ +.POSIX: + +install: + mkdir -p -- ~/.config + if test -d ~/.emacs.d; then \ + test ! -e ~/.config/emacs && \ + mv -- ~/.emacs.d ~/.config/emacs; \ + else \ + mkdir -p -- ~/.config/emacs; \ + fi + ln -sf -- .config/emacs ~/.emacs.d + printf '; %s\n\n' 'This file is generated by ~/.dotfiles/emacs/Makefile' > ~/.config/emacs/init.el + cat -- init.el >> ~/.config/emacs/init.el + if pacman -Qq emacs-go-mode </dev/null >/dev/null 2>/dev/null; then\ + printf '\n' >> ~/.config/emacs/init.el && \ + cat -- init-go-mode.el >> ~/.config/emacs/init.el; \ + fi + if pacman -Qq emacs-haskell-mode </dev/null >/dev/null 2>/dev/null; then\ + printf '\n' >> ~/.config/emacs/init.el && \ + cat -- init-haskell-mode.el >> ~/.config/emacs/init.el; \ + fi + +uninstall: + -unlink -- ~/.config/emacs/init.el + -unlink -- ~/.emacs.d + -rmdir -- ~/.config/emacs + +.PHONY: install uninstall diff --git a/emacs/init-go-mode.el b/emacs/init-go-mode.el new file mode 100644 index 0000000..56e3c16 --- /dev/null +++ b/emacs/init-go-mode.el @@ -0,0 +1,3 @@ +(add-to-list 'load-path "/usr/share/emacs/site-lisp/go-mode/") +(autoload 'go-mode "go-mode" nil t) +(add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode)) diff --git a/emacs/init-haskell-mode.el b/emacs/init-haskell-mode.el new file mode 100644 index 0000000..6fe75c2 --- /dev/null +++ b/emacs/init-haskell-mode.el @@ -0,0 +1,7 @@ +(add-to-list 'load-path "/usr/share/emacs/site-lisp/haskell-mode/") +(require 'haskell-mode-autoloads) +(add-to-list 'Info-default-directory-list "/usr/share/emacs/site-lisp/haskell-mode/") +(add-hook 'haskell-mode-hook + (lambda () + (turn-on-haskell-doc) + (turn-on-haskell-simple-indent))) diff --git a/emacs/init.el b/emacs/init.el new file mode 100644 index 0000000..1a98a14 --- /dev/null +++ b/emacs/init.el @@ -0,0 +1,46 @@ +;; Added by Package.el. This must come before configurations of +;; installed packages. Don't delete this line. If you don't want it, +;; just comment it out by adding a semicolon to the start of the line. +;; You may delete these explanatory comments. +(package-initialize) + +(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 " ") + ))) + +(column-number-mode) +(display-time-mode) + +; (set-default-font "-misc-fixed-medium-r-normal--13-*-75-75-c-70-iso8859-1") +;; TODO set-default-font stopped working + +; (blink-cursor-mode 0) +; (setq visible-bell t) +; (scroll-bar-mode 0) +; (tool-bar-mode 0) +; (menu-bar-mode 0) + +;(custom-set-faces +; '(default ((t (:background "#101064" :foreground "#FFFFFF")))) +; '(fringe ((t (:background "#101064"))))) + +(add-hook 'after-change-major-mode-hook (lambda() (electric-indent-mode -1))) +(add-hook 'c-mode-hook (lambda () (electric-indent-local-mode))) + +(defvaralias 'c-basic-offset 'tab-width) +(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)) diff --git a/signal-desktop/Makefile b/signal-desktop/Makefile index 1d82c40..b3cfa61 100644 --- a/signal-desktop/Makefile +++ b/signal-desktop/Makefile @@ -1,6 +1,9 @@ .POSIX: install: + pacman -Qq -- asroot </dev/null >/dev/null + pacman -Qq -- gnupg </dev/null >/dev/null + pacman -Qq -- cryptsetup </dev/null >/dev/null mkdir -p -- ~/.config/bash/aliases.d test ! -d ~/.config/bash/aliases.d/signal-desktop ln -sf -- ~/.dotfiles/signal-desktop/bash-aliases ~/.config/bash/aliases.d/signal-desktop diff --git a/signal-desktop/bash-aliases b/signal-desktop/bash-aliases index 1e76a52..34a23b9 100644 --- a/signal-desktop/bash-aliases +++ b/signal-desktop/bash-aliases @@ -1,15 +1,18 @@ # -*- shell-script -*- mount-signal () { - sudo printf '' && \ - device="$(sudo losetup --show -f -P ~/.var/signal/SignalCrypt.img)" && \ - printf '%s\n' "${device}" > "${XDG_RUNTIME_DIR}/SignalCrypt" && \ - gpg --decrypt ~/.var/signal/SignalCrypt.key | sudo cryptsetup -d - open "${device}" SignalCrypt && \ - sudo mount /dev/mapper/SignalCrypt /home/mattias/.var/signal/SignalCrypt.d + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/signal sh -ec ' + device="$(losetup --show -f -P "${SIGNAL_DIR}/SignalCrypt.img")" + printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/SignalCrypt" + gpg --decrypt "${SIGNAL_DIR}/SignalCrypt.key" | cryptsetup -d - open "${device}" SignalCrypt + mount /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d" + ' } umount-signal () { - sudo umount /home/mattias/.var/signal/SignalCrypt.d - sudo cryptsetup close SignalCrypt - sudo losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/SignalCrypt")" + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/signal sh -c ' + umount "${SIGNAL_DIR}/SignalCrypt.d" + cryptsetup close SignalCrypt + losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/SignalCrypt")" + ' } |