X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=shell%2Fsetup.sh;h=edb209ffc0b16444d520259053c82a411936b260;hb=HEAD;hp=eec1ded59a0911614c2f0586df54fa3b086c088c;hpb=0b96090f82bd835ed3707be7f7a32cc497272458;p=config%2Fdotfiles.git diff --git a/shell/setup.sh b/shell/setup.sh index eec1ded..edb209f 100755 --- a/shell/setup.sh +++ b/shell/setup.sh @@ -2,7 +2,7 @@ # Setup script for shell configuration files. -# Copyright (C) 2011-2014 Simon Ruderich +# Copyright (C) 2011-2018 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -67,9 +67,14 @@ mkdir -p zsh/cache # file in this directory; this requires replacing the constant HISTORY_PATH in # lesskey. echo 'lesskey: generating .lesskey' -simple_cpp /dev/null; then + sed_i 's/--rscroll=[^ ]*//' lesskey.tmp +fi +simple_cpp < lesskey.tmp \ HISTORY_PATH -- "`pwd`/lesshistory" \ | lesskey - +rm lesskey.tmp chmod 0600 ~/.less # Custom colors for GNU ls. @@ -122,7 +127,15 @@ else sed_i '/^alias grep=/ s/^/#/' shell/aliases fi +if ! lsblk --merge >/dev/null 2>&1; then + echo 'shell/aliases: removing lsblk --merge' + sed_i 's/lsblk --merge/lsblk/' shell/aliases +fi + generate screenrc .in cat +# Use absolute path for "shell" option for proper $SHELL variable. +apply_optional_replacement screenrc \ + zsh ZSH "`installed_path zsh`" # As screen-256color is not widely supported use it only on machines where the # matching terminfo entry is available. This also requires a terminal emulator # which supports 256 colors. Also used for tmux. @@ -161,19 +174,6 @@ if test -z "$use_256colors"; then sed_i 's/Enable 256 color/Disable 256 color/; s/screen-256color/screen/' screenrc fi -# Some options are only necessary when running as root. They are marked as -# "(ROOT)". -if test "`id -u`" -ne 0; then - echo 'screenrc: removing root options' - grep_i -v '(ROOT)' screenrc -fi -# I use some features of GNU screen which are only in Git or very recent GNU -# screen versions. Drop them on machines which have older versions. They are -# marked as "(GIT)". -if test ! -d "$HOME/development/shell/screen"; then - echo 'screenrc: removing Git features' - grep_i -v '(GIT)' screenrc -fi # Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when # it's installed. if installed rxvt; then @@ -197,6 +197,14 @@ if ! test -d "$temperature"; then fi apply_optional_replacement screenrc \ temperature TEMPERATURE "$temperature" +# Settings for local hosts. +if test -n "${SSH_CONNECTION:+set}"; then + echo 'screenrc: using dark blue for remote screens' + sed_i 's/sorendition = Bw/sorendition = bw/' screenrc +else + echo 'screenrc: removing remote options' + grep_i -v '(REMOTE)' screenrc +fi if installed tmux; then @@ -233,12 +241,21 @@ fi # Htop overwrites the comments in its configuration file. generate htoprc .in cat +if installed nproc && test "$(nproc)" -gt 8; then + sed_i 's/LeftCPUs/LeftCPUs2/; s/RightCPUs/RightCPUs2/' htoprc +fi if installed dig; then # dig doesn't support any comments in digrc. grep -v -E '^#' digrc.in >digrc fi +_iptables='/usr/share/zsh/functions/Completion/Linux/_iptables' +if test -f "$_iptables"; then + sed '/^#compdef/ s/iptables/& ip6tables/' \ + < "$_iptables" \ + > zsh/functions/_iptables +fi # LINK SETUP