Skip to content

Commit 57a0842

Browse files
committed
Adjust .motd to actual directory
1 parent fb928a4 commit 57a0842

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ ssv-config.yaml.bak
1010
blox-ssv-config.yaml
1111
blox-ssv-config.yaml.bak
1212
.nada
13+
.motd
1314
post-ethd-update.sh
1415
pre-ethd-update.sh
File renamed without changes.

ethd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ __check_compose_version() {
473473

474474

475475
__prep_conffiles() {
476+
# Create .motd if it doesn't exist
477+
if [[ ! -f ./.motd ]]; then
478+
${__as_owner} cp ./.motd.sample ./.motd
479+
fi
476480
# Create prometheus.yml if it doesn't exist
477481
if [[ ! -f ./prometheus/prometheus.yml ]]; then
478482
${__as_owner} cp ./prometheus/prometheus.yml.sample ./prometheus/prometheus.yml
@@ -816,6 +820,7 @@ EOF
816820

817821
install() {
818822
local yn
823+
local project_dir
819824

820825
if [[ ! "${__distro}" =~ (ubuntu|debian) ]]; then
821826
echo "${__project_name} does not know how to install Docker on ${__distro}"
@@ -869,8 +874,14 @@ install() {
869874
[Nn]*) return 0;;
870875
*) ;;
871876
esac
877+
project_dir=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
872878
echo "alias ethd=$(realpath "${BASH_SOURCE[0]}")" >>~/.profile
873-
echo "cat $(dirname "$(realpath "${BASH_SOURCE[0]}")")/.motd" >>~/.profile
879+
echo "cat ${project_dir}/.motd" >>~/.profile
880+
if [[ ! -f ./.motd ]]; then # Also in prep_conffiles, be doubly sure
881+
${__as_owner} cp ./.motd.sample .motd
882+
fi
883+
${__as_owner} sed -i'.original' "s|~/eth-docker|${project_dir//&/\\&}|" ./.motd
884+
${__as_owner} rm -f ./.motd.original
874885
echo "Go ahead and 'source ~/.profile' or log out and back in."
875886
echo "After that, you can use the command 'ethd'."
876887
fi

0 commit comments

Comments
 (0)