mirror of
https://github.com/MiSTer-devel/Scripts_MiSTer.git
synced 2026-04-19 03:05:34 +00:00
Add settings and scripts for making/keeping Linux nice (#75)
This commit is contained in:
24
make_linux_nice.sh
Normal file
24
make_linux_nice.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "Making Linux nice..."
|
||||
|
||||
this_dir="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
|
||||
echo " - Modifying root user settings..."
|
||||
cp -f "$this_dir/nice-linux/.bashrc" /root/
|
||||
cp -f "$this_dir/nice-linux/.bash_aliases" /root/
|
||||
cp -f "$this_dir/nice-linux/.bash_logout" /root/
|
||||
cp -f "$this_dir/nice-linux/.bash_prompt" /root/
|
||||
cp -f "$this_dir/nice-linux/.profile" /root/
|
||||
cp -f "$this_dir/nice-linux/.vimrc" /root/
|
||||
cp -rf "$this_dir/nice-linux/.ssh" /root/
|
||||
|
||||
echo " - Configuring ssh KeepAlive settings..."
|
||||
sed -i -E 's|^#[[:blank:]]*ClientAliveInterval[[:blank:]]*.*$|ClientAliveInterval 60|g; s|^#[[:blank:]]*ClientAliveCountMax[[:blank:]]*.*$|ClientAliveCountMax 10|g' /etc/ssh/sshd_config
|
||||
|
||||
echo " - Configuring Bluetooth timeouts..."
|
||||
sed -i -E 's|^(DiscoverableTimeout = ).*%|\10|g; s|^(PairableTimeout = ).*$|\10|g; s|^(AutoConnectTimeout = ).*$|\160|g; s|^(FastConnectable = ).*$|\1true|g' /etc/bluetooth/main.conf
|
||||
|
||||
echo "Done."
|
||||
21
nice-linux/.bash_aliases
Normal file
21
nice-linux/.bash_aliases
Normal file
@@ -0,0 +1,21 @@
|
||||
color_option=
|
||||
less_color_option=
|
||||
more_color_option=
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
color_option='--color=always'
|
||||
less_color_option='-R'
|
||||
more_color_option='-f'
|
||||
fi
|
||||
|
||||
alias ls="ls --quoting-style=literal"
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
#alias ll='ls -l'
|
||||
alias dir="ls -lsAhF --quoting-style=literal $color_option"
|
||||
#alias vdir="vdir $color_option"
|
||||
alias less="less -R"
|
||||
alias more="more -f"
|
||||
alias md5sums='while IFS= read -r -d "" file; do md5sum "$file"; done < <(find * -type f -print0 | sort -s -z)'
|
||||
|
||||
unset color_option less_color_option more_color_option
|
||||
7
nice-linux/.bash_logout
Normal file
7
nice-linux/.bash_logout
Normal file
@@ -0,0 +1,7 @@
|
||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
||||
45
nice-linux/.bash_prompt
Normal file
45
nice-linux/.bash_prompt
Normal file
@@ -0,0 +1,45 @@
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# Assume no color, unless otherwise detected.
|
||||
unset color_prompt
|
||||
|
||||
# Check for color capabilities.
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color)
|
||||
color_prompt=1
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
cyan=
|
||||
green=
|
||||
light_blue=
|
||||
normal=
|
||||
if [ ! -z "${color_prompt:-}" ]; then
|
||||
none="\[\033[0m\]"
|
||||
blue="\[\033[1;34m\]"
|
||||
cyan="\[\033[0;36m\]"
|
||||
green="\[\033[0;32m\]"
|
||||
grey="\[\033[0;37m\]"
|
||||
unset color_prompt
|
||||
fi
|
||||
PS1="${grey}[${green}\D{%D %r}${grey}]\n${cyan}${debian_chroot:+($debian_chroot) }\u@\h${grey}:${blue}\w${grey}>${none}"
|
||||
unset none blue cyan green grey
|
||||
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
# Set window title.
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot) }\u@\h:\w\a\]$PS1"
|
||||
;;
|
||||
esac
|
||||
58
nice-linux/.bashrc
Normal file
58
nice-linux/.bashrc
Normal file
@@ -0,0 +1,58 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
if [ -f ~/.bash_prompt ]; then
|
||||
. ~/.bash_prompt
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
27
nice-linux/.profile
Normal file
27
nice-linux/.profile
Normal file
@@ -0,0 +1,27 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
3
nice-linux/.ssh/config
Normal file
3
nice-linux/.ssh/config
Normal file
@@ -0,0 +1,3 @@
|
||||
Host *
|
||||
ServerAliveInterval 60
|
||||
ServerAliveCountMax 10
|
||||
4
nice-linux/.vimrc
Normal file
4
nice-linux/.vimrc
Normal file
@@ -0,0 +1,4 @@
|
||||
set bs=2
|
||||
set number
|
||||
set laststatus=2
|
||||
set statusline=%f\ %m\ %=\ %y\ %{&fileencoding?&fileencoding:&encoding}\[%{&fileformat}\]\ L%l:C%c\ %p%%
|
||||
6
update_all_keep_linux_nice.sh
Normal file
6
update_all_keep_linux_nice.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
this_dir="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
"$this_dir/update_all.sh"
|
||||
/bin/mount -o remount,rw /
|
||||
"$this_dir/make_linux_nice.sh"
|
||||
/bin/mount -o remount,ro /
|
||||
Reference in New Issue
Block a user