Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save strohel/584a085d568dbef5402a to your computer and use it in GitHub Desktop.
Save strohel/584a085d568dbef5402a to your computer and use it in GitHub Desktop.
/etc/
# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
# Disable completion when the input buffer is empty. i.e. Hitting tab
# and waiting a long time for bash to expand all of $PATH.
shopt -s no_empty_cmd_completion
# Enable history appending instead of overwriting when exiting. #139609
shopt -s histappend
# Save each command to the history file as it's executed. #517342
# This does mean sessions get interleaved when reading later on, but this
# way the history is always up to date. History is not synced across live
# sessions though; that is what `history -n` does.
# Disabled by default due to concerns related to system recovery when $HOME
# is under duress, or lives somewhere flaky (like NFS). Constantly syncing
# the history will halt the shell prompt until it's finished.
#PROMPT_COMMAND='history -a'
# Change the window title of X terminals
case ${TERM} in
[aEkx]term*|rxvt*|gnome*|konsole*|interix)
PS1='\[\033]0;\u@\h:\w\007\]'
;;
screen*)
PS1='\[\033k\u@\h:\w\033\\\]'
;;
*)
unset PS1
;;
esac
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions.
# We run dircolors directly due to its changes in file syntax and
# terminal name patching.
use_color=false
if type -P dircolors >/dev/null ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
LS_COLORS=
if [[ -f ~/.dir_colors ]] ; then
eval "$(dircolors -b ~/.dir_colors)"
elif [[ -f /etc/DIR_COLORS ]] ; then
eval "$(dircolors -b /etc/DIR_COLORS)"
else
eval "$(dircolors -b)"
fi
# Note: We always evaluate the LS_COLORS setting even when it's the
# default. If it isn't set, then `ls` will only colorize by default
# based on file attributes and ignore extensions (even the compiled
# in defaults of dircolors). #583814
if [[ -n ${LS_COLORS:+set} ]] ; then
use_color=true
else
# Delete it if it's empty as it's useless in that case.
unset LS_COLORS
fi
else
# Some systems (e.g. BSD & embedded) don't typically come with
# dircolors so we need to hardcode some terminals in here.
case ${TERM} in
[aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25|*color) use_color=true;;
esac
fi
if ${use_color} ; then
if [[ ${EUID} == 0 ]] ; then
PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '
else
PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
# show root@ when we don't have colors
PS1+='\u@\h \w \$ '
fi
for sh in /etc/bash/bashrc.d/* ; do
[[ -r ${sh} ]] && source "${sh}"
done
# Try to keep environment pollution down, EPA loves us.
unset use_color sh
# strohel: ignore history duplicates, more lines of history
HISTCONTROL="ignoredups"
HISTFILESIZE=100000
HISTSIZE=100000
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PS1='\[\033]0;\u@\h \W\007\]'
;;
screen*)
PS1='\[\033k\u@\h \W\033\\\]'
;;
*)
unset PS1
;;
esac
if ${use_color} ; then
if [[ ${EUID} == 0 ]] ; then
PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '
else
PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1+='\u@\h \w \$ '
else
PS1+='\u@\h \w \$ '
fi
fi
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
# 'grub2-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.
GRUB_DISTRIBUTOR="Gentoo"
# Default menu entry
GRUB_DEFAULT=saved
# disabled by strohel because vfat is not writeable by grub
GRUB_SAVEDEFAULT=false
# Boot the default entry this many seconds after the menu is displayed
GRUB_TIMEOUT=2
#GRUB_TIMEOUT_STYLE=menu
# Append parameters to the linux kernel command line
#GRUB_CMDLINE_LINUX=""
#
# Examples:
#
# Boot with network interface renaming disabled
# GRUB_CMDLINE_LINUX="net.ifnames=0"
#
# Boot with systemd instead of sysvinit (openrc)
GRUB_CMDLINE_LINUX="init=/lib/systemd/systemd net.ifnames=0"
# Append parameters to the linux kernel command line for non-recovery entries
GRUB_CMDLINE_LINUX_DEFAULT="i915.semaphores=1 i915.i915_enable_rc6=7 i915.i915_enable_fbc=1 i915.lvds_downclock=1 pcie_aspm=force"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.
# You can see them in real GRUB with the command `vbeinfo'.
#GRUB_GFXMODE=640x480
# Set to 'text' to force the Linux kernel to boot in normal text
# mode, 'keep' to preserve the graphics mode set using
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
# graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence.
#GRUB_GFXPAYLOAD_LINUX=
# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
# Background image used on graphical terminal.
# Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true
# Uncomment to disable generation of the submenu and put all choices on
# the top-level menu.
# Besides the visual affect of no sub menu, this makes navigation of the
# menu easier for a user who can't see the screen.
GRUB_DISABLE_SUBMENU=y
# Uncomment to play a tone when the main menu is displayed.
# This is useful, for example, to allow users who can't see the screen
# to know when they can make a choice on the menu.
#GRUB_INIT_TUNE="60 800 1"
# /etc/inputrc: initialization file for readline
#
# For more information on how this file works, please see the
# INITIALIZATION FILE section of the readline(3) man page
#
# Quick dirty little note:
# To get the key sequence for binding, you can abuse bash.
# While running bash, hit CTRL+V, and then type the key sequence.
# So, typing 'ALT + left arrow' in Konsole gets you back:
# ^[[1;3D
# The readline entry to make this skip back a word will then be:
# "\e[1;3D" backward-word
#
# Customization note:
# You don't need to put all your changes in this file. You can create
# ~/.inputrc which starts off with the line:
# $include /etc/inputrc
# Then put all your own stuff after that.
#
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
# strohel complete immediately
set show-all-if-ambiguous on
$if mode=emacs
# for linux console and RH/Debian xterm
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# map "page up" and "page down" to search history based on current cmdline
"\e[5~": history-search-backward
"\e[6~": history-search-forward
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# gnome / others (escape + arrow key)
"\e[5C": forward-word
"\e[5D": backward-word
# konsole / xterm / rxvt (escape + arrow key)
"\e\e[C": forward-word
"\e\e[D": backward-word
# gnome / konsole / others (control + arrow key)
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# aterm / eterm (control + arrow key)
"\eOc": forward-word
"\eOd": backward-word
# konsole (alt + arrow key)
"\e[1;3C": forward-word
"\e[1;3D": backward-word
# Chromebooks remap alt + backspace so provide alternative (alt + k)
"\ek": backward-kill-word
$if term=rxvt
"\e[8~": end-of-line
$endif
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif
# fix Home and End for German users
"\e[7~": beginning-of-line
"\e[8~": end-of-line
#!/bin/bash
# /etc/local.d/local.start
# this lines adds compatibility with systemd when run by gentoo-local-local.service
if [ "${RC_GOT_FUNCTIONS}" != "yes" ]; then
source /lib64/rc/sh/functions.sh
fi
# This is a good place to load any misc programs
# on startup (use &>/dev/null to hide output)
if [ -w /sys/class/graphics/fbcon/cursor_blink ]; then
ebegin "shl: Disabling fbcon cursor blinking to save power"
echo 0 > /sys/class/graphics/fbcon/cursor_blink
eend $?
else
ewarn "shl: /sys/class/graphics/fbcon/cursor_blink not writeable, not disabling cursor blinking"
fi
ssd="sdb"
sysfile="/sys/block/${ssd}/queue/add_random"
if [ -w ${sysfile} ]; then
ebegin "shl: Disabling ${ssd} as source of entropy - it is a SSD"
echo 0 > ${sysfile}
eend $?
else
ewarn "shl: ${sysfile} not writeable - not disabling it as source of entropy"
fi
#!/bin/sh
# Run
# chown root:root per_device_routing_tables.sh
# chmod 700 per_device_routing_tables.sh
#
# or NM will refore to run the script.
# Then move the script to /etc/NetworkManager/dispatcher.d
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
case $2 in
up|dhcp4-change)
;;
*)
exit 0
;;
esac
# Add one line per device in /etc/iproute2/rt_tables, like this:
# 100 eth0
# 101 wlan0
# 102 ppp0
# 103 usb0
LOG="/tmp/log_nm2.txt"
#echo -e "\n========== $(date)\n'$1' '$2'\n$(env)" >> $LOG
if [ "$(awk '/^[^#]/ { if ( $2 == "'$DEVICE_IP_IFACE'" ) { print $2 } }' /etc/iproute2/rt_tables)" != "" ]
then
IP_PREFIX=$(echo $IP4_ADDRESS_0 | cut -d ' ' -f 1 | cut -d / -f 2)
ip route add $DHCP4_NETWORK_NUMBER/$IP_PREFIX dev $DEVICE_IP_IFACE src $DHCP4_IP_ADDRESS table $DEVICE_IP_IFACE
#ip route add $DHCP4_NETWORK_NUMBER/$IP_PREFIX dev $DEVICE_IP_IFACE src $DHCP4_IP_ADDRESS # shl: not needed IMO
ip route add default via $DEVICE_IP_IFACE table $DEVICE_IP_IFACE # shl: was "via $(echo $DHCP4_ROUTERS | cut -d ' ' -f 1)" - why??
ip rule add from $DHCP4_IP_ADDRESS table $DEVICE_IP_IFACE
fi
/bin/true
auth sufficient pam_rootok.so
# strohel: following line causes users in wheel group can su without password
auth sufficient pam_wheel.so trust use_uid
auth required pam_wheel.so use_uid
auth include system-auth
account include system-auth
password include system-auth
session include system-auth
session required pam_env.so
session optional pam_xauth.so
# TODO: this seems not to work
# USB UltraNav Keyboard: no speed, sensitivity default = 160
SUBSYSTEM=="hid", DRIVER=="lenovo_tpkbd", ATTR{sensitivity}=="?*", ATTR{sensitivity}="248"
# Embedded Ultranav: speed dafault = 97, sensitivity default = 128
SUBSYSTEM=="serio", DRIVER=="psmouse", ATTR{speed}=="?*", ATTR{sensitivity}=="?*", ATTR{speed}="197", ATTR{sensitivity}="255"
# https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment