From 955561d40ff0b2e63c933170637a76e52ebf3cd5 Mon Sep 17 00:00:00 2001 From: yshurik Date: Sun, 22 Nov 2020 14:01:24 +0100 Subject: [PATCH] Generate address on first run --- Dockerfile | 1 + entrypoint.sh | 4 ++++ firstrun.sh | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100755 firstrun.sh diff --git a/Dockerfile b/Dockerfile index e91bddd..c9cc62d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,7 @@ COPY --from=build1 /bin/notbit-sendmail /bin/notbit-sendmail RUN ldd /bin/notbit COPY entrypoint.sh /entrypoint.sh +COPY firstrun.sh /firstrun.sh RUN mkdir /data RUN mkdir /data/notbit diff --git a/entrypoint.sh b/entrypoint.sh index 07cf33a..1ae7a92 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,12 @@ #!/bin/sh #/etc/init.d/dovecot start +echo Starting dovecot dovecot -c /etc/dovecot/dovecot.conf +echo Start first run check +su -l bm -c "sh /firstrun.sh &" while : do + echo Starting notbit su -l bm -c "notbit -s 2525 -D /data/notbit -m /data/maildir -l /data/notbit.log" sleep 15 #sh nohup.sh diff --git a/firstrun.sh b/firstrun.sh new file mode 100755 index 0000000..884a09a --- /dev/null +++ b/firstrun.sh @@ -0,0 +1,17 @@ +#!/bin/sh +sleep 30 +if [ ! -f /data/notbit/keys.dat ] +then + echo "Generating initial address" + export FIRSTADDR=$(notbit-keygen) + echo $FIRSTADDR + +echo -e "From: $FIRSTADDR@bitmessage\\n"\ +"To: $FIRSTADDR@bitmessage\\n"\ +"Subject: Welcome to Bitmessage system\\n"\ +"\\n"\ +"Hello from Bitmessage\\n\\n"\ +"Your personal address is $FIRSTADDR@bitmessage\\n\\n" | notbit-sendmail + +fi +