shell-base/install/scripts/copy-etc.sh

18 lines
946 B
Bash
Raw Permalink Normal View History

#!/bin/bash
uci_bash_shell_etc_copy () {
install_dir=${install_dir:-"$(dirname $(dirname $(realpath "${BASH_SOURCE:-$0}")))"}
echo -e "************ copying uci shell profile and bash.bashrc files to /etc ********"
files=$(find $BASH_SHELL_BASE/install/files/etc/ -maxdepth 1 -type f)
for file in $files; do install -m 644 -o root -g root $file /etc; done
echo setting BASH_SHELL_BASE to $BASH_SHELL_BASE in etc/bash.bashrc and /etc/profile
sed -i 's:_BASH_SHELL_BASE_:'${BASH_SHELL_BASE}':' /etc/bash.bashrc
sed -i 's:BASH_SHELL_BASE=.*:BASH_SHELL_BASE='${BASH_SHELL_BASE}':' /etc/profile
echo -e "************ copying uci shell profile.d/ files /etc/profile.d/ ********"
files=$(find $BASH_SHELL_BASE/install/files/etc/profile.d -maxdepth 1 -type f)
for file in $files; do install -m 644 -o root -g root $file /etc/profile.d; done
}
# # if script was executed then call the function
(return 0 2>/dev/null) || uci_bash_shell_etc_copy "$@"