From e757cca64844c4f56afda0ede9097e03b770696a Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 5 Jul 2015 04:52:31 +0100 Subject: [PATCH] rename profile.sh and others --- bin/nb-install | 4 ++-- bin/nb-update | 7 +++++-- etc/{bashrc.alias => aliases} | 0 etc/bashrc | 11 +++++------ etc/bashrc.function | 2 +- etc/profile | 10 ++++++++++ etc/profile.sh | 11 ----------- 7 files changed, 23 insertions(+), 22 deletions(-) rename etc/{bashrc.alias => aliases} (100%) create mode 100644 etc/profile delete mode 100644 etc/profile.sh diff --git a/bin/nb-install b/bin/nb-install index a95d2cc3..a47a68e5 100755 --- a/bin/nb-install +++ b/bin/nb-install @@ -4,7 +4,7 @@ # Install - NB 18.11.14 # ############################################################################## -. "${BASH_SOURCE%/*}/../etc/profile.sh" || exit +. "${BASH_SOURCE%/*}/../etc/profile" || exit declare -r NAME="$(basename "${0}")" declare TMP=/tmp/$NAME.$$ declare INSTALL="rsync -au --force" @@ -60,7 +60,7 @@ fi # # Profile # -echo "[ -r $NB_ROOT/etc/profile.sh ] && . $NB_ROOT/etc/profile.sh" > $TMP.profile +echo "[ -r $NB_ROOT/etc/profile ] && . $NB_ROOT/etc/profile" > $TMP.profile if [ -d /etc/profile.d ]; then if fdiff $TMP.profile /etc/profile.d/nb-profile.sh; then diff --git a/bin/nb-update b/bin/nb-update index 2d007e4d..b1de8a3d 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -4,8 +4,7 @@ # Call by cron/etc/nb # ##################################################################### - -. "${BASH_SOURCE%/*}/../etc/profile.sh" || exit +. "${BASH_SOURCE%/*}/../etc/profile" || exit declare -r NAME="$(basename "${0}")" ##################################################################### @@ -21,6 +20,10 @@ git pull echo ">nb-install" nb-install +NB_USER=`(ls -dl . 2>/dev/null || printf '1 2 root') | awk '{print $3}'` +echo ">Owner: $NB_USER" +chown "$NB_USER" /var/log/nb.log 2> /dev/null + ##################################################################### # Others git repos from nbdom # diff --git a/etc/bashrc.alias b/etc/aliases similarity index 100% rename from etc/bashrc.alias rename to etc/aliases diff --git a/etc/bashrc b/etc/bashrc index 9146f759..b5e36d11 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -5,6 +5,9 @@ ################################################################################# . "${BASH_SOURCE%/*}/bashrc.function" +# +# BASE +# NB_ROOT=$(realpath ${BASH_SOURCE%/*}/..) [ -z "$HOME" ] && HOME=`realpath ~/` [ -z "$HOSTNAME" ] && HOSTNAME=`hostname` @@ -13,7 +16,7 @@ NB_ROOT=$(realpath ${BASH_SOURCE%/*}/..) [ -z "$OSTYPE" ] && OSTYPE=`uname|tr [:upper:] [:lower:]` # -# PATH +# PATHS # PATH=`nb_env_add_path "$PATH" \ /bin \ @@ -83,6 +86,7 @@ fi # ls # ls_opt='-a' +case "$OSTYPE" in darwin*) DARWIN=1;; esac if [ -n "$DARWIN" ]; then [ "$color_prompt" = yes ] && ls_opt="$ls_opt -G" else @@ -93,8 +97,3 @@ fi unset ls_opt alias ll='ls -lh' unset color char color_prompt h - -# -# ALIASES -# -. "${BASH_SOURCE%/*}/bashrc.alias" diff --git a/etc/bashrc.function b/etc/bashrc.function index 003bdfd1..1e94aea0 100644 --- a/etc/bashrc.function +++ b/etc/bashrc.function @@ -271,7 +271,7 @@ find-sort-mtime() { } nb-alert() { - local cmd=". $NB_ROOT/etc/profile.sh" + local cmd=". $NB_ROOT/etc/profile" local host=macbook.brighton.loc case "$1" in led) diff --git a/etc/profile b/etc/profile new file mode 100644 index 00000000..3883f93d --- /dev/null +++ b/etc/profile @@ -0,0 +1,10 @@ +#case "$SHELL" in */zsh) BASH_SOURCE=${(%):-%N} ;; esac +[ -r "${BASH_SOURCE%/*}/bashrc" ] && . "${BASH_SOURCE%/*}/bashrc" +[ -r "${BASH_SOURCE%/*}/aliases" ] && . "${BASH_SOURCE%/*}/aliases" + +for i in $NB_ROOT/etc/*.sh; do + [ -r "$i" ] && . "$i" +done +unset i + +true diff --git a/etc/profile.sh b/etc/profile.sh deleted file mode 100644 index 17a96433..00000000 --- a/etc/profile.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -case "$SHELL" in - */zsh) BASH_SOURCE=${(%):-%N} ;; -esac - -case "$OSTYPE" in darwin*) - DARWIN=1 -esac - -[ -r "${BASH_SOURCE%/*}/bashrc" ] && . "${BASH_SOURCE%/*}/bashrc" -- 2.47.3