Skip to content

Add new env vars#13821

Merged
tianon merged 1 commit intodocker-library:masterfrom
eggheads:master
Jan 2, 2023
Merged

Add new env vars#13821
tianon merged 1 commit intodocker-library:masterfrom
eggheads:master

Conversation

@vanosg
Copy link
Contributor

@vanosg vanosg commented Jan 2, 2023

Add EGGOWNER, EGGOWNER_PASS, and CHANNELS env vars
Update develop version
Fixup some entrypoint stuff

@github-actions
Copy link

github-actions bot commented Jan 2, 2023

Diff for 08c2d16:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index d9f50ba..04b7d08 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -8,5 +8,5 @@ Directory: 1.9
 
 Tags: develop
 Architectures: amd64, arm32v6, arm64v8
-GitCommit: e94ae9c0f36d8d21a76020c936d954572ceac7f8
+GitCommit: 2738d384c741c4710aba220373c83d8641889846
 Directory: develop
diff --git a/eggdrop_develop/Dockerfile b/eggdrop_develop/Dockerfile
index a009bb6..a658375 100644
--- a/eggdrop_develop/Dockerfile
+++ b/eggdrop_develop/Dockerfile
@@ -6,8 +6,8 @@ RUN adduser -S eggdrop
 # grab su-exec for easy step-down from root
 RUN apk add --no-cache 'su-exec>=0.2'
 
-ENV EGGDROP_SHA256 297c0dacb6c3ea03b260d863be9f0f34099f5ed6d4f4ba07b7493b0f66c2cbae
-ENV EGGDROP_COMMIT 6f4309cdfb82cf0763c27d30a3db75dc96e4a8ab
+ENV EGGDROP_SHA256 caafc1ad001e2e77793dca37998cb94d88efadb4ec9c3de44c1004b04f15aa6e
+ENV EGGDROP_COMMIT 2a6a36888f5aa2204d84a9e6282d35e5421c2c8a
 
 RUN apk --update add --no-cache bash openssl
 RUN apk --update add --no-cache --virtual egg-deps wget ca-certificates make tar gnupg build-base openssl-dev \
diff --git a/eggdrop_develop/docker.tcl b/eggdrop_develop/docker.tcl
index 16a466d..fab155c 100644
--- a/eggdrop_develop/docker.tcl
+++ b/eggdrop_develop/docker.tcl
@@ -25,3 +25,33 @@ proc nag_owner {hand idx} {
     putlog "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
   }
 }
+
+### Add user from host env variable
+if {![countusers]} {
+  if {[info exists ::env(EGGOWNER)]} {
+    if {![info exists ::env(EGGOWNER_PASS)]} {
+      putlog "* ERROR: Owner handle specified, but password environment variable missing."
+      die "Quitting. Set EGGOWNER_PASS to fix"
+    } else {
+      adduser $::env(EGGOWNER)
+      setuser $::env(EGGOWNER) PASS $::env(EGGOWNER_PASS)
+      chattr $::env(EGGOWNER) +n
+      putlog "* Added handle '$::env(EGGOWNER)' as the owner of this Eggdrop"
+    }
+  } else {
+    if {[info exists ::env(EGGOWNER)]} {
+      putlog "* EGGOWNER variable set, but userfile already contains users. Owner not added."
+    }
+  }
+}
+
+### Add channels from host env variable
+foreach eggchan [split $::env(CHANNELS) ","] {
+  if {[string index $eggchan 0] ne "#"} {
+    continue
+  }
+  if {[lsearch -exact [channels] $eggchan] < 0} {
+    channel add $eggchan
+    putlog "* Adding $eggchan to Eggdrop"
+  }
+}
diff --git a/eggdrop_develop/entrypoint.sh b/eggdrop_develop/entrypoint.sh
index 3c0e126..0629dbc 100755
--- a/eggdrop_develop/entrypoint.sh
+++ b/eggdrop_develop/entrypoint.sh
@@ -87,9 +87,11 @@ EOS
       -e "/set realname \"\/msg LamestBot hello\"/c\set realname \"Docker Eggdrop!\"" \
       -e '/edit your config file completely like you were told/d' \
       -e '/Please make sure you edit your config file completely/d' eggdrop.conf
-    echo "if {[catch {source scripts/docker.tcl} err]} {" >> ${CONFIG}
-    echo "  putlog \"INFO: Could not load docker.tcl file\"" >> ${CONFIG}
-    echo "}" >> ${CONFIG}
+      echo "server add ${SERVER}" >> eggdrop.conf
+      echo "if {[catch {source scripts/docker.tcl} err]} {" >> eggdrop.conf
+      echo "  putlog \"INFO: Could not load docker.tcl file\"" >> eggdrop.conf
+      echo "  putlog \"Error: \$err\"" >> eggdrop.conf
+      echo "}" >> eggdrop.conf
       mv /home/eggdrop/eggdrop/eggdrop.conf /home/eggdrop/eggdrop/data/${CONFIG}
   else
     if [ -e /home/eggdrop/eggdrop/eggdrop.conf ]; then

Relevant Maintainers:

@tianon tianon merged commit ccf3279 into docker-library:master Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants