moved ssh session sourcing the ssh/session directory
backup script picks up BASH_SHELL_BASE from script directorymaster
parent
ff1d4c11be
commit
1304c3afe7
2
load.sh
2
load.sh
|
@ -65,7 +65,7 @@ function shell_process_directory () {
|
||||||
local SUBDIRS
|
local SUBDIRS
|
||||||
local IGNORE_FILE
|
local IGNORE_FILE
|
||||||
SUBDIRS=$([[ -f "$DIR/.bash-shell-include" ]] && cat "$DIR/.bash-shell-include" || echo $BASH_SHELL_BASE_SUBDIRS)
|
SUBDIRS=$([[ -f "$DIR/.bash-shell-include" ]] && cat "$DIR/.bash-shell-include" || echo $BASH_SHELL_BASE_SUBDIRS)
|
||||||
[[ $SSH_SESSION ]] && SUBDIRS+=" ssh"
|
[[ $SSH_SESSION ]] && SUBDIRS+=" ssh/session"
|
||||||
IGNORE_FILE="$([[ -f "$DIR/.bash-shell-ignore" ]] && echo "$DIR" || echo "$BASH_SHELL_BASE")/.bash-shell-ignore"
|
IGNORE_FILE="$([[ -f "$DIR/.bash-shell-ignore" ]] && echo "$DIR" || echo "$BASH_SHELL_BASE")/.bash-shell-ignore"
|
||||||
for SUBDIR in $SUBDIRS; do
|
for SUBDIR in $SUBDIRS; do
|
||||||
if [ -e "$DIR/$SUBDIR" ]; then
|
if [ -e "$DIR/$SUBDIR" ]; then
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
[[ ! $(groups | grep sudo) ]] && echo this script must be run by a user with sudo privileges && exit 1
|
[[ ! $(groups | grep sudo) ]] && echo this script must be run by a user with sudo privileges && exit 1
|
||||||
[[ ! $BASH_SHELL_BASE ]] && echo "set BASH_SHELL_BASE before running this script" && exit 2 || echo backing up shell files...
|
[[ ! $BASH_SHELL_BASE ]] && BASH_SHELL_BASE="$(dirname "$(cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")"
|
||||||
|
echo Backng up to $BASH_SHELL_BASE/setup/backup
|
||||||
|
echo ok to continue?
|
||||||
|
echo "type \`yes\` fully or just <enter> for no"
|
||||||
|
read -e answer
|
||||||
|
[[ ! $answer = "yes" ]] && exit 1
|
||||||
set -o errexit
|
set -o errexit
|
||||||
mkdir -p $BASH_SHELL_BASE/setup/backup/etc/profile.d
|
mkdir -p $BASH_SHELL_BASE/setup/backup/etc/profile.d
|
||||||
mkdir -p $BASH_SHELL_BASE/setup/backup/user
|
# mkdir -p $BASH_SHELL_BASE/setup/backup/user
|
||||||
mkdir -p $BASH_SHELL_BASE/setup/backup/root
|
mkdir -p $BASH_SHELL_BASE/setup/backup/root
|
||||||
# host system files in /etc
|
# host system files in /etc
|
||||||
[[ -f /etc/profile ]] && cp -v /etc/profile $BASH_SHELL_BASE/setup/backup/etc
|
[[ -f /etc/profile ]] && cp -v /etc/profile $BASH_SHELL_BASE/setup/backup/etc
|
||||||
[[ -f /etc/bash.bashrc ]] && cp -v /etc/bash.bashrc $BASH_SHELL_BASE/setup/backup/etc
|
[[ -f /etc/bash.bashrc ]] && cp -v /etc/bash.bashrc $BASH_SHELL_BASE/setup/backup/etc
|
||||||
[[ -d /etc/profile.d ]] && cp -vR /etc/profile.d/ $BASH_SHELL_BASE/setup/backup/etc/
|
[[ -d /etc/profile.d ]] && cp -vR /etc/profile.d/ $BASH_SHELL_BASE/setup/backup/etc/
|
||||||
# current user files in $HOME
|
# current user files in $HOME
|
||||||
[[ -f $HOME/.bash_profile ]] && cp -v $HOME/.bash_profile $BASH_SHELL_BASE/setup/backup/user
|
# [[ -f $HOME/.bash_profile ]] && cp -v $HOME/.bash_profile $BASH_SHELL_BASE/setup/backup/user
|
||||||
[[ -f $HOME/.profile ]] && cp -v $HOME/.profile $BASH_SHELL_BASE/setup/backup/user
|
# [[ -f $HOME/.profile ]] && cp -v $HOME/.profile $BASH_SHELL_BASE/setup/backup/user
|
||||||
[[ -f $HOME/.bashrc ]] && cp -v $HOME/.bashrc $BASH_SHELL_BASE/setup/backup/user
|
# [[ -f $HOME/.bashrc ]] && cp -v $HOME/.bashrc $BASH_SHELL_BASE/setup/backup/user
|
||||||
[[ -f $HOME/.bash_logout ]] && cp -v $HOME/.bash_logout $BASH_SHELL_BASE/setup/backup/user
|
# [[ -f $HOME/.bash_logout ]] && cp -v $HOME/.bash_logout $BASH_SHELL_BASE/setup/backup/user
|
||||||
if [[ $(stat -c "%G" /root) = "sudo" ]]; then
|
if [[ $(stat -c "%G" /root) = "sudo" ]]; then
|
||||||
[[ -f /root/.bash_profile ]] && cp -v /root/.bash_profile $BASH_SHELL_BASE/setup/backup/root
|
[[ -f /root/.bash_profile ]] && cp -v /root/.bash_profile $BASH_SHELL_BASE/setup/backup/root
|
||||||
[[ -f /root/.profile ]] && cp -v /root/.profile $BASH_SHELL_BASE/setup/backup/root
|
[[ -f /root/.profile ]] && cp -v /root/.profile $BASH_SHELL_BASE/setup/backup/root
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
*this will be sourced if this is a an ssh login session*
|
*anything in /session will be sourced if this is a remote ssh login session*
|
||||||
|
|
Loading…
Reference in New Issue