change variable from MYHSHELLCONFIG_ to MSC_ and fix

This commit is contained in:
Jakobus Schürz 2020-12-10 09:31:38 +01:00
parent df7192a675
commit b930a511eb
8 changed files with 195 additions and 195 deletions

View file

@ -49,7 +49,7 @@ Ausloggen und neu Einloggen.
## Lokale Configuration
in ~/.bashrc werden vor der Zeile zum Einbinden der myshellconfig die Variablen eingefügt um damit ein hostspezifisches Verhalten zu steuern
```
MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS=
MSC_GIT_CHECKOUTSCRIPT_OPTIONS=
```
Mögliche Optionen:
@ -64,13 +64,13 @@ Mit der Option -s kann ein Update der Submodules (tmux-, vim-plugins) erzwungen
```
MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS=""
MSC_GIT_CHECKOUTSCRIPT_OPTIONS=""
```
### Git Protokolle für push und pull
```
MYSHELLCONFIG_GIT_REMOTE_PROTOCOL=git # git ist default
MYSHELLCONFIG_GIT_REMOTE_PUSH_PROTOCOL=$MYSHELLCONFIG_GIT_REMOTE_PROTOCOL # MYSHELLCONFIG_GIT_REMOTE_PROTOCOL ist default
MSC_GIT_REMOTE_PROTOCOL=git # git ist default
MSC_GIT_REMOTE_PUSH_PROTOCOL=$MSC_GIT_REMOTE_PROTOCOL # MSC_GIT_REMOTE_PROTOCOL ist default
```
Mögliche Optionen:
@ -78,12 +78,12 @@ Mögliche Optionen:
* git - (default) Gitprotokoll ist git (Auf manchen Umgebungen kann der dazu notwenidge Port gesperrt sein)
* http - wenn git nicht möglich ist, kann das http/https Protokoll verwendet werden. (ist langsamer als git, jedoch ist fast überall Port 80 oder 440 freigeschaltet)
* ssh - Wenn auch schreibend auf das Repo zugegriffen werden soll, so muss Privatekey, Pubkey (und wenn konfiguriert Certifikate mit den notwendigen Principals) vorhanden sein, dann kann das ssh-Prodokoll verwendet werden.
* file - Das entfernte Repository ist auf einem USB-Stick, welcher unter /media/$USER/gitstick beim Einstecken gemountet wird. Der Pfad ist anpassbar (siehe MYSHELLCONFIG_GIT_REPO_PATH)
* file - Das entfernte Repository ist auf einem USB-Stick, welcher unter /media/$USER/gitstick beim Einstecken gemountet wird. Der Pfad ist anpassbar (siehe MSC_GIT_REPO_PATH)
Vim Plugins werden prinzipiell von github.com bezogen. Für spezielle Anwendungsfälle (github.com ist per firewall gesperrt), kann man diese auch in eigenen Repos hosten. Um diese eigenen Repos zu verwenden, muss in ~/.bashrc die Variable entsprechend gesetzt werden. Es ist ein Verzeichnis anzugeben, unter dem alle Pluginrepos als bare-Repos gecloned werden. Wichtig ist, dass die Usernamenverzeichnisse von github.com hier auch vorhanden sind, damit ohne dieser gesetzten Variable die Plugins direkt von github.com geladen werden können.
```
MYSHELLCONFIG_VIM_PLUGINS=https://my.git.server/public/Vim
MSC_VIM_PLUGINS=https://my.git.server/public/Vim
```
Z.B. das Plugin Vundle.vim hat ist auf github unter dieser URL zu finden
@ -97,17 +97,17 @@ https://my.git.server/public/Vim/gmarik/Vundle
### Über ~/.bashrc manuell festlegbare Variablen und ihre Default-Werte, wenn nicht manuell gesetzt:
```
MYSHELLCONFIG_SUBPATH=.local/myshellconfig
MYSHELLCONFIG_BASE="${HOME}/${MYSHELLCONFIG_SUBPATH}"
MYSHELLCONFIG_LOGDIR="${MYSHELLCONFIG_BASE}/logs"
MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/git.log"
MYSHELLCONFIG_GIT_TIMEOUT=5s
MSC_SUBPATH=.local/myshellconfig
MSC_BASE="${HOME}/${MSC_SUBPATH}"
MSC_LOGDIR="${MSC_BASE}/logs"
MSC_LOGFILE="${MSC_LOGDIR}/git.log"
MSC_GIT_TIMEOUT=5s
MYSHELLCONFIG_GIT_SERVER="git.schuerz.at"
MYSHELLCONFIG_GIT_REPO_NAME="server-config.git"
MYSHELLCONFIG_GIT_REPO_PATH_HTTP="/public/"
MYSHELLCONFIG_GIT_REPO_PATH_SSH=":public/"
MYSHELLCONFIG_GIT_REPO_PATH_GIT="/public/"
MSC_GIT_SERVER="git.schuerz.at"
MSC_GIT_REPO_NAME="server-config.git"
MSC_GIT_REPO_PATH_HTTP="/public/"
MSC_GIT_REPO_PATH_SSH=":public/"
MSC_GIT_REPO_PATH_GIT="/public/"
```

View file

@ -61,9 +61,9 @@ alias goarchive='[ -e $(xdg-user-dir ARCHIVE) ] && cd $(xdg-user-dir ARCHIVE)'
alias godebian='cd ~/debian'
alias gofvwm='cd /home/jakob/src/fvwmverve/'
alias gofvwmsys='cd /usr/share/fvwm-verve/'
alias goserverconfig='cd $MYSHELLCONFIG_BASE'
alias gomyshellconfig='cd $MYSHELLCONFIG_BASE'
alias catmyshellconfiglog='cat $MYSHELLCONFIG_LOGFILE'
alias goserverconfig='cd $MSC_BASE'
alias gomyshellconfig='cd $MSC_BASE'
alias catmyshellconfiglog='cat $MSC_LOGFILE'
alias goxund='cd /home/jakob/xundeenergie.at/'
# system-dirs

View file

@ -21,11 +21,11 @@ if [[ $- = *i* ]] ; then
# define variables
# Base Path
[ -z "${MYSHELLCONFIG_SUBPATH+x}" ] && export MYSHELLCONFIG_SUBPATH=".local/myshellconfig"
[ -z "${MYSHELLCONFIG_BASE+x}" ] && export MYSHELLCONFIG_BASE="${HOME}/${MYSHELLCONFIG_SUBPATH}"
[ -z "${MSC_SUBPATH+x}" ] && export MSC_SUBPATH=".local/myshellconfig"
[ -z "${MSC_BASE+x}" ] && export MSC_BASE="${HOME}/${MSC_SUBPATH}"
# hardcoded paths
export MYSHELLCONFIG_BASE_PARENT="$(dirname $MYSHELLCONFIG_BASE)"
export MYSHELLCONFIG_BASH_COMPLETION="${HOME}/${MYSHELLCONFIG_SUBPATH}/bash_completion.d"
export MSC_BASE_PARENT="$(dirname $MSC_BASE)"
export MSC_BASH_COMPLETION="${HOME}/${MSC_SUBPATH}/bash_completion.d"
# Userdata
[ -z "${USERNAME+x}" ] && export USERNAME="$USER"
@ -38,35 +38,35 @@ if [[ $- = *i* ]] ; then
[ -z "${GIT_COMMITTER_NAME+x}" ] && export GIT_COMMITTER_NAME=$FULLNAME
[ -z "${GIT_COMMITTER_EMAIL+x}" ] && export GIT_COMMITTER_EMAIL=$USEREMAIL
[ -z "${MYSHELLCONFIG_GIT_TIMEOUT+x}" ] && export MYSHELLCONFIG_GIT_TIMEOUT=5s
[ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && export MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s
[ -z "${MYSHELLCONFIG_GIT_SYNC+x}" ] && export MYSHELLCONFIG_GIT_SYNC=true
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT=true
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL=48 #intervall in hours
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT="git://git.schuerz.at/github.com/"
[ -z "${MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
[ -z "${MSC_GIT_TIMEOUT+x}" ] && export MSC_GIT_TIMEOUT=5s
[ -z "${MSC_GIT_CHECKOUT_TIMEOUT+x}" ] && export MSC_GIT_CHECKOUT_TIMEOUT=20s
[ -z "${MSC_GIT_SYNC+x}" ] && export MSC_GIT_SYNC=true
[ -z "${MSC_GIT_SUBMODULES_UPDATE_DEFAULT+x}" ] && export MSC_GIT_SUBMODULES_UPDATE_DEFAULT=true
[ -z "${MSC_GIT_SUBMODULES_UPDATE_INTERVALL+x}" ] && export MSC_GIT_SUBMODULES_UPDATE_INTERVALL=48 #intervall in hours
[ -z "${MSC_GIT_SUBMODULES_SERVER_DEFAULT+x}" ] && export MSC_GIT_SUBMODULES_SERVER_DEFAULT="git://git.schuerz.at/github.com/"
[ -z "${MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT+x}" ] && export MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT="-h"
# hardcoded git
export SGIT="git -C ${MYSHELLCONFIG_BASE}"
export SGIT="git -C ${MSC_BASE}"
# git-repo-url for vim plugin
# TODO: check how to use
export MYSHELLCONFIG_VIM_PLUGINS
export MSC_VIM_PLUGINS
# Logging
[ -z "${MYSHELLCONFIG_LOGDIR+x}" ] && export MYSHELLCONFIG_LOGDIR="${HOME}/logs"
[ -z "${MYSHELLCONFIG_LOGFILE+x}" ] && export MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/myshellconfig.log"
[ -z "${MYHSELLCONFIG_LOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_LOGLEVEL_DEFAULT="INFO"
[ -z "${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_FILELOGLEVEL_DEFAULT="DEBUG"
[ -z "${SCRIPT_LOG+x}" ] && export SCRIPT_LOG="${MYSHELLCONFIG_LOGFILE}"
[ -z "${LOGLEVEL_DEFAULT+x}" ] && export LOGLEVEL_DEFAULT="${MYHSELLCONFIG_LOGLEVEL_DEFAULT-INFO}"
[ -z "${FILELOGLEVEL_DEFAULT+x}" ] && export FILELOGLEVEL_DEFAULT="${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT-INFO}"
[ -z "${MSC_LOGDIR+x}" ] && export MSC_LOGDIR="${HOME}/logs"
[ -z "${MSC_LOGFILE+x}" ] && export MSC_LOGFILE="${MSC_LOGDIR}/myshellconfig.log"
[ -z "${MSC_LOGLEVEL_DEFAULT+x}" ] && export MSC_LOGLEVEL_DEFAULT="INFO"
[ -z "${MSC_FILELOGLEVEL_DEFAULT+x}" ] && export MSC_FILELOGLEVEL_DEFAULT="DEBUG"
[ -z "${SCRIPT_LOG+x}" ] && export SCRIPT_LOG="${MSC_LOGFILE}"
[ -z "${LOGLEVEL_DEFAULT+x}" ] && export LOGLEVEL_DEFAULT="${MSC_LOGLEVEL_DEFAULT-INFO}"
[ -z "${FILELOGLEVEL_DEFAULT+x}" ] && export FILELOGLEVEL_DEFAULT="${MSC_FILELOGLEVEL_DEFAULT-INFO}"
# Create necessary directories for logging
[ -n "${MYSHELLCONFIG_LOGDIR-x}" ] && mkdir -p "$MYSHELLCONFIG_LOGDIR"
[ -n "${MSC_LOGDIR-x}" ] && mkdir -p "$MSC_LOGDIR"
# load logging functions
. ${MYSHELLCONFIG_BASE}/logging
. ${MSC_BASE}/logging
# PKCS11_MODULE for etoken/smartcard authentification
[ -n "$(whereis p11-kit-proxy.so|awk '{print $2}')" ] && PKCS11_MODULE=$(whereis p11-kit-proxy.so|awk '{print $2}')
@ -75,7 +75,7 @@ if [[ $- = *i* ]] ; then
[ -z "${VISUAL+x}" ] && export VISUAL=vim
[ -z "${EDITOR+x}" ] && export EDITOR=vim
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
cat << EOF >> "${MSC_LOGFILE}"
==8<=== start configure new shell ============== $(date) ===============8<==
EOF
@ -85,8 +85,8 @@ EOF
ckrepo () {
# check if remote repo is reachable
if $MYSHELLCONFIG_GIT_SYNC; then
if $( timeout --foreground "${MYSHELLCONFIG_GIT_TIMEOUT}" $SGIT ls-remote >/dev/null 2>&1) ;then
if $MSC_GIT_SYNC; then
if $( timeout --foreground "${MSC_GIT_TIMEOUT}" $SGIT ls-remote >/dev/null 2>&1) ;then
return 0
else
return 1
@ -99,15 +99,15 @@ EOF
}
sync_config () {
if $MYSHELLCONFIG_GIT_SYNC; then
if $MSC_GIT_SYNC; then
local nok=""
local gco=""
if which git >/dev/null; then
loginfo -n "Sync config with ${MYSHELLCONFIG_GIT_SERVER}: "
# MYSHELLCONFIG_GITCHECKOUTSCRIPT_OPTIONS are options for bin/git-myshellconfig-checkout
${MYSHELLCONFIG_BASE}/bin/git-myshellconfig-checkout ${MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS:=${MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT}}|| nok="not " 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1
loginfo -n "Sync config with ${MSC_GIT_SERVER}: "
# MSC_GITCHECKOUTSCRIPT_OPTIONS are options for bin/git-myshellconfig-checkout
${MSC_BASE}/bin/git-myshellconfig-checkout ${MSC_GIT_CHECKOUTSCRIPT_OPTIONS:=${MSC_GIT_CHECKOUTSCRIPT_OPTIONS_DEFAULT}}|| nok="not " 1>>"${MSC_LOGFILE}" 2>&1
loginfo "$(printf '%s\n' "${nok}synced" )"
[ -z "$nok" ] && mkdir -pv "${MYSHELLCONFIG_LOGDIR}"
[ -z "$nok" ] && mkdir -pv "${MSC_LOGDIR}"
else
logwarn "git not installed, no configuration possible, please install git" >&2
@ -133,8 +133,8 @@ EOF
EXIT
}
if [ -d "${MYSHELLCONFIG_BASE}/bin" ] ; then
pathmunge "${MYSHELLCONFIG_BASE}/bin"
if [ -d "${MSC_BASE}/bin" ] ; then
pathmunge "${MSC_BASE}/bin"
export PATH
fi
@ -161,19 +161,19 @@ EOF
fi
# source git-sync part of myshellconfig
. "${MYSHELLCONFIG_BASE}/myshell_git_sync"
. "${MSC_BASE}/myshell_git_sync"
# source loading defaults part of myshellconfig
. "${MYSHELLCONFIG_BASE}/myshell_load_defaults"
. "${MSC_BASE}/myshell_load_defaults"
# source loading workaround for x2go to forward local etoken to remote machine with forwardagent
. "${MYSHELLCONFIG_BASE}/myshell_load_x2go_tokenforward"
. "${MSC_BASE}/myshell_load_x2go_tokenforward"
promptcommandmunge "_tmux_hook"
promptcommandmunge "_umask_hook"
which direnv >/dev/null && eval "$(direnv hook bash)"
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
cat << EOF >> "${MSC_LOGFILE}"
==8<=== finished configure new shell ================ $(date) ===============8<==
EOF

View file

@ -12,23 +12,23 @@
#################################################################################################
[ -z "${SGIT+x}" ] && SGIT=git
[ -z "${MYSHELLCONFIG_LOGDIR+x}" ] && export MYSHELLCONFIG_LOGDIR="${HOME}/logs"
[ -z "${MYSHELLCONFIG_LOGFILE+x}" ] && export MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/myshellconfig.log"
#MYSHELLCONFIG_LOGDIR="./logs"
#MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/git.log"
[ -d "${MYSHELLCONFIG_LOGDIR}" ] || mkdir -p "${MYSHELLCONFIG_LOGDIR}"
[ -z "${MYSHELLCONFIG_GIT_REMOTE_NAME+x}" ] && export MYSHELLCONFIG_GIT_REMOTE_NAME=origin
[ -z "${MYSHELLCONFIG_GIT_BRANCH+x}" ] && export MYSHELLCONFIG_GIT_BRANCH=master
[ -z "${MSC_LOGDIR+x}" ] && export MSC_LOGDIR="${HOME}/logs"
[ -z "${MSC_LOGFILE+x}" ] && export MSC_LOGFILE="${MSC_LOGDIR}/myshellconfig.log"
#MSC_LOGDIR="./logs"
#MSC_LOGFILE="${MSC_LOGDIR}/git.log"
[ -d "${MSC_LOGDIR}" ] || mkdir -p "${MSC_LOGDIR}"
[ -z "${MSC_GIT_REMOTE_NAME+x}" ] && export MSC_GIT_REMOTE_NAME=origin
[ -z "${MSC_GIT_BRANCH+x}" ] && export MSC_GIT_BRANCH=master
lastupdatesubmodules () {
date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules
date "+%s" > ${MSC_BASE%/}${MSC_BASE:+/}.last_update_submodules
}
lastupdaterepo () {
date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_repo
date "+%s" > ${MSC_BASE%/}${MSC_BASE:+/}.last_update_repo
}
gitupdateend() {
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
cat << EOF >> "${MSC_LOGFILE}"
+-----ENDE git update repo $(date) ---------------------------------+
@ -36,7 +36,7 @@ EOF
}
ENTRY
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
cat << EOF >> "${MSC_LOGFILE}"
+-----BEGINN git update repo $(date) -------------------------------+
EOF
@ -46,7 +46,7 @@ while [ $# -gt 0 ]; do
case $1 in
-h|--headless)
# Headless repo local
PRE="${MYSHELLCONFIG_GIT_REMOTE_NAME}"
PRE="${MSC_GIT_REMOTE_NAME}"
shift
;;
-s|--submodules-update)
@ -60,43 +60,43 @@ while [ $# -gt 0 ]; do
esac
done
# If TAG is set, checkout is always headless.
[ -z "${MYSHELLCONFIG_GIT_TAG:+x}" ] || { export MYSHELLCONFIG_GIT_BRANCH=${MYSHELLCONFIG_GIT_TAG}; export PRE=""; }
[ -z "${MSC_GIT_TAG:+x}" ] || { export MSC_GIT_BRANCH=${MSC_GIT_TAG}; export PRE=""; }
# Output
#echo -n " remote: ${MYSHELLCONFIG_GIT_REMOTE_NAME}, branch: ${MYSHELLCONFIG_GIT_BRANCH}: "
#echo -n " remote: ${MSC_GIT_REMOTE_NAME}, branch: ${MSC_GIT_BRANCH}: "
# Check for updates in submodules only if last check was INTERVALL hours in the past
if [ $(cat ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 ) \
-lt $(date --date="${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") \
-a ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
if [ $(cat ${MSC_BASE%/}${MSC_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 ) \
-lt $(date --date="${MSC_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") \
-a ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
[ -z "${dosrepoupdate+x}" ] && dorepoupdate="true"
fi
if [ $(cat ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 ) \
-lt $(date --date="${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") \
-a ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
if [ $(cat ${MSC_BASE%/}${MSC_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 ) \
-lt $(date --date="${MSC_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") \
-a ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
[ -z "${dosubmodupdate+x}" ] && dosubmodupdate="true"
fi
#echo $SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 1>&2
#echo $SGIT fetch ${MSC_GIT_REMOTE_NAME} -p 1>&2
loginfo "fetch repo${dosubmodupdate:+ and submodules}"
$SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; }
$SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MSC_GIT_REMOTE_NAME} -p 2>>"${MSC_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; }
if ${dosubmodupdate:-false}; then
lastupdatesubmodules
fi
echo "Check for local changes:" >> "${MYSHELLCONFIG_LOGFILE}"
if $SGIT diff-index --ignore-submodules --exit-code HEAD -- >> "${MYSHELLCONFIG_LOGFILE}" ; then
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
echo "Check for local changes:" >> "${MSC_LOGFILE}"
if $SGIT diff-index --ignore-submodules --exit-code HEAD -- >> "${MSC_LOGFILE}" ; then
cat << EOF >> "${MSC_LOGFILE}"
no changes in local repo
$SGIT checkout repo ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH}
$SGIT checkout repo ${PRE}${PRE:+/}${MSC_GIT_BRANCH}
EOF
$SGIT checkout ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH} 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| { gitupdateend; exit 2; }
$SGIT merge FETCH_HEAD 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| { gitupdateend; exit 3; }
$SGIT checkout ${PRE}${PRE:+/}${MSC_GIT_BRANCH} 1>>"${MSC_LOGFILE}" 2>>"${MSC_LOGFILE}"|| { gitupdateend; exit 2; }
$SGIT merge FETCH_HEAD 1>>"${MSC_LOGFILE}" 2>>"${MSC_LOGFILE}"|| { gitupdateend; exit 3; }
else
logwarn -n " Lokale Änderungen festgestellt:"
echo " Siehe Logfile ${MYSHELLCONFIG_LOGFILE}" >&2
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
echo " Siehe Logfile ${MSC_LOGFILE}" >&2
cat << EOF >> "${MSC_LOGFILE}"
um die Änderung zurückzusetzen bitte
$SGIT checkout \$FILENAME
@ -119,7 +119,7 @@ fi
loginfo "repo${dosubmodupdate:+ and submodules} synced"
#if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then
#if ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then
if ${dosubmodupdate:-false}; then
loginfo "update and commit submodules"
logdebug "$($SGIT submodule update --remote)"
@ -129,7 +129,7 @@ loginfo "repo${dosubmodupdate:+ and submodules} synced"
fi
#else
# loginfo -n ", submodules not synced"
# logdebug "Do not update submodules. It's denied by environment MYSHELLCONFIG_GIT_UPDATE_SUBMODULES: ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}"
# logdebug "Do not update submodules. It's denied by environment MSC_GIT_UPDATE_SUBMODULES: ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}}"
#fi
EXIT

View file

@ -71,22 +71,22 @@ sudo() {
}
create_symlinks() {
#echo MYSHELLCONFIG_BASE: $MYSHELLCONFIG_BASE
# MYSHELLCONFIG_BASEDIR="$1"
# DIR="$(basename ${MYSHELLCONFIG_BASEDIR})"
# cd "${MYSHELLCONFIG_BASEDIR}"
cd ${MYSHELLCONFIG_BASE}
#echo "DIR MYSHELLCONFIG_BASEDIR $DIR $MYSHELLCONFIG_BASEDIR"
#echo MSC_BASE: $MSC_BASE
# MSC_BASEDIR="$1"
# DIR="$(basename ${MSC_BASEDIR})"
# cd "${MSC_BASEDIR}"
cd ${MSC_BASE}
#echo "DIR MSC_BASEDIR $DIR $MSC_BASEDIR"
git config credential.helper 'cache --timeout=300'
#Anlegen von Symlinks
rm -rf ~/.vimrc ~/.vim ~/bashrc_add ~/.gitconfig ~/.tmux.conf ~/.tmux
ln -sf "${MYSHELLCONFIG_BASE}/vimrc" ~/.vimrc
ln -sf "${MYSHELLCONFIG_BASE}/vim" ~/.vim
ln -sf "${MYSHELLCONFIG_BASE}/.gitconfig" ~/.gitconfig
ln -sf "${MYSHELLCONFIG_BASE}/.gitignore_global" ~/.gitignore_global
#ln -sf "${MYSHELLCONFIG_BASE}/bashrc_add" ~/bashrc_add
ln -sf "${MYSHELLCONFIG_BASE}/tmux" ~/.tmux
ln -sf "${MYSHELLCONFIG_BASE}/tmux/tmux.conf" ~/.tmux.conf
ln -sf "${MSC_BASE}/vimrc" ~/.vimrc
ln -sf "${MSC_BASE}/vim" ~/.vim
ln -sf "${MSC_BASE}/.gitconfig" ~/.gitconfig
ln -sf "${MSC_BASE}/.gitignore_global" ~/.gitignore_global
#ln -sf "${MSC_BASE}/bashrc_add" ~/bashrc_add
ln -sf "${MSC_BASE}/tmux" ~/.tmux
ln -sf "${MSC_BASE}/tmux/tmux.conf" ~/.tmux.conf
# Configure to use githooks in .githooks, not in standardlocation .git/hooks
$SGIT config core.hooksPath .githooks
@ -309,15 +309,15 @@ mkcd () {
sshmyshellconfig() {
ENTRY
[ -z "${MYSHELLCONFIG_SUBPATH+x}" ] && MYSHELLCONFIG_SUBPATH=".local/myshellconfig"
[ -z "${MYSHELLCONFIG_BASE+x}" ] && MYSHELLCONFIG_BASE="${HOME}/${MYSHELLCONFIG_SUBPATH}"
MYSHELLCONFIG_BASE_PARENT="$(dirname $MYSHELLCONFIG_BASE)"
[ -z "${MSC_SUBPATH+x}" ] && MSC_SUBPATH=".local/myshellconfig"
[ -z "${MSC_BASE+x}" ] && MSC_BASE="${HOME}/${MSC_SUBPATH}"
MSC_BASE_PARENT="$(dirname $MSC_BASE)"
if [ $1 == "localhost" ]; then
CMD=""
else
local SSH="/usr/bin/ssh"
[ -e ${MYSHELLCONFIG_BASE}/bashrc_add ] && $SSH -T -o VisualHostKey=no $@ "mkdir -p ~/\$MYSHELLCONFIG_BASE_PARENT; cat > ~/bashrc_add" < "${MYSHELLCONFIG_BASE}/bashrc_add"
[ -e ${MSC_BASE}/bashrc_add ] && $SSH -T -o VisualHostKey=no $@ "mkdir -p ~/\$MSC_BASE_PARENT; cat > ~/bashrc_add" < "${MSC_BASE}/bashrc_add"
local CMD="$SSH -T $@"
fi
$CMD /bin/bash << EOF
@ -327,13 +327,13 @@ sshmyshellconfig() {
sed -i -e '/^\[ -f bashrc_add \] /d' ~/.bashrc
sed -i -e '/#MYSHELLCONFIG-start/,/#MYSHELLCONFIG-end/d' ~/.bashrc
echo
printf "%s\n" "#MYSHELLCONFIG-start" "[ -f \"\${HOME}/${MYSHELLCONFIG_SUBPATH}/bashrc_add\" ] && . \"\${HOME}/${MYSHELLCONFIG_SUBPATH}/bashrc_add\"" "#MYSHELLCONFIG-end"| tee -a ~/.bashrc
#printf "%s\n" "#MYSHELLCONFIG-start" "if [ -e \${HOME}/${MYSHELLCONFIG_SUBPATH}/bashrc_add ]; then" " . \${HOME}/${MYSHELLCONFIG_SUBPATH}/bashrc_add;" "else" " if [ -f ~/bashrc_add ] ;then" " . ~/bashrc_add;" " fi;" "fi" "#MYSHELLCONFIG-end" |tee -a ~/.bashrc
printf "%s\n" "#MYSHELLCONFIG-start" "[ -f \"\${HOME}/${MSC_SUBPATH}/bashrc_add\" ] && . \"\${HOME}/${MSC_SUBPATH}/bashrc_add\"" "#MYSHELLCONFIG-end"| tee -a ~/.bashrc
#printf "%s\n" "#MYSHELLCONFIG-start" "if [ -e \${HOME}/${MSC_SUBPATH}/bashrc_add ]; then" " . \${HOME}/${MSC_SUBPATH}/bashrc_add;" "else" " if [ -f ~/bashrc_add ] ;then" " . ~/bashrc_add;" " fi;" "fi" "#MYSHELLCONFIG-end" |tee -a ~/.bashrc
echo
loginfo cleanup from old config
rm -rf ~/server-config && echo rm -rf ~/server-config
loginfo git clone
git clone --recurse-submodules $MYSHELLCONFIG_GIT_REMOTE \${HOME}/${MYSHELLCONFIG_SUBPATH}
git clone --recurse-submodules $MSC_GIT_REMOTE \${HOME}/${MSC_SUBPATH}
EOF
EXIT
@ -349,7 +349,7 @@ sshs() {
local f
local TMPBASHCONFIG=$(mktemp -p ${XDG_RUNTIME_DIR} -t bashrc.XXXXXXXX --suffix=.conf)
local FILELIST=( "${MYSHELLCONFIG_BASE}/functions.sh" "${MYSHELLCONFIG_BASE}/logging" "${MYSHELLCONFIG_BASE}/myshell_load_fortmpconfig" $(getbashrcfile) ~/.aliases "${MYSHELLCONFIG_BASE}/aliases" "${MYSHELLCONFIG_BASE}/PS1" "${MYSHELLCONFIG_BASE}/bash_completion.d/*" )
local FILELIST=( "${MSC_BASE}/functions.sh" "${MSC_BASE}/logging" "${MSC_BASE}/myshell_load_fortmpconfig" $(getbashrcfile) ~/.aliases "${MSC_BASE}/aliases" "${MSC_BASE}/PS1" "${MSC_BASE}/bash_completion.d/*" )
local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=15s -o ControlPath=~/.ssh/ssh-%r@%h:%p"
# Read /etc/bashrc or /etc/bash.bashrc (depending on distribution) and /etc/profile.d/*.sh first
@ -403,7 +403,7 @@ loginfo "This bash runs with temporary config from \$BASHRC"
EOF
ssh -T ${SSH_OPTS} $@ "cat > ${REMOTETMPBASHCONFIG}" < "${TMPBASHCONFIG}"
ssh -T ${SSH_OPTS} $@ "cat > ${REMOTETMPVIMCONFIG}" < "${MYSHELLCONFIG_BASE}/vimrc"
ssh -T ${SSH_OPTS} $@ "cat > ${REMOTETMPVIMCONFIG}" < "${MSC_BASE}/vimrc"
RCMD="
trap \"rm -f ${REMOTETMPBASHCONFIG} ${REMOTETMPVIMCONFIG}\" EXIT " ;
ssh -t ${SSH_OPTS} $@ "$RCMD; SSHS=true bash -c \"function bash () { /bin/bash --rcfile ${REMOTETMPBASHCONFIG} -i ; } ; export -f bash; exec bash --rcfile ${REMOTETMPBASHCONFIG}\""
@ -421,7 +421,7 @@ EOF
}
VIMRC="${MYSHELLCONFIG_BASE}/vimrc"
VIMRC="${MSC_BASE}/vimrc"
svi () {
ENTRY
@ -450,14 +450,14 @@ svi () {
vim-repair-vundle () {
ENTRY
if [ -z ${MYSHELLCONFIG_BASE+x} ]; then
echo "MYSHELLCONFIG_BASE nicht gesetzt. Eventuell noch einmal ausloggen und wieder einloggen"
if [ -z ${MSC_BASE+x} ]; then
echo "MSC_BASE nicht gesetzt. Eventuell noch einmal ausloggen und wieder einloggen"
else
cd $MYSHELLCONFIG_BASE
cd $MSC_BASE
cd vim/bundle
rm -rf Vundle.vim
echo git clone "${MYSHELLCONFIG_GIT_SUBMODULES_SERVER-$MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT}gmarik/Vundle.vim.git"
git clone "${MYSHELLCONFIG_GIT_SUBMODULES_SERVER-$MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT}gmarik/Vundle.vim.git"
echo git clone "${MSC_GIT_SUBMODULES_SERVER-$MSC_GIT_SUBMODULES_SERVER_DEFAULT}gmarik/Vundle.vim.git"
git clone "${MSC_GIT_SUBMODULES_SERVER-$MSC_GIT_SUBMODULES_SERVER_DEFAULT}gmarik/Vundle.vim.git"
cd ~-
fi
EXIT
@ -644,7 +644,7 @@ changebeep() {
turnoffconfigsync() {
ENTRY
local line='MYSHELLCONFIG_GIT_SYNC='
local line='MSC_GIT_SYNC='
local file=~/.bashrc
if [ -e "${file}" ] ; then
sed -i -e "/${line}/d" "${file}"
@ -655,7 +655,7 @@ turnoffconfigsync() {
turnonconfigsync() {
ENTRY
local line='MYSHELLCONFIG_GIT_SYNC='
local line='MSC_GIT_SYNC='
local file=~/.bashrc
if [ -e "${file}" ] ; then
sed -i -e "/${line}/d" "${file}"

View file

@ -8,78 +8,78 @@ if ! $SSHS; then
######################################
MYSHELLCONFIG_GIT_PROTOCOL_GIT="git://"
MYSHELLCONFIG_GIT_PROTOCOL_HTTP="http://"
MYSHELLCONFIG_GIT_PROTOCOL_SSH="git@"
MYSHELLCONFIG_GIT_PROTOCOL_FILE=""
[ -z "${MYSHELLCONFIG_GIT_SERVER+x}" ] && MYSHELLCONFIG_GIT_SERVER="git.schuerz.at"
[ -z "${MYSHELLCONFIG_GIT_REPO_NAME+x}" ] && MYSHELLCONFIG_GIT_REPO_NAME="$(basename $MYSHELLCONFIG_BASE).git"
[ -z "${MYSHELLCONFIG_GIT_REPO_PATH_HTTP+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_HTTP="/public/"
[ -z "${MYSHELLCONFIG_GIT_REPO_PATH_SSH+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_SSH=":public/"
[ -z "${MYSHELLCONFIG_GIT_REPO_PATH_GIT+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_GIT="/public/"
# [ -z "${MYSHELLCONFIG_GIT_REPO_PATH_FILE+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_FILE="/media/$USER/gitstick/"
[ -z "${MYSHELLCONFIG_GIT_REPO_PATH_FILE+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_FILE="/srv/git/"
MSC_GIT_PROTOCOL_GIT="git://"
MSC_GIT_PROTOCOL_HTTP="http://"
MSC_GIT_PROTOCOL_SSH="git@"
MSC_GIT_PROTOCOL_FILE=""
[ -z "${MSC_GIT_SERVER+x}" ] && MSC_GIT_SERVER="git.schuerz.at"
[ -z "${MSC_GIT_REPO_NAME+x}" ] && MSC_GIT_REPO_NAME="$(basename $MSC_BASE).git"
[ -z "${MSC_GIT_REPO_PATH_HTTP+x}" ] && MSC_GIT_REPO_PATH_HTTP="/public/"
[ -z "${MSC_GIT_REPO_PATH_SSH+x}" ] && MSC_GIT_REPO_PATH_SSH=":public/"
[ -z "${MSC_GIT_REPO_PATH_GIT+x}" ] && MSC_GIT_REPO_PATH_GIT="/public/"
# [ -z "${MSC_GIT_REPO_PATH_FILE+x}" ] && MSC_GIT_REPO_PATH_FILE="/media/$USER/gitstick/"
[ -z "${MSC_GIT_REPO_PATH_FILE+x}" ] && MSC_GIT_REPO_PATH_FILE="/srv/git/"
MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT="${MYSHELLCONFIG_GIT_PROTOCOL_GIT}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_GIT}"
MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH="${MYSHELLCONFIG_GIT_PROTOCOL_SSH}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_SSH}"
MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP="${MYSHELLCONFIG_GIT_PROTOCOL_HTTP}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_HTTP}"
MYSHELLCONFIG_GIT_REMOTE_PUBLIC_FILE="${MYSHELLCONFIG_GIT_PROTOCOL_FILE}${MYSHELLCONFIG_GIT_REPO_PATH_FILE}"
MYSHELLCONFIG_GIT_REMOTE_PUBLIC_DEFAULT="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}"
MSC_GIT_REMOTE_PUBLIC_GIT="${MSC_GIT_PROTOCOL_GIT}${MSC_GIT_SERVER}${MSC_GIT_REPO_PATH_GIT}"
MSC_GIT_REMOTE_PUBLIC_SSH="${MSC_GIT_PROTOCOL_SSH}${MSC_GIT_SERVER}${MSC_GIT_REPO_PATH_SSH}"
MSC_GIT_REMOTE_PUBLIC_HTTP="${MSC_GIT_PROTOCOL_HTTP}${MSC_GIT_SERVER}${MSC_GIT_REPO_PATH_HTTP}"
MSC_GIT_REMOTE_PUBLIC_FILE="${MSC_GIT_PROTOCOL_FILE}${MSC_GIT_REPO_PATH_FILE}"
MSC_GIT_REMOTE_PUBLIC_DEFAULT="${MSC_GIT_REMOTE_PUBLIC_GIT}"
MYSHELLCONFIG_GIT_REMOTE_DEFAULT="${MYSHELLCONFIG_GIT_PROTOCOL_GIT}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_GIT}"
MSC_GIT_REMOTE_DEFAULT="${MSC_GIT_PROTOCOL_GIT}${MSC_GIT_SERVER}${MSC_GIT_REPO_PATH_GIT}"
# If MYSHELLCONFIG_GIT_REMOTE is set in ~/.bashrc before sourcing this file, take value from ~/.bashrc
# If set MYSHELLCONFIG_GIT_REMOTE_PROTOCOL in ~/.bashrc before sourcing this file, you cange choose one of the above
# If MSC_GIT_REMOTE is set in ~/.bashrc before sourcing this file, take value from ~/.bashrc
# If set MSC_GIT_REMOTE_PROTOCOL in ~/.bashrc before sourcing this file, you cange choose one of the above
# defined values for a specific host
if [ -z ${MYSHELLCONFIG_GIT_REMOTE+x} ]; then
case $MYSHELLCONFIG_GIT_REMOTE_PROTOCOL in
if [ -z ${MSC_GIT_REMOTE+x} ]; then
case $MSC_GIT_REMOTE_PROTOCOL in
git)
MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}"
MSC_GIT_REMOTE_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_GIT}"
;;
ssh)
MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH}"
MSC_GIT_REMOTE_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_SSH}"
;;
http)
MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}"
MSC_GIT_REMOTE_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_HTTP}"
;;
file)
MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_FILE}"
MYSHELLCONFIG_GIT_SERVER="${MYSHELLCONFIG_GIT_REPO_PATH_FILE}"
MSC_GIT_REMOTE_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_FILE}"
MSC_GIT_SERVER="${MSC_GIT_REPO_PATH_FILE}"
;;
*)
MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_DEFAULT}"
MSC_GIT_REMOTE_PUBLIC="${MSC_GIT_REMOTE_DEFAULT}"
;;
esac
MYSHELLCONFIG_GIT_REMOTE="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC}${MYSHELLCONFIG_GIT_REPO_NAME}"
MSC_GIT_REMOTE="${MSC_GIT_REMOTE_PUBLIC}${MSC_GIT_REPO_NAME}"
fi
if [ -z ${MYSHELLCONFIG_GIT_REMOTE_PUSH+x} ]; then
case $MYSHELLCONFIG_GIT_REMOTE_PUSH_PROTOCOL in
if [ -z ${MSC_GIT_REMOTE_PUSH+x} ]; then
case $MSC_GIT_REMOTE_PUSH_PROTOCOL in
git)
MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}"
MSC_GIT_REMOTE_PUSH_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_GIT}"
;;
ssh)
MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH}"
MSC_GIT_REMOTE_PUSH_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_SSH}"
;;
http)
MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}"
MSC_GIT_REMOTE_PUSH_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_HTTP}"
;;
file)
MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_FILE}"
MSC_GIT_REMOTE_PUSH_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_FILE}"
;;
*)
MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_DEFAULT}"
MSC_GIT_REMOTE_PUSH_PUBLIC="${MSC_GIT_REMOTE_PUBLIC_DEFAULT}"
;;
esac
MYSHELLCONFIG_GIT_REMOTE_PUSH=${MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC}${MYSHELLCONFIG_GIT_REPO_NAME}
MSC_GIT_REMOTE_PUSH=${MSC_GIT_REMOTE_PUSH_PUBLIC}${MSC_GIT_REPO_NAME}
fi
[ -z "${MYSHELLCONFIG_GIT_REMOTE_NAME+x}" ] && export MYSHELLCONFIG_GIT_REMOTE_NAME=origin
[ -z "${MYSHELLCONFIG_GIT_BRANCH+x}" ] && export MYSHELLCONFIG_GIT_BRANCH=master
[ -z "${MSC_GIT_REMOTE_NAME+x}" ] && export MSC_GIT_REMOTE_NAME=origin
[ -z "${MSC_GIT_BRANCH+x}" ] && export MSC_GIT_BRANCH=master
# If TAG is set, checkout is always headless.
[ -z "${MYSHELLCONFIG_GIT_TAG:+x}" ] || { export MYSHELLCONFIG_GIT_BRANCH=${MYSHELLCONFIG_GIT_TAG}; export MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS="-h"; }
[ -z "${MSC_GIT_TAG:+x}" ] || { export MSC_GIT_BRANCH=${MSC_GIT_TAG}; export MSC_GIT_CHECKOUTSCRIPT_OPTIONS="-h"; }
#GIT_SSH_PATH="/srv/repos"
@ -88,10 +88,10 @@ if ! $SSHS; then
#*term*|*linux*)
*term*)
if [ -d "${MYSHELLCONFIG_BASE}" -a $($SGIT status 1>/dev/null 2>&1; echo $?) -eq 0 ]; then
[ -d "${MYSHELLCONFIG_LOGDIR}" ] || mkdir -p "${MYSHELLCONFIG_LOGDIR}"
if [ -d "${MSC_BASE}" -a $($SGIT status 1>/dev/null 2>&1; echo $?) -eq 0 ]; then
[ -d "${MSC_LOGDIR}" ] || mkdir -p "${MSC_LOGDIR}"
if ! $SGIT rev-parse --git-dir > /dev/null 2>&1 ; then
loginfo "Init ${MYSHELLCONFIG_BASE} as git-repo" >&2
loginfo "Init ${MSC_BASE} as git-repo" >&2
$SGIT init
fi
@ -100,35 +100,35 @@ if ! $SSHS; then
$SGIT config user.name "${FULLNAME}"
# set upstream only if not detached
[ $($SGIT rev-parse --abbrev-ref HEAD) != "HEAD" ] && $SGIT branch --set-upstream-to=${MYSHELLCONFIG_GIT_REMOTE_NAME}/$($SGIT rev-parse --abbrev-ref HEAD)
[ $($SGIT rev-parse --abbrev-ref HEAD) != "HEAD" ] && $SGIT branch --set-upstream-to=${MSC_GIT_REMOTE_NAME}/$($SGIT rev-parse --abbrev-ref HEAD)
# sync repo with origin if git is reachable
if ckrepo ; then
loginfo "git checkout" >&2
sync_config
. ${MYSHELLCONFIG_BASE}/functions.sh
create_symlinks "$MYSHELLCONFIG_BASE"
. ${MSC_BASE}/functions.sh
create_symlinks "$MSC_BASE"
else
loginfo "${MYSHELLCONFIG_GIT_SERVER}" not reachable >&2;
loginfo "${MSC_GIT_SERVER}" not reachable >&2;
loginfo "profile not syncing" >&2;
fi
else
loginfo "Clone ${MYSHELLCONFIG_GIT_REMOTE} and configure git" >&2
loginfo "Clone ${MSC_GIT_REMOTE} and configure git" >&2
if $( timeout --foreground "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT}" \
git -C ${HOME} clone --recurse-submodules "${MYSHELLCONFIG_GIT_REMOTE}" "${MYSHELLCONFIG_BASE}" ); then
if $( timeout --foreground "${MSC_GIT_CHECKOUT_TIMEOUT}" \
git -C ${HOME} clone --recurse-submodules "${MSC_GIT_REMOTE}" "${MSC_BASE}" ); then
:
else
MYSHELLCONFIG_GIT_REMOTE="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}${MYSHELLCONFIG_GIT_REPO_NAME}"
loginfo "Clone ${MYSHELLCONFIG_GIT_REMOTE} (http, because other protocol is not reachable) and configure git" >&2
timeout --foreground "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT}" \
git -C ${HOME} clone --recurse-submodules "${MYSHELLCONFIG_GIT_REMOTE}" "${MYSHELLCONFIG_BASE}" || return 1 2>/dev/null || exit 1
MSC_GIT_REMOTE="${MSC_GIT_REMOTE_PUBLIC_HTTP}${MSC_GIT_REPO_NAME}"
loginfo "Clone ${MSC_GIT_REMOTE} (http, because other protocol is not reachable) and configure git" >&2
timeout --foreground "${MSC_GIT_CHECKOUT_TIMEOUT}" \
git -C ${HOME} clone --recurse-submodules "${MSC_GIT_REMOTE}" "${MSC_BASE}" || return 1 2>/dev/null || exit 1
fi
[ -d "${MYSHELLCONFIG_BASE}" ] && { loginfo create ${MYSHELLCONFIG_LOGDIR} >&2; mkdir -p "${MYSHELLCONFIG_LOGDIR}"; }
[ -d "${MSC_BASE}" ] && { loginfo create ${MSC_LOGDIR} >&2; mkdir -p "${MSC_LOGDIR}"; }
$SGIT config user.email "${USERNAME}"
$SGIT config user.name "${FULLNAME}"
@ -139,16 +139,16 @@ if ! $SSHS; then
loginfo "sync config" >&2
sync_config
. ${MYSHELLCONFIG_BASE}/functions.sh
. ${MSC_BASE}/functions.sh
loginfo "config synced, functions.sh sourced" >&2
create_symlinks "$MYSHELLCONFIG_BASE"
create_symlinks "$MSC_BASE"
# Install vim Plugins
# echo "Run Vim, and in Vim run :PluginInstall to install all Plugins"
# not necessary any more. Vim plugins are updated through git submodules
#vim -c "PluginInstall" -c ":qa!"
fi
[ -z ${MYSHELLCONFIG_GIT_REMOTE_PUSH+x} ] || $SGIT remote set-url --push ${MYSHELLCONFIG_GIT_REMOTE_NAME} "${MYSHELLCONFIG_GIT_REMOTE_PUSH}"
[ -z ${MSC_GIT_REMOTE_PUSH+x} ] || $SGIT remote set-url --push ${MSC_GIT_REMOTE_NAME} "${MSC_GIT_REMOTE_PUSH}"
;;
*screen*)
loginfo "I'm in sceen/tmux now - no profily syncing" >&2

View file

@ -5,10 +5,10 @@ case $(tty) in
/dev/tty[0-9]*)
case $(id -u) in
0)
TMOUT=${MYSHELLCONFIG_ROOT_TMOUT:-500}
TMOUT=${MSC_ROOT_TMOUT:-500}
;;
*)
TMOUT=${MYSHELLCONFIG_USER_TMOUT:-1000}
TMOUT=${MSC_USER_TMOUT:-1000}
;;
esac
loginfo "Run in TTY -> set autologout \$TMOUT=$TMOUT" >&2
@ -21,8 +21,8 @@ esac
# Load default values, functions, aliases for myshellconfig
if ! $SSHS; then
if [ -e ${MYSHELLCONFIG_BASE}/functions.sh ]; then
. ${MYSHELLCONFIG_BASE}/functions.sh
if [ -e ${MSC_BASE}/functions.sh ]; then
. ${MSC_BASE}/functions.sh
else
return
fi
@ -38,29 +38,29 @@ if ! $SSHS; then
# User specific aliases and function
if [ -d "${MYSHELLCONFIG_BASE}/bin" ] ; then
pathmunge "${MYSHELLCONFIG_BASE}/bin"
if [ -d "${MSC_BASE}/bin" ] ; then
pathmunge "${MSC_BASE}/bin"
export PATH
fi
if [ -d "${MYSHELLCONFIG_BASE}/git-credential-pass" ] ; then
pathmunge "${MYSHELLCONFIG_BASE}/git-credential-pass"
if [ -d "${MSC_BASE}/git-credential-pass" ] ; then
pathmunge "${MSC_BASE}/git-credential-pass"
export PATH
fi
if [ -f "${MYSHELLCONFIG_BASE}/aliases" ]; then
. "${MYSHELLCONFIG_BASE}/aliases"
if [ -f "${MSC_BASE}/aliases" ]; then
. "${MSC_BASE}/aliases"
fi
if [ -f "${MYSHELLCONFIG_BASE}/PS1" ]; then
. "${MYSHELLCONFIG_BASE}/PS1"
if [ -f "${MSC_BASE}/PS1" ]; then
. "${MSC_BASE}/PS1"
fi
# Fehler anfang
#set -x
if [ -e "${MYSHELLCONFIG_BASH_COMPLETION}" ]; then
for i in $( ls "${MYSHELLCONFIG_BASH_COMPLETION}" ); do
. "${MYSHELLCONFIG_BASH_COMPLETION}/${i}"
if [ -e "${MSC_BASH_COMPLETION}" ]; then
for i in $( ls "${MSC_BASH_COMPLETION}" ); do
. "${MSC_BASH_COMPLETION}/${i}"
done
unset i
fi
@ -68,8 +68,8 @@ if ! $SSHS; then
#set +x
# Fehler ende
if [ -f "${MYSHELLCONFIG_BASE}/myshell_load_fortmpconfig" ]; then
. "${MYSHELLCONFIG_BASE}/myshell_load_fortmpconfig"
if [ -f "${MSC_BASE}/myshell_load_fortmpconfig" ]; then
. "${MSC_BASE}/myshell_load_fortmpconfig"
fi
@ -116,7 +116,7 @@ export HISTIGNORE="ls:l:cd:exit:pwd:date:mencfs:"
export HISTTIMEFORMAT='%F %T '
export HISTSIZE=999999
loginfo "bashrc_add sourced" 2>&1 |tee -a ${MYSHELLCONFIG_LOGFILE} >&2
loginfo "bashrc_add sourced" 2>&1 |tee -a ${MSC_LOGFILE} >&2
#echo "bashrc_add sourced" >&2
# Export several functions for being usable in subshells

6
vimrc
View file

@ -10,8 +10,8 @@ set nocompatible " required
filetype off " required
"if !empty($MYSHELLCONFIG_VIM_PLUGINS)
" let pluginrepopath=$MYSHELLCONFIG_VIM_PLUGINS . '/'
"if !empty($MSC_VIM_PLUGINS)
" let pluginrepopath=$MSC_VIM_PLUGINS . '/'
" let pluginextension='.git'
"else
" let pluginrepopath=''
@ -365,7 +365,7 @@ au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" yaml syntax
" https://www.vim.org/scripts/script.php?script_id=739
" wget https://www.vim.org/scripts/download_script.php?src_id=2249 -O ~/.vim/yaml.vim
"au BufNewFile,BufRead *.yaml,*.yml so $MYSHELLCONFIG_BASE/.vim/yaml.vim
"au BufNewFile,BufRead *.yaml,*.yml so $MSC_BASE/.vim/yaml.vim
autocmd BufRead,BufNewFile /etc/exim* set filetype=exim
autocmd BufRead,BufNewFile *.yaml,*.yml set filetype=yaml