Nxl67002 - AndLinux - Files: Difference between revisions
(→/etc/fstab: Original file) |
|||
(35 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
__TOC__ |
|||
These are the configuration files on '''[[Configuration NXP Dell Latitude D620 - AndLinux]]'''. |
|||
== Windows Host files == |
== Windows Host files == |
||
=== settings.txt === |
=== settings.txt === |
||
{{hiddenSourceFile|./andlinux/|settings.txt|<pre class="settings.txt"> |
|||
Download [{{#file: settings.txt}} this file]. |
|||
<pre> |
|||
mem=384 |
mem=384 |
||
root=/dev/cobd0 |
root=/dev/cobd0 |
||
Line 9: | Line 12: | ||
cobd0=Drives\base.vdi |
cobd0=Drives\base.vdi |
||
cobd1=Drives\swap.vdi |
cobd1=Drives\swap.vdi |
||
cobd2=Drives\data.reiserfs.10G.dvi |
|||
cofs31=. |
cofs31=. |
||
eth0=slirp |
eth0=slirp |
||
Line 15: | Line 19: | ||
cofs1=D:\ |
cofs1=D:\ |
||
</pre> |
</pre> |
||
}} |
|||
== |
=== hosts === |
||
{{hiddenSourceFile|c:\windows\system32\drivers\etc\|hosts|<pre class="hosts"> |
|||
# Copyright (c) 1993-1999 Microsoft Corp. |
|||
# |
|||
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. |
|||
# |
|||
# This file contains the mappings of IP addresses to host names. Each |
|||
# entry should be kept on an individual line. The IP address should |
|||
# be placed in the first column followed by the corresponding host name. |
|||
# The IP address and the host name should be separated by at least one |
|||
# space. |
|||
# |
|||
# Additionally, comments (such as these) may be inserted on individual |
|||
# lines or following the machine name denoted by a '#' symbol. |
|||
# |
|||
# For example: |
|||
# |
|||
# 102.54.94.97 rhino.acme.com # source server |
|||
# 38.25.63.10 x.acme.com # x client host |
|||
127.0.0.1 localhost |
|||
=== /etc/fstab === |
|||
192.168.11.150 andlinux |
|||
</pre> |
|||
}} |
|||
== AndLinux files == |
|||
<small>Generated with script '''/home/beq06659/bin/generate_wiki_config_file_page.sh''' on host '''andLinux'''</small> |
|||
=== Directory /etc === |
|||
Download [{{#file: fstab}} this file]. |
|||
'''fstab''' |
|||
<pre> |
|||
{{pl2|{{hiddenSourceFile|/etc/|fstab|<source lang=text class="fstab"> |
|||
# /etc/fstab: static file system information. |
# /etc/fstab: static file system information. |
||
# |
# |
||
# <file system> <mount point> <type> |
# <file system> <mount point> <type> <options> <dump> <pass> |
||
proc /proc proc |
proc /proc proc defaults 0 0 |
||
/dev/cobd0 / ext3 |
/dev/cobd0 / ext3 defaults 1 1 |
||
/dev/cobd1 none swap |
/dev/cobd1 none swap sw 0 0 |
||
/dev/cobd2 /mnt/data reiserfs noatime,notail 0 0 |
|||
31 /mnt/and cofs defaults 0 0 |
|||
0 /mnt/winc cofs defaults,gid=samba,dmask=0775,fmask=0775 0 0 |
|||
</pre> |
|||
1 /mnt/wind cofs defaults,gid=samba,dmask=0775,fmask=0775 0 0 |
|||
</source> |
|||
=== ~/.ssh/config-home === |
|||
}} }} |
|||
Download [{{#file: config-nxp}} this file]. |
|||
=== Directory /etc/privoxy === |
|||
<pre> |
|||
'''set-network-config''' - This file must be '''chmod 755'''. Also the following line must be added to <tt>/etc/sudoers</tt>: |
|||
:<code> ALL ALL=(ALL) NOPASSWD: /etc/privoxy/set-network-config </code> |
|||
{{pl2|{{hiddenSourceFile|/etc/privoxy/|set-network-config|<source lang=bash class="set-network-config"> |
|||
#! /bin/bash |
|||
# Exit if no network name given or if no corresponding configuration file |
|||
[ -n "$1" ] || exit 1 |
|||
TARGET_FILE="config-$1" |
|||
[ -a "/etc/privoxy/$TARGET_FILE" ] || exit 1 |
|||
ln -sf "$TARGET_FILE" /etc/privoxy/config |
|||
/etc/init.d/privoxy restart |
|||
</source> |
|||
}} }} |
|||
'''config-home.patch''' |
|||
{{pl2|{{hiddenSourceFile|/etc/privoxy/|config-home.patch|<source lang=diff class="config-home.patch"> |
|||
--- config.original 2009-11-15 00:50:28.000000000 +0100 |
|||
+++ config-home 2009-11-17 00:01:48.000000000 +0100 |
|||
@@ -761,7 +761,7 @@ |
|||
# listen-address 192.168.0.1:8118 |
|||
# |
|||
# |
|||
-listen-address 127.0.0.1:8118 |
|||
+listen-address :8118 |
|||
# |
|||
# |
|||
# 4.2. toggle |
|||
</source> |
|||
}} }} |
|||
'''config-nxp.patch''' |
|||
{{pl2|{{hiddenSourceFile|/etc/privoxy/|config-nxp.patch|<source lang=diff class="config-nxp.patch"> |
|||
--- config-home 2009-11-17 00:01:48.000000000 +0100 |
|||
+++ config-nxp 2009-11-15 02:34:20.000000000 +0100 |
|||
@@ -1250,6 +1250,13 @@ |
|||
# that look like this: |
|||
# |
|||
# forward localhost/ . |
|||
+# nxp only: |
|||
+forward-socks5 / localhost:1080 . |
|||
+forward 192.168.*.*/ . |
|||
+forward 10.*.*.*/ . |
|||
+forward 127.*.*.*/ . |
|||
+forward 172.19.*.*/ . |
|||
+forward 134.27.*.* . |
|||
# |
|||
# |
|||
# |
|||
</source> |
|||
}} }} |
|||
'''config-nxp_auth''' - symlinked to <tt>config-nxp</tt> |
|||
'''config-nxp_direct.patch''' |
|||
{{pl2|{{hiddenSourceFile|/etc/privoxy/|config-nxp_direct.patch|<source lang=diff class="config-nxp_direct.patch"> |
|||
--- config-nxp 2009-11-15 02:34:20.000000000 +0100 |
|||
+++ config-nxp_direct 2009-11-16 16:14:23.000000000 +0100 |
|||
@@ -1251,7 +1251,7 @@ |
|||
# |
|||
# forward localhost/ . |
|||
# nxp only: |
|||
-forward-socks5 / localhost:1080 . |
|||
+forward / emea.nics.nxp.com:8080 |
|||
forward 192.168.*.*/ . |
|||
forward 10.*.*.*/ . |
|||
forward 127.*.*.*/ . |
|||
</source> |
|||
}} }} |
|||
=== Directory /usr/local/bin === |
|||
'''be''' - This script would ideally require to add the following line to <tt>/etc/sudoers</tt>: |
|||
:<code>ALL ALL=(ALL) NOPASSWD: /bin/loadkeys</code> |
|||
{{pl2|{{hiddenSourceFile|/usr/local/bin/|be|<source lang=bash class="be"> |
|||
#!/bin/bash |
|||
sudo loadkeys /usr/share/keymaps/i386/azerty/be2-latin1.kmap.gz |
|||
</source> |
|||
}} }} |
|||
'''ssh-agent-refresh.sh''' |
|||
{{pl2|{{hiddenSourceFile|/usr/local/bin/|ssh-agent-refresh.sh|<source lang=bash class="ssh-agent-refresh.sh"> |
|||
#!/bin/bash |
|||
# |
|||
# This script will detect any running ssh-agent and restore the environment |
|||
# variable that would normally be created with the command |
|||
# |
|||
# % ssh-agent -s |
|||
# |
|||
# By default, this script looks for an existing ssh-agent process already running with |
|||
# same UID as the current shell. If none is found, a new ssh-agent process is launched. |
|||
# If the SSH_AUTH_SOCK is not specified, the script will try to find back the correct |
|||
# socket name. For this it looks for a socket named /tmp/ssh-*/agent.*, with same UID |
|||
# as current script. |
|||
# |
|||
# If the environment variable SSH_AUTH_SOCK is set, ssh-agent will use that socket name |
|||
# instead of generating a new one (on first invocation). |
|||
# |
|||
# Example of use: |
|||
# ssh-agent-refresh.sh |
|||
# if ( ssh-add -L | grep -q $USER ); then ssh-add -t 3600; fi |
|||
# |
|||
# Example with predefined SSH_AUTH_SOCK |
|||
# export SSH_AUTH_SOCK=/tmp/.ssh-agent-$USER |
|||
# ssh-agent-refresh.sh |
|||
# if ( ssh-add -L | grep -q $USER ); then ssh-add -t 3600; fi |
|||
# |
|||
# Example of output of ssh-agent -s: |
|||
# |
|||
# SSH_AUTH_SOCK=/tmp/ssh-VAjpOtefMI/agent.2112; export SSH_AUTH_SOCK; |
|||
# SSH_AGENT_PID=2568; export SSH_AGENT_PID; |
|||
# echo Agent pid 2568; |
|||
SSH_AGENT_PROCESS_NAME=ssh-agent |
|||
# Shell must be a login shell - for USER variable |
|||
if [ -z "$USER" ]; then |
|||
echo "ERROR! Environment variable USER not defined - you probably don't run a login shell" |
|||
exit 4 |
|||
fi |
|||
# First see check that at most one instance of ssh-agent is running. |
|||
SSH_AGENT_COUNT=`ps -u $USER | grep -c "[/ ]${SSH_AGENT_PROCESS_NAME}\$"` |
|||
if [ $SSH_AGENT_COUNT -gt 1 ]; then |
|||
echo "ERROR! Several ssh-agent processes are running">/dev/stderr |
|||
exit 3 |
|||
fi |
|||
# Third launch a new ssh-agent if none is running. We use variable SSH_AUTH_SOCK if defined |
|||
if [ $SSH_AGENT_COUNT -eq 0 ]; then |
|||
# Remove old /tmp/ssh-* directory if no ssh-agent process is running |
|||
rm -rf /tmp/ssh-* |
|||
if [ $SSH_AUTH_SOCK ]; then |
|||
ssh-agent -a "$SSH_AUTH_SOCK" -s |
|||
else |
|||
ssh-agent -s |
|||
fi |
|||
exit 1 |
|||
fi |
|||
# Fourth, find back ssh-agent-pid We use the blob below because pidof doesn't filter based on process UID |
|||
SSH_AGENT_PID=`ps -u $USER | grep "[/ ]$SSH_AGENT_PROCESS_NAME$" | sed -r 's/^ *([0-9]*) .*$/\1/'` |
|||
# Finally find the socket that the running ssh-agent is attached to. We reuse variable SSH_AUTH_SOCK if it is defined. |
|||
if [ ! $SSH_AUTH_SOCK ]; then |
|||
SSH_AUTH_SOCK=`find /tmp -type s -user $USER -path "/tmp/ssh-*/agent.*"` |
|||
else |
|||
if [ -x "$SSH_AUTH_SOCK" ]; then |
|||
echo "ssh-agent process found (pid $SSH_AGENT_PID), but given socket does not exist ($SSH_AUTH_SOCK)!">/dev/stderr |
|||
exit 2 |
|||
fi |
|||
fi |
|||
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK; export SSH_AUTH_SOCK;" |
|||
echo "SSH_AGENT_PID=$SSH_AGENT_PID; export SSH_AGENT_PID;" |
|||
echo "echo Agent pid $SSH_AGENT_PID;" |
|||
exit 0 |
|||
</source> |
|||
}} }} |
|||
=== Directory /home/beq06659 === |
|||
'''.bashrc''' - Everything before <tt>#### CUSTOMIZATION</tt> is the original file. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/|.bashrc|<source lang=bash class=".bashrc"> |
|||
# ~/.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 |
|||
[ -z "$PS1" ] && return |
|||
# don't put duplicate lines in the history. See bash(1) for more options |
|||
# don't overwrite GNU Midnight Commander's setting of `ignorespace'. |
|||
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups |
|||
# ... or force ignoredups and ignorespace |
|||
export 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) |
|||
# check the window size after each command and, if necessary, |
|||
# update the values of LINES and COLUMNS. |
|||
shopt -s checkwinsize |
|||
# make less more friendly for non-text input files, see lesspipe(1) |
|||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" |
|||
# 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 |
|||
# set a fancy prompt (non-color, unless we know we "want" color) |
|||
case "$TERM" in |
|||
xterm-color) color_prompt=yes;; |
|||
esac |
|||
# uncomment for a colored prompt, if the terminal has the capability; turned |
|||
# off by default to not distract the user: the focus in a terminal window |
|||
# should be on the output of commands, not on the prompt |
|||
#force_color_prompt=yes |
|||
if [ -n "$force_color_prompt" ]; then |
|||
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=yes |
|||
else |
|||
color_prompt= |
|||
fi |
|||
fi |
|||
if [ "$color_prompt" = yes ]; then |
|||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
|||
else |
|||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' |
|||
fi |
|||
unset color_prompt force_color_prompt |
|||
# If this is an xterm set the title to user@host:dir |
|||
case "$TERM" in |
|||
xterm*|rxvt*) |
|||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" |
|||
;; |
|||
*) |
|||
;; |
|||
esac |
|||
# 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 color support of ls and also add handy aliases |
|||
if [ -x /usr/bin/dircolors ]; then |
|||
eval "`dircolors -b`" |
|||
alias ls='ls --color=auto' |
|||
#alias dir='dir --color=auto' |
|||
#alias vdir='vdir --color=auto' |
|||
#alias grep='grep --color=auto' |
|||
#alias fgrep='fgrep --color=auto' |
|||
#alias egrep='egrep --color=auto' |
|||
fi |
|||
# some more ls aliases |
|||
#alias ll='ls -l' |
|||
#alias la='ls -A' |
|||
#alias l='ls -CF' |
|||
# 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 [ -f /etc/bash_completion ]; then |
|||
. /etc/bash_completion |
|||
fi |
|||
################################################################################ |
|||
##### CUSTOMIZATION ############################################################ |
|||
################################################################################ |
|||
#### ALIASES & FUNCTIONS |
|||
######################## |
|||
# Read colors from .dircolors.cfg |
|||
if [ -x /usr/bin/dircolors -a -a ~/.dircolors.cfg ]; then |
|||
eval `dircolors -b ~/.dircolors.cfg` |
|||
alias ls='ls -F --color=auto --group-directories-first' |
|||
else |
|||
alias ls='ls -F --group-directories-first' |
|||
fi |
|||
alias df='df -h' |
|||
alias du='du -h' |
|||
alias grep='grep --color' # show matched string in colour |
|||
alias egrep='egrep --color' # show matched string in colour |
|||
alias fgrep='fgrep --color' # show matched string in colour |
|||
alias l='ls -l' # long list |
|||
alias la='ls -A' # all but . and .. |
|||
alias ll='ls -Al' |
|||
alias lla="ls -al" |
|||
alias ls-l='ls -l' |
|||
alias dua="du -sh * .*" |
|||
alias dfh="df -h" |
|||
alias dir='ls --format=vertical' |
|||
alias vdir='ls --format=long' |
|||
function sorttag() |
|||
{ |
|||
TAGS="$*" |
|||
echo $TAGS | sed "s/ /\n/g" | sort | (for i in `cat`; do MYVAR="$MYVAR $i"; done; echo $MYVAR) >/dev/clipboard |
|||
cat /dev/clipboard |
|||
} |
|||
alias st=sorttag |
|||
#### SSH |
|||
######################## |
|||
alias ssha="ssh andlinux" |
|||
alias sshn="ssh -t noekeon" |
|||
alias sshg="ssh gryphon" |
|||
alias sftpn="sftp daemenj@ftp.noekeon.org" |
|||
# function scpg - Copy file from/to gryphon |
|||
# USAGE: scpg src-local-file-path @/dest-remote-file-path |
|||
# scpg @/src-remote-file-path dest-local-file-path |
|||
function scpg() { |
|||
SRC=`echo $1|sed 's!@!gryphon:/home/baddreams!'`; |
|||
DST=`echo $2|sed 's!@!gryphon:/home/baddreams!'`; |
|||
scp "$SRC" "$DST"; |
|||
} |
|||
# function scpa - Copy file from/to andlinux |
|||
# USAGE: scpa src-local-file-path @/dest-remote-file-path |
|||
# scpa @/src-remote-file-path dest-local-file-path |
|||
function scpa() { |
|||
SRC=`echo $1|sed 's!@!andlinux:/home/beq06659!'`; |
|||
DST=`echo $2|sed 's!@!andlinux:/home/beq06659!'`; |
|||
scp "$SRC" "$DST"; |
|||
} |
|||
# function scpn - Copy file from/to remote noekeon.org priorweb |
|||
# USAGE: scpn src-local-file-path @/dest-remote-file-path |
|||
# scpn @/src-remote-file-path dest-local-file-path |
|||
function scpn() { |
|||
SRC=`echo $1|sed 's!@!daemenj@noekeon:/opt/www/daemenj/web/private!'`; |
|||
DST=`echo $2|sed 's!@!daemenj@noekeon:/opt/www/daemenj/web/private!'`; |
|||
scp "$SRC" "$DST"; |
|||
} |
|||
# function scpnup - Copy file from/to remote Miki Wiki's upload directory |
|||
# USAGE: scpn src-local-file-path @/dest-remote-file-path |
|||
# scpn @/src-remote-file-path dest-local-file-path |
|||
function scpnup() { |
|||
SRC=`echo $1|sed 's!@!daemenj@noekeon:/opt/www/daemenj/web/kiwi.noekeon.org/miki/upload!'`; |
|||
DST=`echo $2|sed 's!@!daemenj@noekeon:/opt/www/daemenj/web/kiwi.noekeon.org/miki/upload!'`; |
|||
scp "$SRC" "$DST"; |
|||
} |
|||
#### NETWORK |
|||
######################## |
|||
# NXP network settings |
|||
#proxy is a synonym but less portable because likely only valid in NXP Leuven |
|||
#alias nxp="export http_proxy=http://proxy:8080/; export ftp_proxy=http://proxy:8080/" |
|||
alias nxp="cp ~/.ssh/config-nxp ~/.ssh/config; export http_proxy=http://emea.nics.nxp.com:8080/; export ftp_proxy=\$http_proxy" |
|||
# HOME network settings |
|||
alias home="cp ~/.ssh/config-home ~/.ssh/config" |
|||
# TUNNEL network settings |
|||
alias tunnel="cp ~/.ssh/config-tunnel ~/.ssh/config" |
|||
#### CUSTOMIZATION |
|||
######################## |
|||
# Set a default prompt of: user@host and current_directory |
|||
PS1='\[\e]0;\w\a\]\n\[\e[0m\e[35m\]\u@\h \[\e[0m\e[33m\]\w\[\e[0m\]\n\$ ' |
|||
export PS1 |
|||
</source> |
|||
}} }} |
|||
'''.dircolors.cfg''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/|.dircolors.cfg|<source lang=text class=".dircolors.cfg"> |
|||
# Configuration file for dircolors, a utility to help you set the |
|||
# LS_COLORS environment variable used by GNU ls with the --color option. |
|||
# Copyright (C) 1996, 1999-2008 |
|||
# Free Software Foundation, Inc. |
|||
# Copying and distribution of this file, with or without modification, |
|||
# are permitted provided the copyright notice and this notice are preserved. |
|||
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the |
|||
# slackware version of dircolors) are recognized but ignored. |
|||
# Below, there should be one TERM entry for each termtype that is colorizable |
|||
TERM Eterm |
|||
TERM ansi |
|||
TERM color-xterm |
|||
TERM con132x25 |
|||
TERM con132x30 |
|||
TERM con132x43 |
|||
TERM con132x60 |
|||
TERM con80x25 |
|||
TERM con80x28 |
|||
TERM con80x30 |
|||
TERM con80x43 |
|||
TERM con80x50 |
|||
TERM con80x60 |
|||
TERM cons25 |
|||
TERM console |
|||
TERM cygwin |
|||
TERM dtterm |
|||
TERM eterm-color |
|||
TERM gnome |
|||
TERM gnome-256color |
|||
TERM konsole |
|||
TERM kterm |
|||
TERM linux |
|||
TERM linux-c |
|||
TERM mach-color |
|||
TERM mlterm |
|||
TERM putty |
|||
TERM rxvt |
|||
TERM rxvt-cygwin |
|||
TERM rxvt-cygwin-native |
|||
TERM rxvt-unicode |
|||
TERM screen |
|||
TERM screen-256color |
|||
TERM screen-bce |
|||
TERM screen-w |
|||
TERM screen.linux |
|||
TERM vt100 |
|||
TERM xterm |
|||
TERM xterm-16color |
|||
TERM xterm-256color |
|||
TERM xterm-88color |
|||
TERM xterm-color |
|||
TERM xterm-debian |
|||
# Below are the color init strings for the basic file types. A color init |
|||
# string consists of one or more of the following numeric codes: |
|||
# Attribute codes: |
|||
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed |
|||
# Text color codes: |
|||
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white |
|||
# Background color codes: |
|||
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white |
|||
NORMAL 00 # global default, although everything should be something. |
|||
FILE 00 # normal file |
|||
DIR 01;34 # directory |
|||
LINK 36 # symbolic link. (If you set this to 'target' instead of a |
|||
# numerical value, the color is as for the file pointed to.) |
|||
FIFO 40;33 # pipe |
|||
SOCK 35 # socket |
|||
DOOR 35 # door |
|||
BLK 40;33;01 # block device driver |
|||
CHR 40;33;01 # character device driver |
|||
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file |
|||
SETUID 37;41 # file that is setuid (u+s) |
|||
SETGID 30;43 # file that is setgid (g+s) |
|||
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) |
|||
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky |
|||
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable |
|||
# This is for files with execute permission: |
|||
EXEC 32;04 |
|||
# List any file extensions like '.gz' or '.tar' that you would like ls |
|||
# to colorize below. Put the extension, a space, and the color init string. |
|||
# (and any comments you want to add after a '#') |
|||
# If you use DOS-style suffixes, you may want to uncomment the following: |
|||
#.cmd 01;32 # executables (bright green) |
|||
#.exe 01;32 |
|||
#.com 01;32 |
|||
#.btm 01;32 |
|||
#.bat 01;32 |
|||
# Or if you want to colorize scripts even if they do not have the |
|||
# executable bit actually set. |
|||
#.sh 01;32 |
|||
#.csh 01;32 |
|||
# archives or compressed (bright red) |
|||
.tar 01;31 |
|||
.tgz 01;31 |
|||
.svgz 01;31 |
|||
.arj 01;31 |
|||
.taz 01;31 |
|||
.lzh 01;31 |
|||
.lzma 01;31 |
|||
.zip 01;31 |
|||
.z 01;31 |
|||
.Z 01;31 |
|||
.dz 01;31 |
|||
.gz 01;31 |
|||
.bz2 01;31 |
|||
.bz 01;31 |
|||
.tbz2 01;31 |
|||
.tz 01;31 |
|||
.deb 01;31 |
|||
.rpm 01;31 |
|||
.jar 01;31 |
|||
.rar 01;31 |
|||
.ace 01;31 |
|||
.zoo 01;31 |
|||
.cpio 01;31 |
|||
.7z 01;31 |
|||
.rz 01;31 |
|||
# image formats |
|||
.jpg 35 |
|||
.jpeg 35 |
|||
.gif 35 |
|||
.bmp 35 |
|||
.pbm 35 |
|||
.pgm 35 |
|||
.ppm 35 |
|||
.tga 35 |
|||
.xbm 35 |
|||
.xpm 35 |
|||
.tif 35 |
|||
.tiff 35 |
|||
.png 35 |
|||
.svg 35 |
|||
.mng 35 |
|||
.pcx 35 |
|||
.mov 35 |
|||
.mpg 35 |
|||
.mpeg 35 |
|||
.m2v 35 |
|||
.mkv 35 |
|||
.ogm 35 |
|||
.mp4 35 |
|||
.m4v 35 |
|||
.mp4v 35 |
|||
.vob 35 |
|||
.qt 35 |
|||
.nuv 35 |
|||
.wmv 35 |
|||
.asf 35 |
|||
.rm 35 |
|||
.rmvb 35 |
|||
.flc 35 |
|||
.avi 35 |
|||
.fli 35 |
|||
.gl 35 |
|||
.dl 35 |
|||
.xcf 35 |
|||
.xwd 35 |
|||
.yuv 35 |
|||
# audio formats |
|||
.aac 00;36 |
|||
.au 00;36 |
|||
.flac 00;36 |
|||
.mid 00;36 |
|||
.midi 00;36 |
|||
.mka 00;36 |
|||
.mp3 00;36 |
|||
.mpc 00;36 |
|||
.ogg 00;36 |
|||
.ra 00;36 |
|||
.wav 00;36 |
|||
</source> |
|||
}} }} |
|||
'''.inputrc''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/|.inputrc|<source lang=bash class=".inputrc"> |
|||
# |
|||
# MIP CUSTOM BINDING STARTS HERE |
|||
# |
|||
# Allow 8-bit input/output (for Cygwin) |
|||
set meta-flag on |
|||
set convert-meta off |
|||
set input-meta on |
|||
set output-meta on |
|||
$if Bash |
|||
# Don't ring bell on completion |
|||
#set bell-style none |
|||
# or, don't beep at me - show me |
|||
#set bell-style visible |
|||
# |
|||
# If set to on, words which have more than one possible completion without |
|||
# any possible partial completion cause the matches to be listed immediately |
|||
# instead of ringing the bell. |
|||
# |
|||
set show-all-if-unmodified on |
|||
# |
|||
# If set to on, words which have more than one possible completion cause the |
|||
# matches to be listed immediately instead of ringing the bell. |
|||
# |
|||
set show-all-if-ambiguous on |
|||
# Expand homedir name |
|||
#set expand-tilde on |
|||
# Append "/" to all dirnames |
|||
#set mark-directories on |
|||
#set mark-symlinked-directories on |
|||
# Match all files |
|||
#set match-hidden-files on |
|||
# 'Magic Space' |
|||
# Insert a space character then performs |
|||
# a history expansion in the line |
|||
Space: magic-space |
|||
$endif |
|||
"\eOA":history-search-backward #Up arrow |
|||
"\e[A":history-search-backward #Up arrow |
|||
"\eOB":history-search-forward #Down arrow |
|||
"\e[B":history-search-forward #Down arrow |
|||
"\C- ":dynamic-complete-history #Ctrl-space |
|||
"\e ":dynamic-complete-history #Esc-space |
|||
</source> |
|||
}} }} |
|||
'''.profile''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/|.profile|<source lang=bash class=".profile"> |
|||
# ~/.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 |
|||
# SSH settings |
|||
############## |
|||
eval `ssh-agent-refresh.sh` >/dev/null |
|||
</source> |
|||
}} }} |
|||
'''.vimrc''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/|.vimrc|<source lang=text class=".vimrc"> |
|||
syntax enable |
|||
set bg=light |
|||
set number |
|||
set bs=2 |
|||
nnoremap j h |
|||
nnoremap k j |
|||
nnoremap l k |
|||
nnoremap m l |
|||
nnoremap h m |
|||
vnoremap j h |
|||
vnoremap k j |
|||
vnoremap l k |
|||
vnoremap m l |
|||
vnoremap h m |
|||
set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab |
|||
set autoindent |
|||
"set smartindent |
|||
"set cindent |
|||
"set cinkeys=0{,0},:,0#,!,!^F |
|||
inoremap <expr> <C-L> pumvisible() \|\| &omnifunc == '' ? |
|||
\ "\<lt>C-n>" : |
|||
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" . |
|||
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" . |
|||
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>" |
|||
"Press Ctrl-Space instead of ESC (because Shift-Space only work in GUI). |
|||
"See http://vim.wikia.com/wiki/Avoid_the_escape_key |
|||
"- nnoremap causes Ctrl-Space to cancel any prefix keys |
|||
nnoremap <nul> <Esc> |
|||
"- vnoremap causes Ctrl-Space to cancel any selection (gV is required to prevent automatic reselection) |
|||
vnoremap <nul> <Esc>gV |
|||
"- onoremap causes Ctrl-Space to cancel any operator pending commands (like y) |
|||
onoremap <nul> <Esc> |
|||
"- inoremap causes Ctrl-Space to exit insert mode and `^ restore cursor position (cursor does not move left) |
|||
inoremap <nul> <Esc>`^ |
|||
" function! CleverTab() |
|||
" if pumvisible() |
|||
" return "\<C-N>" |
|||
" endif |
|||
" let line=strpart( getline('.'), 0, col('.')-1 ) |
|||
" if !(line =~ '^.*[a-zA-Z0-1_]$') "completion only if last char is a word char |
|||
" return "\<Tab>" |
|||
" elseif exists('&omnifunc') && &omnifunc != '' |
|||
" return "\<C-X>\<C-O>" |
|||
" else |
|||
" return "\<C-N>" |
|||
" endif |
|||
" endfunction |
|||
" inoremap <expr> <Tab> CleverTab() |
|||
</source> |
|||
}} }} |
|||
=== Directory /home/beq06659/.ssh === |
|||
'''config-home''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/.ssh/|config-home|<source lang=text class="config-home"> |
|||
# ~/.ssh/config-home |
# ~/.ssh/config-home |
||
Host ftp.noekeon.org noekeon |
Host ftp.noekeon.org noekeon |
||
User daemenj |
|||
HostName ftp.noekeon.org |
|||
ProxyCommand none |
|||
Host |
Host andlinux |
||
User beq06659 |
|||
HostName andlinux |
|||
ProxyCommand none |
|||
Host gryphon |
|||
User baddreams |
|||
HostName gryphon |
|||
ProxyCommand none |
|||
Host |
Host leviathan |
||
User mich |
|||
User baddreams |
|||
HostName leviathan |
|||
ProxyCommand none |
|||
Host * |
Host * |
||
ProxyCommand none |
|||
ServerAliveInterval 15 |
|||
ServerAliveInterval 15 |
|||
</pre> |
|||
</source> |
|||
=== ~/.ssh/config-nxp === |
|||
}} }} |
|||
Download [{{#file: config-nxp}} this file]. |
|||
'''config-nxp''' |
|||
<pre> |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/.ssh/|config-nxp|<source lang=text class="config-nxp"> |
|||
# ~/.ssh/config-nxp |
# ~/.ssh/config-nxp |
||
Host ftp.noekeon.org noekeon |
Host ftp.noekeon.org noekeon |
||
User daemenj |
|||
HostName ftp.noekeon.org |
|||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q -f - - %h %p |
|||
#TEST-To prevent disconnect if network down... |
|||
TCPKeepAlive no |
|||
# ProxyCommand /usr/local/bin/ssh-tunnel.pl -f - - %h %p |
|||
Proxycommand /bin/bash -c 'exec 3<>/dev/tcp/emea.nics.nxp.com/8080;echo -n -e "CONNECT %h:%p HTTP/1.0\r\n\r\n" >&3; read -n 39 <&3; echo -n -e "SSH-2.0-OpenSSH_5.1\r\n" >&3; head -c 50 <&3; read -n 21; exec /usr/local/bin/multitee 0:3 3:1' |
|||
###### EXPERIMENTS: |
|||
# Proxycommand /bin/bash -c 'exec 3<>/dev/tcp/emea.nics.nxp.com/8080;echo -n -e "CONNECT %h:%p HTTP/1.0\r\n\r\n" >&3; read -n 39 <&3; cat ~/.ssh/clbanner.txt >&3; head -c 50 <&3; read -n $(stat -c %%s ~/.ssh/clbanner.txt); exec /usr/local/bin/socat - FD:3' |
|||
Host noekeonsshtunnel |
|||
User daemenj |
|||
HostName ftp.noekeon.org |
|||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q -f - - %h %p |
|||
Host andlinux |
Host andlinux |
||
User beq06659 |
|||
HostName andlinux |
|||
ProxyCommand none |
|||
Host gryphon |
Host gryphon |
||
User baddreams |
|||
HostName gryphon |
|||
ProxyCommand none |
|||
Host leviathan |
|||
User mich |
|||
HostName leviathan |
|||
ProxyCommand none |
|||
Host * |
Host * |
||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q - - %h %p |
|||
ServerAliveInterval 15 |
|||
Proxycommand /bin/bash -c 'exec 3<>/dev/tcp/emea.nics.nxp.com/8080;echo -n -e "CONNECT %h:%p HTTP/1.0\r\n\r\n" >&3; read -n 39 <&3; echo -n -e "SSH-2.0-OpenSSH_5.1\r\n" >&3; head -c 50 <&3; read -n 21; exec /usr/local/bin/socat - FD:3' |
|||
ServerAliveInterval 15 |
|||
</pre> |
|||
</source> |
|||
=== ~/.ssh/config-tunnel === |
|||
}} }} |
|||
Download [{{#file: config-nxp}} this file]. |
|||
'''config-nxp_auth''' - symlinked to <tt>config-nxp</tt> |
|||
<pre> |
|||
# ~/.ssh/config-tunnel |
|||
'''config-nxp_direct''' - symlinked to <tt>config-nxp</tt> |
|||
Host ftp.noekeon.org noekeon |
|||
User daemenj |
|||
HostName ftp.noekeon.org |
|||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q -f - - %h %p |
|||
'''proxy.conf-default''' |
|||
Host noekeonsshtunnel |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/.ssh/|proxy.conf-default|<source lang=text class="proxy.conf-default"> |
|||
User daemenj |
|||
# SSH Tunnel configuration file. |
|||
HostName ftp.noekeon.org |
|||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q -f - - %h %p |
|||
# Section: OPTIONS |
|||
Host andlinux |
|||
[option-section] |
|||
User beq06659 |
|||
debug=0 |
|||
HostName andlinux |
|||
dry=0 |
|||
ProxyCommand none |
|||
icmp=0 |
|||
sshping=1 |
|||
timeout=1 |
|||
# Section: PROXY |
|||
Host gryphon gryphon |
|||
[proxy2-section] |
|||
User baddreams |
|||
HostName gryphon |
|||
#=== Philips gateway & proxy ======== |
|||
Host * |
|||
130.145.67/24 proxy.adc-itcl.ce.philips.com:8080 -C ~/.ssh/clbanner.txt |
|||
ProxyCommand /usr/local/bin/ssh-tunnel.pl -q - - %h %p |
|||
ServerAliveInterval 15 |
|||
#=== NXP Proxy - on DELL/WinXP ====================== |
|||
</pre> |
|||
#proxy is a synonym - but not portable because it might only work at Leuven... |
|||
134.27.180/22 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt |
|||
#=== NXP Proxy - Caen - on DELL/WinXP ====================== |
|||
134.27.248/21 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt -u=beq06659 -p=oiuOIUoiuOIUoiu9 |
|||
#=== NXP Proxy - on DELL/AndLinux ====================== |
|||
#proxy is a synonym - but not portable because it might only work at Leuven... |
|||
10.0.2.2/32 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt |
|||
</source> |
|||
}} }} |
|||
'''proxy.conf-home''' - symlinked to <tt>proxy.conf-default</tt> |
|||
'''proxy.conf-nxp''' - symlinked to <tt>proxy.conf-default</tt> |
|||
'''proxy.conf-nxp_auth''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/.ssh/|proxy.conf-nxp_auth|<source lang=text class="proxy.conf-nxp_auth"> |
|||
Download [{{#file: proxy.conf}} this file]. |
|||
<pre> |
|||
# SSH Tunnel configuration file. |
# SSH Tunnel configuration file. |
||
Line 139: | Line 870: | ||
#=== NXP Proxy - on DELL/WinXP ====================== |
#=== NXP Proxy - on DELL/WinXP ====================== |
||
#proxy is a synonym - but not portable because it might only work at Leuven... |
#proxy is a synonym - but not portable because it might only work at Leuven... |
||
#134.27.180/22 proxy:8080 -C ~/.ssh/clbanner.txt |
|||
134.27.180/22 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt |
134.27.180/22 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt |
||
#=== NXP Proxy - Caen - on DELL/WinXP ====================== |
|||
134.27.248/21 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt -u=beq06659 -p=**************** |
|||
#=== NXP Proxy - on DELL/AndLinux ====================== |
#=== NXP Proxy - on DELL/AndLinux ====================== |
||
#proxy is a synonym - but not portable because it might only work at Leuven... |
#proxy is a synonym - but not portable because it might only work at Leuven... |
||
10.0.2.2/32 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt -u=beq06659 -p=**************** |
|||
10.0.2.2/32 emea.nics.nxp.com:8080 -C ~/.ssh/clbanner.txt |
|||
</ |
</source> |
||
}} }} |
|||
'''config-home-nxp_direct''' - symlinked to <tt>config-default</tt> |
|||
=== Directory /home/beq06659/bin === |
|||
'''backup_main''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|backup_main|<source lang=bash class="backup_main"> |
|||
#! /bin/bash |
|||
# This script will create a backup of the miki wiki database on noekeon.org |
|||
# Helper functions |
|||
# |
|||
# These functions assume that the following env. variables are defined: |
|||
# |
|||
# THISDAY |
|||
# THISWEEK |
|||
# THISMONTH |
|||
# THISYEAR |
|||
# NEXTDAILY |
|||
# NEXTWEEKLY |
|||
# NEXTMONTHLY |
|||
# NEXTYEARLY |
|||
# BACKUPPREFIX |
|||
# BACKUPID |
|||
# BACKUPEXT |
|||
# BACKUPCMD |
|||
# BACKUPDIR |
|||
if [ -n "$1" ]; then |
|||
BACKUP_DEF_FILE=$1 |
|||
else |
|||
echo "Usage: $0 backup-definition-file" |
|||
echo |
|||
echo "Format of backup-definition-file: one or more entry as follows, separated by empty lines." |
|||
echo |
|||
echo " BACKUPPREFIX=prefix_of_all_backup_files_for_this_entry" |
|||
echo " BACKUPID=some_id_used_to_generate_backup_file_name" |
|||
echo " BACKUPEXT=sql.gz" |
|||
echo " BACKUPCMD=\"... some command generating the backup data to standard output ... \"" |
|||
exit 1 |
|||
fi |
|||
if [ "$2" == "--force" ]; then |
|||
FORCE_DAILY=1 |
|||
fi |
|||
function makeweekly() |
|||
{ |
|||
local FNAMENEW=${FNAMEBASE}.weekly.${BACKUPEXT} |
|||
echo "Creating backup file '${FNAMENEW}'..." |
|||
cp $FNAMEDAILY ${FNAMENEW} |
|||
NEXTWEEKLY=$((THISWEEK+1)) # This will overflow but 201001 > 200954 so it's ok |
|||
} |
|||
function makemonthly() |
|||
{ |
|||
local FNAMENEW=${FNAMEBASE}.monthly.${BACKUPEXT} |
|||
echo "Creating backup file '${FNAMENEW}'..." |
|||
cp $FNAMEDAILY ${FNAMENEW} |
|||
NEXTMONTHLY=$((THISMONTH+1)) # This will overflow but 201001 > 200913 so it's ok |
|||
} |
|||
function makeyearly() |
|||
{ |
|||
local FNAMENEW=${FNAMEBASE}.yearly.${BACKUPEXT} |
|||
echo "Creating backup file '${FNAMENEW}'..." |
|||
cp $FNAMEDAILY ${FNAMENEW} |
|||
NEXTYEARLY=$((THISYEAR+1)) |
|||
} |
|||
function rmoldest() |
|||
{ |
|||
local SUFFIX=$1 |
|||
local NBR=$2 |
|||
#Count files |
|||
file_count=$(ls ${BACKUPDIR}/*${SUFFIX}| wc -l) |
|||
#Delete files while we have more than $NBR |
|||
while [ $file_count -gt $NBR ] |
|||
do |
|||
#Delete alphabetically oldest file (ls sort by name is default) |
|||
rm $(ls ${BACKUPDIR}/*${SUFFIX} | head -n 1) |
|||
#Count files again |
|||
file_count=$(ls ${BACKUPDIR}/*${SUFFIX}| wc -l) |
|||
done |
|||
} |
|||
function create-backups() |
|||
{ |
|||
# Some environment variables |
|||
BACKUPDIR=~/backup |
|||
BACKUPRC=~/.backup-${BACKUPID}.${BACKUPEXT}.rc |
|||
THISDAY=$(date '+%Y%j') |
|||
THISWEEK=$(date '+%Y%V') |
|||
THISMONTH=$(date '+%Y%m') |
|||
THISYEAR=$(date '+%Y') |
|||
#======================================================== |
|||
# Read resource file |
|||
#======================================================== |
|||
if [ -a $BACKUPRC ] |
|||
then |
|||
# ! HOMEDIR must be chmod 755 at most, and $BACKUPRC chmod 644 at most |
|||
. $BACKUPRC |
|||
else |
|||
# Resource file doesn't exist, let's use default value |
|||
NEXTDAILY=$THISDAY # Next daily is this day by default |
|||
NEXTWEEKLY=$THISWEEK # Next weekly is this week by default |
|||
NEXTMONTHLY=$THISMONTH # Next monthly is this month by default |
|||
NEXTYEARLY=$THISYEAR # Next yearly is this year by default |
|||
fi |
|||
#We exit immediately if script was already run today... |
|||
[ $THISDAY -ge $NEXTDAILY -o -n "$FORCE_DAILY" ] || return 0 |
|||
#======================================================== |
|||
# DAILY backup |
|||
#======================================================== |
|||
echo "Creating backup for:" |
|||
echo " BACKUPPREFIX=$BACKUPPREFIX" |
|||
echo " BACKUPID=$BACKUPID" |
|||
echo " BACKUPEXT=$BACKUPEXT" |
|||
echo " BACKUPCMD=$BACKUPCMD" |
|||
# Some environment variables |
|||
FNAMEBASE=${BACKUPDIR}/${BACKUPPREFIX}-$(date '+%Y%m%d')-${BACKUPID} |
|||
FNAMEDAILY=${FNAMEBASE}.daily.${BACKUPEXT} |
|||
#First we need to restore the ssh-agent context, if any |
|||
eval $(/usr/local/bin/ssh-agent-refresh.sh) > /dev/null |
|||
#Create backup parent directory |
|||
mkdir -p $BACKUPDIR |
|||
#We create the daily backup file |
|||
echo "Creating the daily backup file '$FNAMEDAILY'..." |
|||
eval $BACKUPCMD > "$FNAMEDAILY" |
|||
if ! [ $? -eq 0 -a -s "$FNAMEDAILY" ]; then |
|||
echo "... Backup failed! Exiting..." |
|||
rm "$FNAMEDAILY" |
|||
return 1 |
|||
fi |
|||
NEXTDAILY=$((THISDAY+1)) # This will overflow but 2010001 > 2009367 so it's ok |
|||
#======================================================== |
|||
# WEEKLY / MONTHLY / YEARLY backups |
|||
#======================================================== |
|||
#Now, depending on current date, we'll create weekly, monthly or yearly backups... |
|||
[ $THISWEEK -ge $NEXTWEEKLY ] && makeweekly |
|||
[ $THISMONTH -ge $NEXTMONTHLY ] && makemonthly |
|||
[ $THISYEAR -ge $NEXTYEARLY ] && makeyearly |
|||
#Now let's delete the oldest backups |
|||
rmoldest "-${BACKUPID}.daily.${BACKUPEXT}" "3" |
|||
rmoldest "-${BACKUPID}.weekly.${BACKUPEXT}" "3" |
|||
rmoldest "-${BACKUPID}.monthly.${BACKUPEXT}" "3" |
|||
rmoldest "-${BACKUPID}.yearly.${BACKUPEXT}" "3" |
|||
#Finally we update our resource file |
|||
umask 022 |
|||
echo "NEXTDAILY=${NEXTDAILY}" >$BACKUPRC |
|||
echo "NEXTWEEKLY=${NEXTWEEKLY}" >>$BACKUPRC |
|||
echo "NEXTMONTHLY=${NEXTMONTHLY}" >>$BACKUPRC |
|||
echo "NEXTYEARLY=${NEXTYEARLY}" >>$BACKUPRC |
|||
} |
|||
#Creates the backup for each entry in the backup definition file |
|||
while read -u 3 LINE; do |
|||
if [ -z "$LINE" ]; then |
|||
BACKUPPREFIX= |
|||
BACKUPID= |
|||
BACKUPEXT= |
|||
BACKUPCMD= |
|||
else |
|||
eval $LINE |
|||
[ -n "$BACKUPPREFIX" ] && [ -n "$BACKUPID" ] && [ -n "$BACKUPEXT" ] && [ -n "$BACKUPCMD" ] && create-backups |
|||
fi |
|||
done 3< $BACKUP_DEF_FILE |
|||
</source> |
|||
}} }} |
|||
'''generate_wiki_config_file_page.sh''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|generate_wiki_config_file_page.sh|<source lang=bash class="generate_wiki_config_file_page.sh"> |
|||
#! /bin/bash |
|||
function wikify_directory() |
|||
{ |
|||
DIRECTORY="$1" |
|||
cd $DIRECTORY |
|||
echo "=== Directory $DIRECTORY ===" |
|||
} |
|||
function wikify_config_stdin() |
|||
{ |
|||
local FILE="$1" |
|||
local TAGTYPE=source |
|||
local LANG="$2" |
|||
local DESCRIPTION="$3" |
|||
if [ -n "$DESCRIPTION" ]; then |
|||
echo -e "'''$FILE''' - $DESCRIPTION" |
|||
else |
|||
echo "'''$FILE'''" |
|||
fi |
|||
if [ -n "$LANG" ]; then |
|||
echo "{{pl2|{{hiddenSourceFile|$DIRECTORY/|$FILE|<$TAGTYPE lang="$LANG" class=\"$FILE\">" |
|||
else |
|||
echo "{{pl2|{{hiddenSourceFile|$DIRECTORY/|$FILE|<$TAGTYPE class=\"$FILE\">" |
|||
fi |
|||
cat |
|||
echo "</$TAGTYPE>" |
|||
echo "}} }}" |
|||
} |
|||
function wikify_config_file() |
|||
{ |
|||
cat $DIRECTORY/"$1" | wikify_config_stdin "$1" "$2" "$3" |
|||
} |
|||
echo "== AndLinux files ==" |
|||
#echo "<small>Last generated on '''$(date)''' with script '''$0''' on host '''$HOSTNAME'''</small>" |
|||
echo "<small>Generated with script '''$0''' on host '''$HOSTNAME'''</small>" |
|||
echo |
|||
wikify_directory /etc |
|||
wikify_config_file fstab text |
|||
wikify_directory /etc/privoxy |
|||
wikify_config_file set-network-config bash "This file must be '''chmod 755'''. Also the following line must be added to <tt>/etc/sudoers</tt>: |
|||
:<code> ALL ALL=(ALL) NOPASSWD: /etc/privoxy/set-network-config </code>" |
|||
diff -u config.original config-home | wikify_config_stdin config-home.patch diff |
|||
diff -u config-home config-nxp | wikify_config_stdin config-nxp.patch diff |
|||
echo "'''config-nxp_auth''' - symlinked to <tt>config-nxp</tt>" |
|||
echo |
|||
diff -u config-nxp config-nxp_direct | wikify_config_stdin config-nxp_direct.patch diff |
|||
wikify_directory /usr/local/bin |
|||
wikify_config_file be bash "This script would ideally require to add the following line to <tt>/etc/sudoers</tt>: |
|||
:<code>ALL ALL=(ALL) NOPASSWD: /bin/loadkeys</code>" |
|||
wikify_config_file ssh-agent-refresh.sh bash |
|||
wikify_directory ~ |
|||
wikify_config_file .bashrc bash "Everything before <tt>#### CUSTOMIZATION</tt> is the original file." |
|||
wikify_config_file .dircolors.cfg text |
|||
wikify_config_file .inputrc bash |
|||
wikify_config_file .profile bash |
|||
wikify_config_file .vimrc text |
|||
wikify_directory ~/.ssh |
|||
wikify_config_file config-home text |
|||
wikify_config_file config-nxp text |
|||
echo "'''config-nxp_auth''' - symlinked to <tt>config-nxp</tt>" |
|||
echo |
|||
echo "'''config-nxp_direct''' - symlinked to <tt>config-nxp</tt>" |
|||
echo |
|||
wikify_config_file proxy.conf-default text |
|||
echo "'''proxy.conf-home''' - symlinked to <tt>proxy.conf-default</tt>" |
|||
echo |
|||
echo "'''proxy.conf-nxp''' - symlinked to <tt>proxy.conf-default</tt>" |
|||
echo |
|||
wikify_config_file proxy.conf-nxp_auth text |
|||
echo "'''config-home-nxp_direct''' - symlinked to <tt>config-default</tt>" |
|||
echo |
|||
wikify_directory ~/bin |
|||
wikify_config_file backup_main bash "This file must be '''chmod 700'''." |
|||
wikify_config_file generate_wiki_config_file_page.sh bash "This file must be '''chmod 700'''." |
|||
wikify_config_file restore_wiki.sh bash "This file must be '''chmod 700'''." |
|||
wikify_config_file set-network.sh bash "This file must be '''chmod 700'''." |
|||
wikify_config_file sshproxy bash "This file must be '''chmod 700'''." |
|||
wikify_config_file startup.sh bash "This file must be '''chmod 700'''." |
|||
wikify_directory ~/etc |
|||
wikify_config_file backup_definition text |
|||
wikify_config_file crontab bash "Install this file with |
|||
:<code>crontab -u beq06659 ~/etc/crontab</code>" |
|||
</source> |
|||
}} }} |
|||
'''restore_wiki.sh''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|restore_wiki.sh|<source lang=bash class="restore_wiki.sh"> |
|||
#! /bin/bash |
|||
function restore_wiki() |
|||
{ |
|||
WIKI_DIR=$1 |
|||
# |
|||
# Restore the wiki backup locally - miki |
|||
# |
|||
HTML_ROOT=/data/www |
|||
SQL_BACKUP=$(ls ~/backup/*-www.noekeon.org_$WIKI_DIR.daily.sql.gz | tail -n 1) |
|||
TAR_BACKUP=$(ls ~/backup/*-www.noekeon.org_$WIKI_DIR.daily.tar.gz | tail -n 1) |
|||
WIKI_SETTINGS_FNAME="$HTML_ROOT/$WIKI_DIR/LocalSettings.php" |
|||
[ -a "$SQL_BACKUP" ] || return 1 |
|||
[ -a "$TAR_BACKUP" ] || return 1 |
|||
echo "Restoring TAR backup $TAR_BACKUP..." |
|||
echo |
|||
sudo rm -r "$HTML_ROOT/$WIKI_DIR" |
|||
cd "$HTML_ROOT" |
|||
sudo tar -xvzf "$TAR_BACKUP" >/dev/null |
|||
sudo chown $USER "$HTML_ROOT/$WIKI_DIR" |
|||
sudo chown $USER $WIKI_SETTINGS_FNAME |
|||
sed -i -r 's/(wgDBserver.*").*(")/\1localhost\2/' $WIKI_SETTINGS_FNAME |
|||
wgDBname=$(<"$WIKI_SETTINGS_FNAME" perl -lne 'print for /wgDBname.*"(.*)"/') |
|||
wgDBuser=$(<"$WIKI_SETTINGS_FNAME" perl -lne 'print for /wgDBuser.*"(.*)"/') |
|||
wgDBpassword=$(<"$WIKI_SETTINGS_FNAME" perl -lne 'print for /wgDBpassword.*"(.*)"/') |
|||
echo "Restoring SQL backup $SQL_BACKUP..." |
|||
echo |
|||
gunzip < "$SQL_BACKUP" | mysql -u "$wgDBuser" -p"$wgDBpassword" "$wgDBname" |
|||
sudo chown -R www-data "$WIKI_DIR" |
|||
sudo chgrp -R www-data "$WIKI_DIR" |
|||
} |
|||
restore_wiki miki |
|||
restore_wiki crypto |
|||
</source> |
|||
}} }} |
|||
'''set-network.sh''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|set-network.sh|<source lang=bash class="set-network.sh"> |
|||
#! /bin/bash |
|||
# Exit if no network name given or if no corresponding configuration file |
|||
NETWORK=$1 |
|||
[ -n "$NETWORK" ] || exit 1 |
|||
# Some logging... |
|||
echo -e "\t[$HOSTNAME] Running $(basename $0) '$NETWORK'..." 1>&2 |
|||
# Checked all needed files are present... |
|||
SSH_CONFIG_FILE=~/".ssh/config-$NETWORK" |
|||
if ! [ -a $SSH_CONFIG_FILE -a -a /etc/privoxy/config-$NETWORK ]; then |
|||
echo "ERROR! I don't know how to reconfigure network '$NETWORK'" 1>&2 |
|||
exit 255 |
|||
fi |
|||
#First we need to restore the ssh-agent context, if any |
|||
eval $(/usr/local/bin/ssh-agent-refresh.sh) > /dev/null |
|||
# Now let's reconfigure as needed... |
|||
if [ $NETWORK = "nxp_auth" ]; then |
|||
echo -e "\t!!! UPDATE PASSWORD AT ~/.ssh/proxy.conf AND RE-RUN THIS COMMAND !!!" |
|||
fi |
|||
~/bin/sshproxy stop |
|||
sleep 1 |
|||
ln -sf $SSH_CONFIG_FILE ~/.ssh/config |
|||
sudo /etc/privoxy/set-network-config "$NETWORK" |
|||
~/bin/sshproxy start |
|||
</source> |
|||
}} }} |
|||
'''sshproxy''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|sshproxy|<source lang=bash class="sshproxy"> |
|||
#! /bin/sh |
|||
# |
|||
# sshproxy Setup ssh port forwarding (imap) and SOCKS 5 proxy |
|||
# ssh connection is made persistent thanks to autossh |
|||
# |
|||
# Author: Michaël Peeters |
|||
# |
|||
# Prerequisite: ssh-agent must be running in background (autossh won't ask for password) |
|||
# |
|||
# chkconfig: 235 70 40 |
|||
# description: sshproxy startup script. |
|||
SUBSYS=sshproxy |
|||
TARGET=/usr/bin/autossh |
|||
BINDADDRESS=0.0.0.0 #0.0.0.0 external connection allowed; 127.0.0.1 only connection from localhost allowed |
|||
# Source function library. |
|||
#. /etc/rc.d/init.d/functions |
|||
# Some macros to make the below more readable |
|||
#PID_FILE=/var/run/$SUBSYS.pid |
|||
#LOCK_FILE=/var/lock/subsys/$SUBSYS |
|||
PID_FILE=~/.$SUBSYS.pid |
|||
LOCK_FILE=~/.$SUBSYS.lock |
|||
echo_success() |
|||
{ |
|||
echo "\t\t[OK ]" |
|||
} |
|||
echo_failure() |
|||
{ |
|||
echo "\t\t[FAILED]" |
|||
} |
|||
start() |
|||
{ |
|||
echo -n "Starting $SUBSYS:" |
|||
if [ -f $LOCK_FILE ]; then |
|||
RETVAL=1 |
|||
else |
|||
export AUTOSSH_PIDFILE=$PID_FILE |
|||
export AUTOSSH_POLL=300 |
|||
/usr/bin/autossh -M 0 -f -N -n -q -L ${BINDADDRESS}:9025:smtp.priorweb.be:25 -L ${BINDADDRESS}:9143:mail.priorweb.be:143 -L ${BINDADDRESS}:9026:mail.altranweb.be:25 -L ${BINDADDRESS}:9144:mail.altranweb.be:143 -D ${BINDADDRESS}:1080 noekeon |
|||
RETVAL=$? |
|||
fi |
|||
if [ $RETVAL -eq 0 ]; then |
|||
touch $LOCK_FILE |
|||
echo_success |
|||
else |
|||
echo_failure |
|||
fi |
|||
} |
|||
stop() |
|||
{ |
|||
# don't delete lock file while pid file not deleted |
|||
# don't delete pidfile while process is running |
|||
echo -n "Stopping $SUBSYS:" |
|||
status |
|||
case "$RETVAL" in |
|||
0) |
|||
( kill -TERM $pid || kill -KILL $pid ) >/dev/null |
|||
RETVAL=$? |
|||
;; |
|||
1) RETVAL=0;; |
|||
2) RETVAL=0;; |
|||
*) ;; |
|||
esac |
|||
if [ $RETVAL -eq 0 ]; then |
|||
rm -f $LOCK_FILE |
|||
rm -f $PID_FILE |
|||
echo_success |
|||
else |
|||
echo_failure |
|||
fi |
|||
} |
|||
status() |
|||
{ |
|||
# no lockfile --> (3) Not started. |
|||
# lockfile present, no pidfile --> (2) Started, but terminated |
|||
# lockfile & pidfile present, no process --> (1) Started, but killed |
|||
# lockfile, pidfile & process present --> (0) Started. |
|||
# -- note this is opposite order compared to status function, but support multiple autossh running concurrently |
|||
unset pid |
|||
read pid 2>/dev/null < $PID_FILE |
|||
if [ ! -f $LOCK_FILE ]; then |
|||
# /var/lock/subsys/$SUBSYS doesn't exist |
|||
RETVAL=3 |
|||
elif [ "$pid" = "" ] ; then |
|||
# lock file exists, but file "/var/run/*.pid" doesn't exist |
|||
RETVAL=2 |
|||
elif ( ! ps -p $pid | grep -q $pid ) ; then |
|||
# Both files exist but process is not running anymore... |
|||
RETVAL=1 |
|||
else |
|||
# Everything is fine |
|||
RETVAL=0 |
|||
fi |
|||
} |
|||
reload() |
|||
{ |
|||
read pid 2>/dev/null < $PID_FILE |
|||
kill -HUP $pid |
|||
RETVAL=$? |
|||
} |
|||
# See how we were called. |
|||
case "$1" in |
|||
start) |
|||
start |
|||
;; |
|||
stop) |
|||
stop |
|||
;; |
|||
status) |
|||
status |
|||
case "$RETVAL" in |
|||
0) |
|||
echo -n "$SUBSYS (pid $pid) is running" |
|||
if ( ps -fu $USER | grep -q " $pid .*/ssh " ) ; then echo " and connection is alive..."; else echo " but connection is dead..."; fi |
|||
;; |
|||
1) |
|||
echo "$SUBSYS dead but pid file exists" |
|||
;; |
|||
2) |
|||
echo "$SUBSYS dead but subsys locked..." |
|||
;; |
|||
3) |
|||
echo "$SUBSYS is stopped" |
|||
;; |
|||
esac |
|||
;; |
|||
reload) |
|||
reload |
|||
;; |
|||
restart) |
|||
stop |
|||
start |
|||
;; |
|||
*) |
|||
echo "Usage: $0 {start|stop|status|reload|restart}" |
|||
RETVAL=1 |
|||
esac |
|||
exit $RETVAL |
|||
</source> |
|||
}} }} |
|||
'''startup.sh''' - This file must be '''chmod 700'''. |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/bin/|startup.sh|<source lang=bash class="startup.sh"> |
|||
#! /bin/bash |
|||
# Start ssh-agent and add key |
|||
############################## |
|||
eval `ssh-agent-refresh.sh` >/dev/null |
|||
if ( ! ( ssh-add -L | grep -q $USER ) ); then ssh-add; fi |
|||
# Start ssh-proxy - USELESS - ALWAYS FOLLOWED BY A CALL TO ~/bin/network-* which restarts sshproxy anyway |
|||
############################## |
|||
#~/bin/sshproxy stop >/dev/null |
|||
#~/bin/sshproxy start |
|||
</source> |
|||
}} }} |
|||
=== Directory /home/beq06659/etc === |
|||
'''backup_definition''' |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/etc/|backup_definition|<source lang=text class="backup_definition"> |
|||
BACKUPPREFIX=wiki |
|||
BACKUPID=www.noekeon.org_miki |
|||
BACKUPEXT=sql.gz |
|||
BACKUPCMD="ssh noekeon '~daemenj/private/backup_wiki ~daemenj/kiwi.noekeon.org/miki/LocalSettings.php'" |
|||
BACKUPPREFIX=wiki |
|||
BACKUPID=www.noekeon.org_miki |
|||
BACKUPEXT=tar.gz |
|||
BACKUPCMD="ssh noekeon 'cd ~daemenj/kiwi.noekeon.org; /usr/bin/nice -n 19 tar -cz miki/'" |
|||
BACKUPPREFIX=wiki |
|||
BACKUPID=www.noekeon.org_crypto |
|||
BACKUPEXT=sql.gz |
|||
BACKUPCMD="ssh noekeon '~daemenj/private/backup_wiki ~daemenj/kiwi.noekeon.org/crypto/LocalSettings.php'" |
|||
BACKUPPREFIX=wiki |
|||
BACKUPID=www.noekeon.org_crypto |
|||
BACKUPEXT=tar.gz |
|||
BACKUPCMD="ssh noekeon 'cd ~daemenj/kiwi.noekeon.org; /usr/bin/nice -n 19 tar -cz crypto/'" |
|||
</source> |
|||
}} }} |
|||
'''crontab''' - Install this file with |
|||
:<code>crontab -u beq06659 ~/etc/crontab</code> |
|||
{{pl2|{{hiddenSourceFile|/home/beq06659/etc/|crontab|<source lang=bash class="crontab"> |
|||
# Crontab for user beq06659 |
|||
# |
|||
# Install this crontab with |
|||
# |
|||
# crontab -u beq06659 crontab |
|||
# |
|||
# Use /bin/bash to run commands, instead of the default /bin/sh |
|||
SHELL=/bin/bash |
|||
# Define variable USER because we need it in our job scripts |
|||
USER=beq06659 |
|||
# Mail any output to 'beq06659', no matter whose crontab this is |
|||
MAILTO=beq06659 |
|||
# |
|||
# |
|||
# m h dom mon dow command (dow=0|7 is sunday) |
|||
37 * * * * ~beq06659/bin/backup_main ~beq06659/etc/backup_definition |
|||
</source> |
|||
}} }} |
Latest revision as of 11:21, 26 April 2013
These are the configuration files on Configuration NXP Dell Latitude D620 - AndLinux.
Windows Host files
settings.txt
{{{content}}}
hosts
{{{content}}}
AndLinux files
Generated with script /home/beq06659/bin/generate_wiki_config_file_page.sh on host andLinux
Directory /etc
fstab
{{{content}}}
Directory /etc/privoxy
set-network-config - This file must be chmod 755. Also the following line must be added to /etc/sudoers:
ALL ALL=(ALL) NOPASSWD: /etc/privoxy/set-network-config
{{{content}}}
config-home.patch
{{{content}}}
config-nxp.patch
{{{content}}}
config-nxp_auth - symlinked to config-nxp
config-nxp_direct.patch
{{{content}}}
Directory /usr/local/bin
be - This script would ideally require to add the following line to /etc/sudoers:
ALL ALL=(ALL) NOPASSWD: /bin/loadkeys
{{{content}}}
ssh-agent-refresh.sh
{{{content}}}
Directory /home/beq06659
.bashrc - Everything before #### CUSTOMIZATION is the original file.
{{{content}}}
.dircolors.cfg
{{{content}}}
.inputrc
{{{content}}}
.profile
{{{content}}}
.vimrc
{{{content}}}
Directory /home/beq06659/.ssh
config-home
{{{content}}}
config-nxp
{{{content}}}
config-nxp_auth - symlinked to config-nxp
config-nxp_direct - symlinked to config-nxp
proxy.conf-default
{{{content}}}
proxy.conf-home - symlinked to proxy.conf-default
proxy.conf-nxp - symlinked to proxy.conf-default
proxy.conf-nxp_auth
{{{content}}}
config-home-nxp_direct - symlinked to config-default
Directory /home/beq06659/bin
backup_main - This file must be chmod 700.
{{{content}}}
generate_wiki_config_file_page.sh - This file must be chmod 700.
{{{content}}}
restore_wiki.sh - This file must be chmod 700.
{{{content}}}
set-network.sh - This file must be chmod 700.
{{{content}}}
sshproxy - This file must be chmod 700.
{{{content}}}
startup.sh - This file must be chmod 700.
{{{content}}}
Directory /home/beq06659/etc
backup_definition
{{{content}}}
crontab - Install this file with
crontab -u beq06659 ~/etc/crontab
{{{content}}}