From 63c0c990e8044c822636c9e56e6cf2c2b280ca76 Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Sun, 19 Nov 2017 21:32:22 +0100 Subject: Drop htop configuration It makes little to no sense to have this. --- install | 1 - 1 file changed, 1 deletion(-) (limited to 'install') diff --git a/install b/install index ffbf348..e59a0f1 100755 --- a/install +++ b/install @@ -34,7 +34,6 @@ fi if ask "Install configurations for various utility tools"; then inst screenrc ~/.screenrc - inst config/htop/htoprc ~/.config/htop/htoprc fi if ask "Install user services"; then -- cgit v1.3 From efc78eeb586cb159f50cff4f88d245328a331bcb Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Mon, 4 Dec 2017 07:19:40 +0100 Subject: Drop conkeror configuration --- conkeror/theme/content-buffer-input.css | 13 -- conkeror/theme/eye-guide.css | 22 ---- conkeror/theme/minibuffer.css | 94 --------------- conkeror/theme/mode-line.css | 14 --- conkeror/theme/new-tabs.css | 41 ------- conkeror/theme/theme.json | 10 -- conkeror/theme/window--panel.css | 5 - conkerorrc | 207 -------------------------------- install | 5 - 9 files changed, 411 deletions(-) delete mode 100644 conkeror/theme/content-buffer-input.css delete mode 100644 conkeror/theme/eye-guide.css delete mode 100644 conkeror/theme/minibuffer.css delete mode 100644 conkeror/theme/mode-line.css delete mode 100644 conkeror/theme/new-tabs.css delete mode 100644 conkeror/theme/theme.json delete mode 100644 conkeror/theme/window--panel.css delete mode 100644 conkerorrc (limited to 'install') diff --git a/conkeror/theme/content-buffer-input.css b/conkeror/theme/content-buffer-input.css deleted file mode 100644 index 82acb9e..0000000 --- a/conkeror/theme/content-buffer-input.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * (C) Copyright 2007-2008 Jeremy Maitin-Shepard - * - * Use, modification, and distribution are subject to the terms specified in the - * COPYING file. -**/ - -@namespace url("http://www.w3.org/1999/xhtml"); - -.__conkeror_textbox_edited_externally { - background-color: #bbbbbb; - -moz-appearance: none; -} diff --git a/conkeror/theme/eye-guide.css b/conkeror/theme/eye-guide.css deleted file mode 100644 index 502049b..0000000 --- a/conkeror/theme/eye-guide.css +++ /dev/null @@ -1,22 +0,0 @@ - -@namespace url("http://www.w3.org/1999/xhtml"); - -#__conkeror_eye_guide { - position: fixed; - left: 0px; - top: 0px; - width: 100%; - background: black; - opacity: 0.1; - z-index: 100000; -} - -/* - * Note, the following selectors can be styled with a - * border-top and border-bottom respectively to achieve - * the effect of a single line scroll-guide: - * - * #__conkeror_eye_guide.__conkeror_eye_guide_scroll_down - * #__conkeror_eye_guide.__conkeror_eye_guide_scroll_up - * - */ diff --git a/conkeror/theme/minibuffer.css b/conkeror/theme/minibuffer.css deleted file mode 100644 index a184564..0000000 --- a/conkeror/theme/minibuffer.css +++ /dev/null @@ -1,94 +0,0 @@ - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -#minibuffer { - color: white; - background: #333333; - border-top: 1px solid #285577; - -moz-box-align: baseline; -} - -#minibuffer-input { - background-color: -moz-field !important; -} - -#minibuffer-input .textbox-input-box { - width: 5em; -} - -#minibuffer-input [anonid="annotation"] { - font-style: oblique; -} - -#minibuffer-input [anonid="strut"] { - padding-right: 1em !important; -} - -/* mode text widgets */ - -#minibuffer .mode-text-widget { - display: none; -} - -#minibuffer[minibuffermode="message"] .mode-text-widget { - display: block; - border-left: 1px solid threedshadow; - padding-left: 4px !important; - padding-right: 4px !important; - margin-left: 0px !important; - margin-right: 0px !important; -} - -#minibuffer[minibuffermode="message"] .mode-text-widget[value=""] { - display: none; -} - - -/* minibuffer highlighting */ - -#minibuffer.highlight { - background-color: Highlight; - color: HighlightText; -} - -#minibuffer.highlight[minibuffermode="message"] .mode-text-widget { - border-left: 1px solid highlighttext; -} - - -/* Completions display */ - -tree.completions { margin: 0px !important; } - -tree.completions treechildren { border: none !important; } - -tree.completions treecol { -moz-binding: none !important; } -tree.completions { - -moz-appearance: none !important; - border: 0px none !important; - border-top: 1px solid -moz-Dialog !important; - -moz-border-top-colors: -moz-initial !important; -} - -tree.completions treechildren::-moz-tree-row { - border: none; -} - -tree.completions treechildren::-moz-tree-row(current) { - background-color: Highlight !important; - color: HighlightText !important; -} - -tree.completions treechildren::-moz-tree-cell-text(completion-description) { - font-weight: bold !important; -} - -tree.completions treechildren::-moz-tree-cell-text(current) { - color: HighlightText !important; -} - -tree.completions[hasicons="true"] treechildren::-moz-tree-image { - width: 16px; - height: 16px; - margin-right: 6px; -} diff --git a/conkeror/theme/mode-line.css b/conkeror/theme/mode-line.css deleted file mode 100644 index cec5771..0000000 --- a/conkeror/theme/mode-line.css +++ /dev/null @@ -1,14 +0,0 @@ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -.mode-line { - color: white; - padding: 2px; - background: #595959; - border-top: 3px solid #285577; - -moz-box-align: center; - overflow: hidden; -} - -.mode-line label[value=""] { - display: none; -} diff --git a/conkeror/theme/new-tabs.css b/conkeror/theme/new-tabs.css deleted file mode 100644 index 0dac555..0000000 --- a/conkeror/theme/new-tabs.css +++ /dev/null @@ -1,41 +0,0 @@ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -#tab2-bar { - color: white; - background: #595959; - border-bottom: 3px solid #285577; -} - -.tab2 { - -moz-box-align: center; - border-right: 3px solid #285577; - min-width: 10em; - max-width: 15em; -} - -.tab2[selected=true] { - background: #333333; -} - -.tab2:hover { - background: #999; -} - -.tab2-label { - -moz-box-flex: 100; - margin-left: 4pt; - padding-top: 1pt; -} - -.tab2-index { - padding: 0pt 2pt 0pt 3pt; - font-weight: 900; - text-align: center; -} - -.tab2-icon { - width: 16px; - height: 16px; - -moz-margin-start: 4pt; - -moz-margin-end: 3pt; -} diff --git a/conkeror/theme/theme.json b/conkeror/theme/theme.json deleted file mode 100644 index 905b804..0000000 --- a/conkeror/theme/theme.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "sheets": [ - "content-buffer-input.css", - "minibuffer.css", - "mode-line.css", - "tab-bar.css", - "new-tabs.css", - "window--panel.css", - "eye-guide.css" - ] -} diff --git a/conkeror/theme/window--panel.css b/conkeror/theme/window--panel.css deleted file mode 100644 index 6009000..0000000 --- a/conkeror/theme/window--panel.css +++ /dev/null @@ -1,5 +0,0 @@ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -.panel .panel-row-label { - font-weight: bold; -} diff --git a/conkerorrc b/conkerorrc deleted file mode 100644 index 5e85572..0000000 --- a/conkerorrc +++ /dev/null @@ -1,207 +0,0 @@ -// vim:ft=javascript -require("theme.js"); -theme_load_paths.unshift("~/.conkeror/"); -theme_unload("default"); -theme_load("theme"); - -require("session.js"); -session_auto_save_auto_load = true; - -require("favicon.js"); -require("new-tabs.js"); -tab_bar_show_icon = true; -tab_bar_show_index = false; - -require("clicks-in-new-buffer.js"); - -require("opensearch.js"); -define_opensearch_webjump("?", "duckduckgo.xml"); -define_opensearch_webjump("?g", "google.xml"); -define_opensearch_webjump("?w", "wikipedia.xml"); -define_opensearch_webjump("?e", "eBay.xml"); - -external_content_handlers.set("application/pdf", "llpp"); -external_content_handlers.set("video/*", "vlc"); -editor_shell_command = "urxvt -e vim"; - -url_completion_use_history = true; -url_remoting_fn = load_url_in_new_buffer; -download_buffer_automatic_open_target = OPEN_NEW_BUFFER_BACKGROUND; - -require("adblockplus.js"); - -// Set zoom to 90% -session_pref("layout.css.devPixelsPerPx", "0.9"); - -// Just key-kill all websites. I can use quote mode (ctrl+q) -require("key-kill"); -key_kill_mode.test.push(/\/\/.*\//); //regexp matches all sites - -view_source_use_external_editor = true; - -// Set cwd to ~/downloads so that downloads are saved there -cwd = get_home_directory(); -cwd.append("downloads"); - -///////////////////////////////////////////////////////////////////////////////// -// reopening closed buffers -define_key(default_global_keymap, "A-W", "revive-buffer"); - -// Save origin kill_buffer command -var kill_buffer_original = kill_buffer_original || kill_buffer; - -var killed_buffer_urls = []; -var killed_buffer_histories = []; - -// remember_killed_buffer -kill_buffer = function (buffer, force) { - var hist = buffer.web_navigation.sessionHistory; - - if (buffer.display_uri_string && hist) { - killed_buffer_histories.push(hist); - killed_buffer_urls.push(buffer.display_uri_string); - } - - kill_buffer_original(buffer,force); -}; - -interactive("revive-buffer", - "Loads url from a previously killed buffer", - function restore_killed_buffer (I) { - if (killed_buffer_urls.length !== 0) { - var url = yield I.minibuffer.read( - $prompt = "Restore killed url:", - $completer = new all_word_completer($completions = killed_buffer_urls), - $default_completion = killed_buffer_urls[killed_buffer_urls.length - 1], - $auto_complete = "url", - $auto_complete_initial = true, - $auto_complete_delay = 0, - $require_match = true); - - var window = I.window; - var creator = buffer_creator(content_buffer); - var idx = killed_buffer_urls.indexOf(url); - - // Create the buffer - var buf = creator(window, null); - - // Recover the history - buf.web_navigation.sessionHistory = killed_buffer_histories[idx]; - - // This line may seem redundant, but it's necessary. - var original_index = buf.web_navigation.sessionHistory.index; - buf.web_navigation.gotoIndex(original_index); - - // Focus the new tab - window.buffers.current = buf; - - // Remove revived from cemitery - killed_buffer_urls.splice(idx,1); - killed_buffer_histories.splice(idx,1); - } else { - I.window.minibuffer.message("No killed buffer urls"); - } - }); -///////////////////////////////////////////////////////////////////////////////// -// pass password management -define_key(default_global_keymap, "C-j", "pass-get-name"); -define_key(default_global_keymap, "C-J", "pass-get-password"); - -// Extract first and second domain by this hack -function get_domain(I) { - var domain = I.buffer.document.location.href; - var tmp_a = I.buffer.document.createElement('a'); - tmp_a.href = domain; - domain = tmp_a.hostname.match(/[^.]+\.[^.]+$/); - yield co_return(domain); -} - -function shell(cmd, input) { - var res = { - stdout: "", - stderr: "", - result: 0 - }; - res.result = yield shell_command(cmd, - $fds = [{ output: async_binary_string_writer(input) }, - { input: async_binary_reader(function (s) res.stdout+=s||"") }, - { input: async_binary_reader(function (s) res.stderr+=s||"") } - ] - ); - yield co_return(res); -}; - -var pass_domain = ""; -var pass_account = ""; - -function pass_chose_account(I) { - pass_domain = yield get_domain(I); - var res = yield shell("cd ~/.password-store && find -path '*" + pass_domain + "*' -type f", ""); - var accs = res.stdout.split('\n'); - if (accs.length == 0 || accs.length == 1) { - I.window.minibuffer.message("pass: No accounts detected for domain: " + pass_domain); - pass_account = ""; - return; - // Note that accs has empty line at end so all this is bumped by one - } else if (accs.length == 2) { - pass_account = accs[0].replace(/\.\//, '').replace(/\.gpg$/, ''); - } else { - var accs_list = []; - for (i = 0; i < accs.length - 1; i++) { - accs_list.push(accs[i].replace(/\.\//, '').replace(/\.gpg$/, '')); - } - pass_account = yield I.minibuffer.read( - $prompt = "Chose account for " + pass_domain + ":", - $completer = new all_word_completer($completions = accs_list), - $default_completion = accs_list[accs_list.length - 1], - $auto_complete = "url", - $auto_complete_initial = true, - $auto_complete_delay = 0, - $require_match = true); - } -} - -function pass_get_password(I) { - var domain = yield get_domain(I); - if (pass_account == "" || String(pass_domain) != String(domain)) { - yield pass_chose_account(I); - } - if (pass_account != "" && I.buffer.focused_element) { - var res = yield shell("pass " + pass_account, ""); - dumpln(res.stdout); - I.buffer.focused_element.value = res.stdout; - I.window.minibuffer.message("pass: Inserted password for account: " + pass_account); - pass_account = ""; // remove selected account so we can select new one - } -}; - -function pass_get_name(I) { - yield pass_chose_account(I); - I.window.minibuffer.message("pass: Chosen account: " + pass_account); - if (I.buffer.focused_element){ - var regexp = /[^\/]*$/; - I.buffer.focused_element.value = regexp.exec(pass_account)[0]; - } -}; - -interactive("pass-get-name", "Choses account for to be loged as. As result name of account is outputed.", pass_get_name); -interactive("pass-get-password", "Receives password from pass for currently selected account.", pass_get_password); -///////////////////////////////////////////////////////////////////////////////// -// Local SOCKS5 proxy -var proxy_session_enabled = false; -interactive("proxy-session-toggle", - "Toggle the SOCKS proxy server", - function (I) { - if (proxy_session_enabled) { - session_pref('network.proxy.type', 0); //direct connection - I.window.minibuffer.message("SOCKS5 proxy is now disabled."); - proxy_session_enabled = false; - } else { - session_pref('network.proxy.socks', '127.0.0.1'); - session_pref('network.proxy.socks_port', 8123); - session_pref('network.proxy.type', 1); - I.window.minibuffer.message("SOCKS5 proxy 127.0.0.1:8123 is now enabled."); - proxy_session_enabled = true; - } - }); -///////////////////////////////////////////////////////////////////////////////// diff --git a/install b/install index e59a0f1..1a23184 100755 --- a/install +++ b/install @@ -99,11 +99,6 @@ if ask "Install desktop (i3..)"; then inst config/user-dirs.dirs ~/.config/user-dirs.dirs fi -if ask "Install Conkeror configuration"; then - inst conkerorrc ~/.conkerorrc - inst conkeror/ ~/.conkeror -fi - if ask "Install Surf configuration"; then inst surf/script.js ~/.surf/script.js inst surf/styles/default.css ~/.surf/styles/default.css -- cgit v1.3 From 6cc31a2b88476fe42b7bca369d0b782bf9b0c7cc Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Mon, 4 Dec 2017 07:21:04 +0100 Subject: Drop surf-menu as it's now part of mysurf --- install | 1 - local/bin/surf-menu | 60 ----------------------------------------------------- 2 files changed, 61 deletions(-) delete mode 100755 local/bin/surf-menu (limited to 'install') diff --git a/install b/install index 1a23184..8f96cc6 100755 --- a/install +++ b/install @@ -102,7 +102,6 @@ fi if ask "Install Surf configuration"; then inst surf/script.js ~/.surf/script.js inst surf/styles/default.css ~/.surf/styles/default.css - inst local/bin/surf-menu ~/.local/bin/surf-menu fi if ask "Install MPD configuration"; then diff --git a/local/bin/surf-menu b/local/bin/surf-menu deleted file mode 100755 index b2e0111..0000000 --- a/local/bin/surf-menu +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -set -e - -BOOKMARDS=~/notes/bookmarks.md - -run() { - echo "Run $1" - echo "$1" | grep -qE '^~?/' || true - echo $? - if echo "$1" | grep -qE '^\?'; then # We do search on duckduckgo - - surf "https://duckduckgo.com/?q=${L#?}&t=surf&kk=-1&ia=web" & - - elif echo "$1" | grep -qE '^~?/'; then # This is local path - - surf "${1/#\~/$HOME}" & - - elif echo "$1" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'; then # This ipv4 address - - surf "$1" & - - else # We follow address - - LPROTOCOL="$(echo "$1" | sed -n 's#^\([^:]*\)://.*#\1#p')" - LHOST="$(echo "$1" | sed -n 's#^[^:]*://##;s#^\([^/]\+\)/\?.*#\1#p')" - LPATH="$(echo "$1" | sed 's#^[^:]*://##;s#^[^/]\+/\?##')" - - if ! getent hosts "$LHOST" >/dev/null; then - if getent hosts "$LHOST.cz" >/dev/null; then - LHOST="$LHOST.cz" - elif getent hosts "$LHOST.org" >/dev/null; then - LHOST="$LHOST.org" - elif getent hosts "$LHOST.com" >/dev/null; then - LHOST="$LHOST.com" - fi - # TODO what to do when we can't expand it? - fi - # Decide on protocol (if connection to 443 is not possible then use http otherwise https) - if [ -z "$LPROTOCOL" ]; then # We already have protocol (given explicitly) - if nc -z -w1 "$LHOST" 443 2>/dev/null; then - LPROTOCOL="https" - else - LPROTOCOL="http" - fi - fi - - surf "$LPROTOCOL://$LHOST/$LPATH" & - - fi -} - -if [ -n "$1" ]; then - run "$1" - exit -else - # Note: Bookmarks starts with '* ' - sed -n 's/\* //p' "$BOOKMARDS" | dmenu -p 'surf' | while read L; do - run "$L" - done -fi -- cgit v1.3 From a12db5d06ead397c3a4232e1bbac68748f02704b Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Mon, 4 Dec 2017 07:22:23 +0100 Subject: Drop lxc-net script as it was replaced by bridge service --- install | 4 ---- local/bin/lxc-net | 41 ----------------------------------------- 2 files changed, 45 deletions(-) delete mode 100755 local/bin/lxc-net (limited to 'install') diff --git a/install b/install index 8f96cc6..39f0869 100755 --- a/install +++ b/install @@ -112,10 +112,6 @@ if ask "Install backup script"; then inst local/bin/system-backup ~/.local/bin/system-backup fi -if ask "Install lxc-net script"; then - inst local/bin/lxc-net ~/.local/bin/lxc-net -fi - if ask "Install usbkey script"; then inst local/bin/usbkey ~/.local/bin/usbkey inst zsh_completions/usbkey ~/.zsh_completions/_usbkey diff --git a/local/bin/lxc-net b/local/bin/lxc-net deleted file mode 100755 index 53ccb50..0000000 --- a/local/bin/lxc-net +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -if [ "$(id -u)" -ne 0 ]; then - echo "Root required for execution" >&2 - exit 1 -fi - -# What if we want to clean -if [ "$1" = "clean" ]; then - kill $(cat /tmp/lxc-dhcpd.pid) - rm -f /tmp/lxc-dhcpd.pid /tmp/lxc-dhcpd.conf - ip link del dev vbr0 - exit -fi - -# Setup bridge -ip link add name vbr0 type bridge -ip link set vbr0 up -ip addr add 192.168.30.1/24 dev vbr0 - -# Start dhcp server - -# This just takes first dns nameserver configured. Maybe we might want to be -# little bit more clever. -DNS_SERVER=$(cat /etc/resolv.conf |grep -i nameserver|head -n1|cut -d ' ' -f2) -echo "# DHCPD configuration generated by lxc-net script -authoritative; -default-lease-time 600; -max-lease-time 7200; -option subnet-mask 255.255.255.0; -option broadcast-address 192.168.30.255; -option routers 192.168.30.1; -option domain-name-servers $DNS_SERVER; -subnet 192.168.30.0 netmask 255.255.255.0 { - range 192.168.30.10 192.168.30.100; -}" > /tmp/lxc-dhcpd.conf -dhcpd -4 -pf /tmp/lxc-dhcpd.pid -cf /tmp/lxc-dhcpd.conf vbr0 - -# Setup network forwarding (TODO add -o ethX to iptable command) -sysctl -w net.ipv4.ip_forward=1 -iptables -t nat -A POSTROUTING -j MASQUERADE -- cgit v1.3 From 9e424dae63ff66f889b8618c4fa4a6b3bf1b2012 Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Sat, 20 Jan 2018 22:28:59 +0100 Subject: Move usbkey to separate repo --- bash_completions/usbkey | 44 --------- install | 6 -- local/bin/usbkey | 245 ------------------------------------------------ zsh_completions/usbkey | 57 ----------- 4 files changed, 352 deletions(-) delete mode 100644 bash_completions/usbkey delete mode 100755 local/bin/usbkey delete mode 100644 zsh_completions/usbkey (limited to 'install') diff --git a/bash_completions/usbkey b/bash_completions/usbkey deleted file mode 100644 index acd6877..0000000 --- a/bash_completions/usbkey +++ /dev/null @@ -1,44 +0,0 @@ -# Bash completion file for usbkey -# vim: ft=sh - -_usbkey_mounted() { - mount | grep "/media/usbkey" | grep -q "/dev/mapper/usbkey" -} - -_usbkey() { - local cur prev - _init_completion || return - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - if [[ $COMP_CWORD -gt 1 ]]; then - _usbkey_mounted || return - case "${COMP_WORDS[1]}" in - ssh-import) - [ -d "/media/usbkey/ssh" ] || return - local keys - for F in $(find "/media/usbkey/ssh" -name '*.pub'); do - F="${F#/media/usbkey/ssh/}" - keys="$keys ${F%.pub}" - done - COMPREPLY+=($(compgen -W "${keys}" -- ${cur})) - ;; - openvpn-get) - [ -d "/media/usbkey/openvpn" ] || return - local certs - for F in $(find "/media/usbkey/openvpn" -name 'ca.crt' -o -name '*.crt' -print); do - F="${F#/media/usbkey/openvpn/}" - certs="$certs ${F%.crt}" - done - COMPREPLY+=($(compgen -W "${certs}" -- ${cur})) - ;; - esac - else - local ops="-h --help mount sync" - if _usbkey_mounted; then - ops="$ops unmount gpg-import ssh-list ssh-generate ssh-import openvpn-list openvpn-get openvpn-generate" - fi - COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) - fi -} - -complete -F _usbkey usbkey diff --git a/install b/install index 39f0869..bfcab02 100755 --- a/install +++ b/install @@ -111,9 +111,3 @@ fi if ask "Install backup script"; then inst local/bin/system-backup ~/.local/bin/system-backup fi - -if ask "Install usbkey script"; then - inst local/bin/usbkey ~/.local/bin/usbkey - inst zsh_completions/usbkey ~/.zsh_completions/_usbkey - inst bash_completions/usbkey ~/.bash_completions/usbkey -fi diff --git a/local/bin/usbkey b/local/bin/usbkey deleted file mode 100755 index e6cc42e..0000000 --- a/local/bin/usbkey +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/sh -set -e - -UUID_KKEY="7930cd94-b56e-4395-8859-f34da77f29be" -UUID_WKEY="9fcaf42a-86d5-4e70-828d-fd90aad2d964" - -CRYPT_NAME="usbkey" -MOUNT_PATH="/media/usbkey" - -op_mount() { - # First check if we have key drive - if [ ! -e "/dev/disk/by-uuid/$UUID_KKEY" ]; then - echo "Can't locate appropriate usb drive." >&2 - exit 1 - fi - # Decrypt drive - if [ -e "/dev/mapper/$CRYPT_NAME" ]; then - echo "USB key seems to be already decrypted" >&2 - else - echo "Decrypting usb key" >&2 - sudo -- cryptsetup open /dev/disk/by-uuid/"$UUID_KKEY" "$CRYPT_NAME" - fi - # Mount drive - if mount | grep -q "$MOUNT_PATH"; then - echo "USB key is already mounted" >&2 - else - echo "Mounting usb key" - sudo -- mkdir -p "$MOUNT_PATH" - sudo -- mount -o uid="$(id -u)",gid="$(id -g)" "/dev/mapper/$CRYPT_NAME" "$MOUNT_PATH" - fi - - echo "USB key drive mounted" >&2 -} - -op_unmount() { - # Unmount - if mount | grep -q "$MOUNT_PATH"; then - echo "Unmounting usb key" >&2 - sync "$MOUNT_PATH" - sudo -- umount "$MOUNT_PATH" - fi - # Remove mount path - [ ! -d "$MOUNT_PATH" ] || sudo -- rmdir "$MOUNT_PATH" - # Close encryption - if [ -e "/dev/mapper/$CRYPT_NAME" ]; then - echo "Closing encryption on usb key" >&2 - sudo -- cryptsetup close "$CRYPT_NAME" - fi - - echo "USB key unmounted" >&2 -} - -check_mount() { - mount | grep "$MOUNT_PATH" | grep -q "/dev/mapper/$CRYPT_NAME" -} - -op_sync() { - local DOUNMOUNT=false - if [ ! -e "/dev/disk/by-uuid/$UUID_WKEY" ]; then - echo "USB backup key seems to not be inserted. Please do so." >&2 - exit 1 - fi - if ! check_mount; then - DOUNMOUNT=true - op_mount - fi - - # Mount backup usb - sudo -- cryptsetup open "/dev/disk/by-uuid/$UUID_WKEY" "$CRYPT_NAME-backup" - sudo -- mkdir -p "$MOUNT_PATH-backup" - sudo -- mount -o uid="$(id -u)",gid="$(id -g)" "/dev/mapper/$CRYPT_NAME-backup" "$MOUNT_PATH-backup" - # Sync them - rsync -ax --delete --progress "$MOUNT_PATH/" "$MOUNT_PATH-backup/" - # Unmount it - sudo -- umount "$MOUNT_PATH-backup" - sudo -- rmdir "$MOUNT_PATH-backup" - sudo -- cryptsetup close "$CRYPT_NAME-backup" - - if $DOUNMOUNT; then - op_unmount - fi - - echo "Sync process finished." >&2 -} - -op_gpg_import() { - # TODO - true -} - -op_ssh_list() { - check_mount || op_mount - for KEY in $(find "$MOUNT_PATH/ssh" -name '*.pub'); do - local N="${KEY#$MOUNT_PATH/ssh/}" - echo -n "${N%.pub}: " - sed -n 's/ssh-rsa [^ ]* \(.*\)/\1/p' "$KEY" - done -} - -check_name() { - if [ -z "$NAME" ]; then - echo "You have to specify key name!" >&2 - exit 1 - fi -} - -op_ssh_generate() { - check_name - check_mount || op_mount - if [ -f "$MOUNT_PATH/ssh/$NAME" ]; then - echo "Key $NAME seems to already exists." >&2 - exit 1 - fi - echo -n "Please enter comment: " - read COMMENT - ssh-keygen -f "$MOUNT_PATH/ssh/$NAME" -C "$COMMENT" - - echo "SSH key $NAME was generated." >&2 -} - -op_ssh_import() { - check_name - check_mount || op_mount - if [ ! -f "$MOUNT_PATH/ssh/$NAME" ] || [ ! -f "$MOUNT_PATH/ssh/$NAME.pub" ]; then - echo "There is no key named $NAME" >&2 - exit 1 - fi - cp "$MOUNT_PATH/ssh/$NAME" ~/.ssh/ - cp "$MOUNT_PATH/ssh/$NAME.pub" ~/.ssh/ - chmod 600 ~/.ssh/"$NAME" - chmod 640 ~/.ssh/"$NAME.pub" - - echo "SSH key $NAME copied to local .ssh directory." >&2 -} - -# Note OpenVPN: CA generated using following command -# openssl req -nodes -new -x509 -days 3650 -keyout ca.key -out ca.crt -config openssl.cnf - -op_openvpn_list() { - check_mount || op_mount - for KEY in $(find "$MOUNT_PATH/openvpn" -name 'ca.crt' -o -name '*.crt' -print); do - local N="${KEY#$MOUNT_PATH/openvpn/}" - echo "${N%.crt}" - done -} - -op_openvpn_get() { - check_name - check_mount || op_mount - if [ ! -f "$MOUNT_PATH/openvpn/$NAME.key" ] || [ ! -f "$MOUNT_PATH/openvpn/$NAME.crt" ]; then - echo "There is no OpenVPN key $NAME" >&2 - exit 1 - fi - mkdir "openvpn-$NAME" - cp "$MOUNT_PATH/openvpn/$NAME.key" "openvpn-$NAME/" - cp "$MOUNT_PATH/openvpn/$NAME.crt" "openvpn-$NAME/" - cp "$MOUNT_PATH/openvpn/ca.crt" "openvpn-$NAME/" - cp "$MOUNT_PATH/openvpn/ta.key" "openvpn-$NAME/" - - echo "OpenVPN key $NAME copied to openvpn-$NAME directory." >&2 -} - -op_openvpn_generate() { - check_name - check_mount || op_mount - if [ -f "$MOUNT_PATH/openvpn/$NAME.key" ] && [ -f "$MOUNT_PATH/openvpn/$NAME.crt" ]; then - echo "OpenVPN key $NAME seems to already exists" >&2 - exit 1 - fi - ( - cd "$MOUNT_PATH/openvpn" - # Build request - openssl req -days 3650 -nodes -new -config "openssl.cnf" \ - -keyout "$NAME.key" -out "$NAME.csr" - # Sign request - openssl ca -days 3650 -config "openssl.cnf" \ - -out "$NAME.crt" -in "$NAME.csr" - ) - - echo "OpenVPN key $NAME was generated." >&2 -} - - -unknown_argument() { - echo "Unknown argument: $1" - exit 1 -} -# Parse operation (operation have to be first) -case "$1" in - -h|--help) - echo "Usb key manager" - echo "Usage: usbkey OPERATION ..." - echo - echo "Operations:" - echo " mount: Mount key of usb driver" - echo " unmount: Unmount usb driver" - echo " sync: Synchronize drive to bakup drive" - echo " gpg-import: Import gpg key" - echo " ssh-import: Import ssh key" - echo " ssh-generate: Generate new ssh key" - echo " ssh-list: List all ssh keys in store" - echo " openvpn-list: List all openvpn keys" - echo " openvpn-get: Get openvpn keys for some host" - echo " openvpn-generate: Generate openvpn key for new host" - exit 0 - ;; - mount|unmount|sync|gpg-import|ssh-import|ssh-generate|ssh-list|openvpn-list|openvpn-get|openvpn-generate) - OPERATION="$1" - ;; - *) - unknown_argument "$1" - ;; -esac -shift -# Parse rest of the arguments -while [ $# -gt 0 ]; do - case "$1" in - -h|--help) - echo "Usb key manager" - case "$OPERATION" in - mount|unmount|sync|ssh-list|openvn-list) - echo "Usage: usbkey $OPERATION [-h]" - ;; - ssh-*|openvpn-*) - echo "Usage: usbkey $OPERATION NAME [-h]" - ;; - # TODO - esac - exit 0 - ;; - *) - if [ -z "$NAME" ] && \ - [ "$OPERATION" = "ssh-import" -o "$OPERATION" = "ssh-generate" -o \ - "$OPERATION" = "openvpn-get" -o "$OPERATION" = "openvpn-generate" ] \ - ; then - NAME="$1" - else - unknown_argument "$1" - fi - ;; - esac - shift -done -# Go to operation handler -eval "op_$(echo "$OPERATION" | tr '-' '_')" diff --git a/zsh_completions/usbkey b/zsh_completions/usbkey deleted file mode 100644 index eada8f6..0000000 --- a/zsh_completions/usbkey +++ /dev/null @@ -1,57 +0,0 @@ -#compdef usbkey -#autoload - -_usbkey_mounted() { - mount | grep "/media/usbkey" | grep -q "/dev/mapper/usbkey" -} - -_usbkey () { - local cmd - if (( CURRENT > 2)); then - _usbkey_mounted || return - operation=${words[2]} - # Run the completion for the subcommand - case "${operation}" in - ssh-import) - [ -d "/media/usbkey/ssh" ] || return - local keys=() - for F in $(find "/media/usbkey/ssh" -name '*.pub'); do - F="${F#/media/usbkey/ssh/}" - keys+=("${F%.pub}") - done - _describe -t keys 'usbkey' keys - ;; - openvpn-get) - [ -d "/media/usbkey/openvpn" ] || return - local certs=() - for F in $(find "/media/usbkey/openvpn" -name 'ca.crt' -o -name '*.crt' -print); do - F="${F#/media/usbkey/openvpn/}" - certs+=("${F%.crt}") - done - _describe -t certificates 'usbkey' certs - ;; - # TODO - esac - else - local operations=( - "mount:Mount key of usb driver" - "unmount:Unmount usb driver" - "sync:Synchronize drive to bakup drive" - ) - if _usbkey_mounted; then - operations+=( - "gpg-import:Import gpg key" - "ssh-import:Import ssh key" - "ssh-generate:Generate new ssh key" - "ssh-list:List all SSH keys in store" - "openvpn-list:List all OpenVPN keys" - "openvpn-get:Get OpenVPN keys for some host" - "openvpn-generate:Generate OpenVPN key for new host" - ) - fi - _describe -t operations 'usbkey' operations - _arguments : "--help[Output help message]" - fi -} - -_usbkey -- cgit v1.3 From feddfdd6cab28f55ab2b5597f89f3805bac2349a Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Fri, 26 Jan 2018 15:51:03 +0100 Subject: Drop bashrc and zshrc They are replaced by shellrc package --- bashrc | 67 ------------------------------------ install | 12 ++----- zshrc | 120 ---------------------------------------------------------------- 3 files changed, 2 insertions(+), 197 deletions(-) delete mode 100644 bashrc delete mode 100644 zshrc (limited to 'install') diff --git a/bashrc b/bashrc deleted file mode 100644 index 0b7cf08..0000000 --- a/bashrc +++ /dev/null @@ -1,67 +0,0 @@ -# .bashrc - -source ~/.shellrc - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi - -# Source all completions -if [ -d ~/.bash_completions ]; then - for F in $(find ~/.bash_completions -type f); do - . "$F" - done -fi - -# PROMPT ####################################################### -PS1='$( -if [ `id -u` -eq "0" ]; then - echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " -else - echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " -fi)' - -PROMPT_COMMAND=' -EC=$? -if [[ $EC < 0 ]]; then - echo -e "\e[1;31m"EXIT: $EC"\e[0m" -elif [[ $EC > 0 ]]; then - echo -e "\e[1;33m"EXIT: $EC"\e[0m" -fi' - -function settitle { - echo -ne "\033]0;`whoami`@`hostname`:`pwd`\007" -} -case "$TERM" in - xterm*|*rxvt*|*st*) - trap 'settitle' DEBUG - ;; -esac - -# Completions ################################################## - -_gitbmerge() { - local cur prev - _init_completion || return - [ $COMP_CWORD -gt 1 ] && return # Complete only single dependency - COMPREPLY=() - local GDIR="$(pwd)" - while [ ! -d "$GDIR/.git" ]; do - [ -z "$GDIR" ] && return - GDIR="${GDIR%/*}" - done - GDIR="$GDIR/.git" - [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory - [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch - local ops="" - for B in "$GDIR"/refs/heads/*; do - # TODO skip branch on HEAD - ops="$ops ${B#$GDIR/refs/heads/}" - done - COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) -} -complete -F _gitbmerge gitbmerge diff --git a/install b/install index bfcab02..40bf40e 100755 --- a/install +++ b/install @@ -13,18 +13,10 @@ git submodule update --init --recursive || (echo "Submodule update failed!"; exi ################################################################################# source private/install # private files, sorry but some privacy is required. -if ask "Install Bashrc"; then - inst bashrc ~/.bashrc - inst shellrc ~/.shellrc +# TODO on hosts without shellrc we might want some thin shellrc to be installed +if ask "Install shell profile"; then inst profile ~/.profile - mkdir -p ~/.bash_completions -fi - -if ask "Install zshrc"; then - inst zshrc ~/.zshrc - inst shellrc ~/.shellrc inst zprofile ~/.zprofile - mkdir -p ~/.zsh_completions fi if ask "Install GIT configuration"; then diff --git a/zshrc b/zshrc deleted file mode 100644 index ec502b6..0000000 --- a/zshrc +++ /dev/null @@ -1,120 +0,0 @@ -source ~/.shellrc - -[[ -o interactive ]] || return # skip on initialization if not interactive - -zstyle ':completion:*' completer _expand _complete _ignored _approximate -zstyle ':completion:*' insert-unambiguous true -zstyle ':completion:*' max-errors 3 -zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path ~/.cache/zsh -zstyle :compinstall filename '/home/kkoci/.zshrc' -zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==32=33}:${(s.:.)LS_COLORS}")' -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} -fpath=(~/.zsh_completions $fpath) - -autoload -Uz compinit && compinit -autoload -Uz colors && colors - -HISTFILE=~/.histfile -HISTSIZE=10000 -SAVEHIST=10000 -setopt appendhistory -setopt extendedglob -setopt hist_ignore_dups -setopt hist_expire_dups_first -setopt extended_history -setopt inc_append_history -setopt promptsubst -setopt hist_ignore_dups -unsetopt nomatch -bindkey -e - -autoload -U select-word-style -select-word-style bash - -# Delete key workaround -bindkey "^[[3~" delete-char -bindkey "^[3;5~" delete-char - -# PROMPT ####################################################### -[ $UID -eq 0 ] && NCOLOR="red" || NCOLOR="green" -PROMPT="%(?..%{$fg_bold[yellow]%}EXIT: %? -)%{$fg_bold[$NCOLOR]%}%n@%m:%{$fg_bold[blue]%}%1~%{$fg_bold[$NCOLOR]%}%(!.#.$)%{$reset_color%} " -unset NCOLOR - -if [ -e ~/.local/git-prompt.sh ]; then - source ~/.local/git-prompt.sh - export GIT_PS1_SHOWDIRTYSTATE=y - export GIT_PS1_SHOWUNTRACKEDFILES=y - export GIT_PS1_SHOWUPSTREAM="auto" - export GIT_PS1_STATESEPARATOR="" - export GIT_PS1_SHOWUPSTREAM=y - export GIT_PS1_DESCRIBE_STYLE="branch" - RPROMPT='$(__git_ps1 "%s")' -fi -# Long running bell ############################################ -# Inspired by: https://gist.github.com/jpouellet/5278239 -zmodload zsh/datetime # load $EPOCHSECONDS builtin -autoload -Uz add-zsh-hook -lrbell_duration=15 -lrbell_timestamp=$EPOCHSECONDS -lrbell_window_id=0x0 - -lrbell_active_window_id() { - xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2 -} - -lrbell_begin() { - lrbell_timestamp=$EPOCHSECONDS - if [ -n "$DISPLAY" ]; then - lrbell_message="`pwd`: $1" - lrbell_window_id="$(lrbell_active_window_id)" - fi -} -lrbell_end() { - if (( $EPOCHSECONDS - $lrbell_timestamp < $lrbell_duration )); then - return - fi - - print -n '\a' - if [ -n "$DISPLAY" ] && [ -n "$lrbell_window_id" ]; then # notify only if running in X - if [ "$(lrbell_active_window_id)" != "$lrbell_window_id" ]; then # And active window isn't current one - notify-send "Command finished" "$lrbell_message" - fi - fi -} - -add-zsh-hook preexec lrbell_begin -add-zsh-hook precmd lrbell_end -# Completions ################################################## - -_gitbmerge() { - (( CURRENT > 2)) && return # Complete only single dependency - local GDIR="$(pwd)" - while [ ! -d "$GDIR/.git" ]; do - [ -z "$GDIR" ] && return - GDIR="${GDIR%/*}" - done - GDIR="$GDIR/.git" - [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory - [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch - local branches=() - for B in "$GDIR"/refs/heads/*; do - # TODO skip branch on HEAD - branches+=("${B#$GDIR/refs/heads/}") - done - _describe -t branches 'gitbmerge' branches -} -compdef _gitbmerge gitbmerge - -################################################################ -case "$TERM" in - xterm*|*rxvt*|*st*) - precmd() { - print -Pn "\e]0;%n@%m:%~ %(1j,%j job%(2j|s|) ,)\a" - } - preexec() { - print -Pn "\e]0;%n@%m:%~ !$1\a" - } - ;; -esac -- cgit v1.3 From 6f504fb861d7c6bc0c17471cab6acccb0317cfdb Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Fri, 26 Jan 2018 23:58:39 +0100 Subject: Add khal and khard --- config/khal/config | 32 ++++++++++++++++++++++++++++++++ config/khard/khard.conf | 25 +++++++++++++++++++++++++ install | 5 +++++ 3 files changed, 62 insertions(+) create mode 100644 config/khal/config create mode 100644 config/khard/khard.conf (limited to 'install') diff --git a/config/khal/config b/config/khal/config new file mode 100644 index 0000000..0addef1 --- /dev/null +++ b/config/khal/config @@ -0,0 +1,32 @@ +[default] +default_calendar = personal +highlight_event_days = True +timedelta = 10d + +[calendars] + +[[personal]] +path = /home/cynerd/.khal/private +type = calendar +color = dark blue + +[[school]] +path = /home/cynerd/.khal/school +type = calendar +color = dark red + +[[work]] +path = /home/cynerd/.khal/work +type = calendar +color = yellow + +[highlight_days] +default_color = dark gray +method = background + +[locale] +timeformat = %H:%M +dateformat = %d.%m.%Y +longdateformat = %d.%m.%Y +datetimeformat = %d.%m.%Y %H:%M +longdatetimeformat = %d.%m.%Y %H:%M diff --git a/config/khard/khard.conf b/config/khard/khard.conf new file mode 100644 index 0000000..63bc685 --- /dev/null +++ b/config/khard/khard.conf @@ -0,0 +1,25 @@ +[addressbooks] + +[[family]] +path = ~/.contacts/family/ +[[friends]] +path = ~/.contacts/friends/ +[[work]] +path = ~/.contacts/work + + +[general] +debug = no +default_action = list +editor = vim +merge_editor = vimdiff + + +[contact table] +display = first_name +group_by_addressbook = yes +reverse = no +show_nicknames = yes +show_uids = yes +sort = last_name +localize_dates = yes diff --git a/install b/install index 40bf40e..ce82066 100755 --- a/install +++ b/install @@ -91,6 +91,11 @@ if ask "Install desktop (i3..)"; then inst config/user-dirs.dirs ~/.config/user-dirs.dirs fi +if ask "Install khal khard"; then + inst config/khal/config ~/.config/khal/config + inst config/khard/khard.conf ~/.config/khard/khard.conf +fi + if ask "Install Surf configuration"; then inst surf/script.js ~/.surf/script.js inst surf/styles/default.css ~/.surf/styles/default.css -- cgit v1.3 From a214815179291a173faea8af894d602c865726c1 Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Sun, 28 Jan 2018 16:18:53 +0100 Subject: Update khal and khard and add vdirsyncer --- config/khal/config | 14 +++++++------- config/khard/khard.conf | 12 ++++++++---- install | 3 ++- mutt/muttrc | 4 ++-- private | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) (limited to 'install') diff --git a/config/khal/config b/config/khal/config index 0addef1..bfbb9c7 100644 --- a/config/khal/config +++ b/config/khal/config @@ -6,20 +6,20 @@ timedelta = 10d [calendars] [[personal]] -path = /home/cynerd/.khal/private +path = /home/cynerd/.calendar/personal type = calendar color = dark blue -[[school]] -path = /home/cynerd/.khal/school -type = calendar -color = dark red - [[work]] -path = /home/cynerd/.khal/work +path = /home/cynerd/.calendar/work type = calendar color = yellow +[[misc]] +path = /home/cynerd/.calendar/misc +type = calendar +color = dark red + [highlight_days] default_color = dark gray method = background diff --git a/config/khard/khard.conf b/config/khard/khard.conf index 63bc685..1b4d7a2 100644 --- a/config/khard/khard.conf +++ b/config/khard/khard.conf @@ -1,11 +1,15 @@ [addressbooks] [[family]] -path = ~/.contacts/family/ +path = ~/.contacts/family [[friends]] -path = ~/.contacts/friends/ -[[work]] -path = ~/.contacts/work +path = ~/.contacts/friends +[[cz.nic]] +path = ~/.contacts/cz.nic +[[school]] +path = ~/.contacts/school +[[misc]] +path = ~/.contacts/misc [general] diff --git a/install b/install index ce82066..cc7e8c3 100755 --- a/install +++ b/install @@ -91,9 +91,10 @@ if ask "Install desktop (i3..)"; then inst config/user-dirs.dirs ~/.config/user-dirs.dirs fi -if ask "Install khal khard"; then +if ask "Install calendar and contacts"; then inst config/khal/config ~/.config/khal/config inst config/khard/khard.conf ~/.config/khard/khard.conf + inst private/vdirsyncer/ ~/.vdirsyncer fi if ask "Install Surf configuration"; then diff --git a/mutt/muttrc b/mutt/muttrc index 7ebfa2a..9e4d2d5 100644 --- a/mutt/muttrc +++ b/mutt/muttrc @@ -25,8 +25,8 @@ set crypt_autosign = yes set crypt_replyencrypt = yes set sendmail="/usr/bin/msmtp --read-envelope-from" -set query_command= "abook --mutt-query '%s'" -bind editor complete-query +set query_command= "khard email --parsable '%s'" +bind editor complete-query macro index S 's=archive' diff --git a/private b/private index 572439b..3659803 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 572439be1f36e6d83b410d08228b950699c242f8 +Subproject commit 365980335dc88f7782161d7f88fcbd4921c077c5 -- cgit v1.3